Installing JHipster

Local installation vs. Docker

We provide 2 ways of working with JHipster:

  • You can do a "local installation", which is the classical way of working with JHipster. Everything is installed on your machine, which can be a little complex to setp up, but that's how most people usually work. In case of doubt, choose this installation.
  • You can use a "Docker" container, which brings you a lightweight, virtualized container with everything already installed. You don't have to worry about installing everything. But Docker is a rather young tool, and you need to know how to use Linux quite well.

Local installation (recommanded for normal users)

Install Node.js from the Node.js website.

Install Yeoman:

npm install -g yo

Install JHipster:

npm install -g generator-jhipster

To find more information, tips and help, please have a look at the Yeoman "getting starting" guide before submitting a bug.

Docker installation (for advanced users)

Information

JHipster has a specific jhipster-docker project, which provides a Docker container.

This project makes a Docker "Trusted build" that is available on:

https://registry.hub.docker.com/u/jdubois/jhipster-docker/

This image will allow you to run JHipster inside Docker.

Usage

Install Docker on your machine.

Pull the JHipster Docker image:

sudo docker pull jdubois/jhipster-docker

Create a "jhipster" folder in your home directory:

mkdir ~/jhipster

Run The docker image, with the following options:

  • The Docker "/jhipster" folder is shared to the local "~/jhipster" folder
  • Forward all ports exposed by docker (8080 for Tomcat, 9000 for the Grunt server, 22 for SSHD). In the following example we forward the container 22 port to the host 4022 port, to prevent some port conflicts:

sudo docker run -v ~/jhipster:/jhipster -p 8080:8080 -p 9000:9000 -p 4022:22 -t jdubois/jhipster-docker

You can now connect to your docker container with SSH. You can connect as "root/jhipster" or as "jhipster/jhipster", and we recommand you use the "jhipster" user as some of the tool used are not meant to be run by the root user.

Start by adding your SSH public key to the Docker container:

cat .ssh/id_rsa.pub | ssh -p 4022 [email protected] 'mkdir .ssh && cat >> .ssh/authorized_keys'

You can now connect to the Docker container:

ssh -p 4022 [email protected]

You can then go to the /jhipster directory in your container, and start building your app inside Docker:

cd /jhipster yo jhipster

Once your application is created, you can run all the normal grunt/bower/maven commands, for example:

mvn spring-boot:run

Congratulations! You've launched your JHipster app inside Docker!

On your host machine, you should be able to :

  • Access the running application at http://localhost:8080
  • Get all the generated files inside your shared folder

As the generated files are in your shared folder, they will not be deleted if you stop your Docker container. However, if you don't want Docker to keep downloading all the Maven and NPM dependencies every time you start the container, you should commit its state.