Info Espressos: JHipster

Process for creating Microservices in JHipster:

Ensure you have an outer folder for your project:

  • change to the directory where you keep all your projects
    • cd ~/projects
  • create the directory for this project
    • mkdir media-project

Create the 3 types of components for a microservices system:

  • JHipster Registry: A standard JHipster app. Enables communication between the microservice components.
    • change to the project dir created earlier
      • cd ~/projects/media-project
    • download/clone the registry app from github:
      • git clone https://github.com/jhipster/jhipster-registry
    • change to the created registry folder and run the maven wrapper:
      • cd jhipster-registry && ./mvnw
    • browse to:
      • http://localhost:8761/
    • log in with:
      • user: admin, pw: admin:
  • Microservices: aka Microservice Apps. Each microservice app contains the back-end entities and business rules for a particular domain or sub-domain of the larger system and exposes a REST API for communication with the microservice.
    • change to the top-level project dir
      • cd ~/projects/media-project
    • create a folder for the microservice app and cd to it
      • mkdir videos-app && cd videos-app
    • generate the microservice app
      • yo jhipster
      • answer questions:
        • app type:
          • Microservices application
        • base name:
          • videosapp
        • other generators:
          • No
        • port:
          • 8081
        • default Java package:
          • com.videos.app
        • type of authentication:
          • JWT (stateless with a token)
        • service discovery and config:
          • JHipster Registry (Eureka and Spring Cloud Config)
        • database type:
          • SQL
        • production DB:
          • MySQL
        • dev DB:
          • H2 with disk-based persistence
        • use Hybernate 2nd level cache:
          • Yes – with Hazelcast (distributed cache for multiple nodes)
        • Maven or Gradle to build the back-end?:
          • Maven or Gradle depending on your preference
        • other technologies:
        • internationalization:
          • Yes
        • languages:
          • choose
        • testing frameworks:
      • add an entity (back-end in Spring Boot):
        • yo jhipster:entity video
        • answer questions
          • specify the fields for the entity:
            • title
            • genre
            • director
        • since this is a microservice app, only back-end code is generated here for the entity – no HTML, CSS, or JS/TS – that will be generated in the gateway app.
        • check the README for useful commands and info.
        • rinse and repeat for adding more entities
    • run the microservice app using Maven or Gradle wrapper depending on your choice above
      • ./mvnw  or ./gradlew [first ensure the jhipster-registry is running]
  • Microservice Gateway: Front-end UI components in Angular.  Communicates with the microservice apps through their exposed REST APIs.
    • change to the top-level project folder
      • cd ~/projects/media-project
    • create a folder for the gateway app and cd to it
      • mkdir gateway-app && cd gateway-app
    • generate the gateway app
      • yo jhipster
      • answer questions:
        • type of application:
          • Microservices gateway
        • base name of app:
          • gateway
        • install other generators?:
          • No
        • port:
          • 8080
        • package:
          • com.gateway
        • authentication type:
          • JWT (stateless, with a token)
        • service discovery and config:
          • JHipster Registry (using Eureka and Spring Cloud config)
        • database type:
          • SQL
        • production database:
          • MySql
        • dev database:
          • H2 with disk-based persistence
        • Hibernate 2nd level cache?:
          • Yes, with HazelCast (distributed cache, for multiple nodes)
        • other technologies?:
        • client framework:
          • Angular 2 (or later)
        • LibSass css preprocessor?:
          • Yes
        • internationalization support?:
          • Yes
        • testing frameworks?:
      • generate an entity (front-end UI in Angular):
        • yo jhipster:entity video
        • answer questions
          • generate from existent microservice:
            • Yes
          • path for the microservice app:
            • ../videos-app
          • update entity?:
            • Yes, regenerate the entity. [This will find the Video.json file previously created in the microservice app directory when we generated the video entity and use the metadata there to create the UI code.]
        • rinse and repeat for more entities
    • run the gateway app using the maven wrapper
      • ./mvnw

 

Building a Microservices Application with JHipster 4 and Docker in 30 Minutes by IPPON

Easy microservices with JHipster by Julien Dubois, Deepu K Sasidharan (under 3 hours):

Microservices for the Masses with Spring Boot, JHipster, and JWT by Matt Raible:

Build microservices with JHipster and deploy to Google Cloud with Kubernetes: