Jinna Balu


JHipster Demo

Jinna Balu's photo
Jinna Balu
·Nov 30, 2021·

4 min read


Install Jhipster Stack - Local installation with NPM

Install Docker - Ubuntu

Install Docker Compose - Ubuntu


Demo on scaffolding application creation to deployment with docker. This blog explains about

  • How to create the application?
  • How to run locally as a developer?
  • How to create the docker image?
  • How to push and pull the created docker image to the docker hub?
  • How to deploy on the cloud? We use docker playground as a cloud provider for this demo.

After the successful installation of the pre-requisites, follow the below steps

Create the Application

We use the jhipster yeoman generator to create the application in the interactive mode by answering the few questions given generator about the tech stack, ports, front end technology, and so on. Let's scaffold the app.

> jhipster

1. Which *type* of application would you like to create?
   Monolithic application (recommended for simple projects)

2. What is the base name of your application?

3. Do you want to make it reactive with Spring WebFlux?

4. What is your default Java package name?

5. Which *type* of authentication would you like to use?
   JWT authentication (stateless, with a token)

6. Which *type* of the database would you like to use?
   SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL)

7. Which *production* database would you like to use?

8. Which *development* database would you like to use?

9. Which cache do you want to use? (Spring cache abstraction)
   Ehcache (local cache, for a single node)

10. Do you want to use Hibernate 2nd level cache?

11. Would you like to use Maven or Gradle for building the backend?

12. Do you want to use the JHipster Registry to configure, monitor, and scale your application? 

13. Which other technologies would you like to use?
    Elasticsearch as search engine

14. Which *Framework* would you like to use for the client?

15. Do you want to generate the admin UI?

16. Would you like to use a Bootswatch theme (https://bootswatch.com/)? 
    Default JHipster

17. Would you like to enable internationalization support?

18. Please choose the native language of the application?

19. Besides JUnit and Jest, which testing frameworks would you like to use?

20. Would you like to install other generators from the JHipster Marketplace? 

21. Would you like to generate code coverage for Cypress tests? [Experimental]?

Run the application

Run in Local

Run the docker container for MySQL
cd src/main/docker/
docker-compose -f mysql.yml up -d
Run front end on one terminal
npm install
npm start
Run backend on other terminal

Push the code to git repository either on GitHub, Bitbucket, Gitlab

  • Create the repository in the git server
  • Push your project to the GitHub/Bitbucket/Gitlab

    cd <App created>
    git add --all
    git commit -am "MESSAGE "
    git remote add origin <REPO_URL>
    git push -u origin master

    To Dockerize your Application

  • To achieve this, first build a docker image of your app by running

./mvnw -Pprod verify jib:dockerBuild

Create the Docker Image and push to docker hub

  • For this, we need the docker hub account
  • Steps to create the docker image is available in the README.md
  • Push the docker image
  • Provide your username and password to push the docker image to dockerhub

    docker login
    docker tag <IMAGE CREATED> <dockerhub-user-name/IMAGE_NAME>
    docker push <dockerhub-user-name/IMAGE_NAME>

    Run Application on Docker Playground - TRY IT IF YOU CAN

  • You need docker hub credentials

  • Login and create the instances
  • clone the repo
  • pull the docker images from the docker hub and retag back to the
docker login
docker pull <dockerhub-user-name/IMAGE_NAME>
docker tag <dockerhub-user-name/IMAGE_NAME> <IMAGE CREATED>
  • run the app
    cd <App CLONED>
    cd src/main/docker/
    docker-compose -f app.yml up -d

To expose these ports outside your dev PC

  • Edit the app.yml file
  • Remove the "" prefix
cd <App CLONED>
cd src/main/docker/
vi app.yml
Share this