Skip to content

General-Studies/jhipster-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservice Architecture Diagram

Eureka

Jhipster Registry

https://github.com/jhipster/jhipster-registry

Config before run

  1. open pom.xml
  2. change <java.version>11</java.version> to <java.version>8</java.version>
  3. find <release>${java.version}</release> and comment this line

Perform that commands, the Jipster Registry will be supported by java version 8 instead version 11 (recommend use version 11 because, in soon, the support to java 8 will be removed)

Clone, install and run

  1. git clone https://github.com/jhipster/jhipster-registry.git registry
  2. cd registry && npm install && ./mvnw

Run if already exist

  1. cd registry && ./mvnw

Docker Services

Before to execute the services deploy, its need execute the script bellow (this script work only to Linux based operation system): cd ./docker && sh create-volumes-to-docker-service.sh

Deploy

  1. cd ./docker
  2. sh deploy-services.sh

Undeploy

  1. cd ./docker
  2. sh undeploy-services.sh

Keycloak

keycloak.yml

The directory realm-config contains the realm will be imported to Keycloak on startup.

Its necessary add an configration to /etc/hosts to allow use Keycloak inside Docker.

127.0.0.1	keycloak

Postgres + PgAdmin4

postgres.yml

MongoDB + MongoExpress

mongodb.yml

Youtube helper tutorial

https://www.youtube.com/watch?v=6Gd7OOjqHX0

Blog Service

  1. Which type of application would you like to create? Microservice application
  2. [Alpha] Do you want to make it reactive with Spring WebFlux? No
  3. What is the base name of your application? blog
  4. As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port confli cts. 8081
  5. What is your default Java package name? com.jetherrodrigues.blog
  6. Which service discovery server do you want to use? JHipster Registry (uses Eureka, provides Spring Cloud Config support and monitoring dashboards)
  7. Which type of authentication would you like to use? OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)
  8. Which type of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
  9. Which production database would you like to use? PostgreSQL
  10. Which development database would you like to use? PostgreSQL
  11. Do you want to use the Spring cache abstraction? Yes, with the Hazelcast implementation (distributed cache, for multiple nodes, supports rate-limiting for gateway applications)
  12. Do you want to use Hibernate 2nd level cache? Yes
  13. Would you like to use Maven or Gradle for building the backend? Maven
  14. Which other technologies would you like to use? Search engine using Elasticsearch
  15. Would you like to enable internationalization support? Yes
  16. Please choose the native language of the application English
  17. Please choose additional languages to install Portuguese (Brazilian)
  18. Besides JUnit and Jest, which testing frameworks would you like to use? Gatling, Cucumber
  19. Would you like to install other generators from the JHipster Marketplace? (y/N) n

JDL

  1. cd blog
  2. jhipster import-jdl blog.jdl
entity Blog {
  name String required minlength(3)
  handle String required minlength(2)
}

entity Post {
  title String required
  content TextBlob required
  date Instant required
}

entity Tag {
  name String required minlength(2)
}

relationship ManyToOne {
  Blog{user(login)} to User
  Post{blog(name)} to Blog
}

relationship ManyToMany {
  Post{tag(name)} to Tag{entry}
}

microservice Blog with blog
microservice Post with blog
microservice Tag with blog

Eureka

Store Service

  1. Which type of application would you like to create? Microservice application
  2. [Alpha] Do you want to make it reactive with Spring WebFlux? No
  3. What is the base name of your application? store
  4. As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port confli cts. 8082
  5. What is your default Java package name? com.jetherrodrigues.store
  6. Which service discovery server do you want to use? JHipster Registry (uses Eureka, provides Spring Cloud Config support and monitoring dashboards)
  7. Which type of authentication would you like to use? OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)
  8. Which type of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
  9. Which production database would you like to use? PostgreSQL
  10. Which development database would you like to use? PostgreSQL
  11. Do you want to use the Spring cache abstraction? Yes, with the Hazelcast implementation (distributed cache, for multiple nodes, supports rate-limiting for gateway applications)
  12. Do you want to use Hibernate 2nd level cache? Yes
  13. Would you like to use Maven or Gradle for building the backend? Maven
  14. Which other technologies would you like to use? Search engine using Elasticsearch
  15. Would you like to enable internationalization support? Yes
  16. Please choose the native language of the application English
  17. Please choose additional languages to install Portuguese (Brazilian)
  18. Besides JUnit and Jest, which testing frameworks would you like to use? Gatling, Cucumber
  19. Would you like to install other generators from the JHipster Marketplace? (y/N) n

JDL

  1. cd store
  2. jhipster import-jdl store.jdl
entity Product {
    sku String required minlength(5) unique
    name String required minlength(3)
    observation String maxlength(256)
    price BigDecimal required
}

microservice Product with store

Eureka

Gateway Service

  1. Which type of application would you like to create? Microservice gateway
  2. [Alpha] Do you want to make it reactive with Spring WebFlux? No
  3. What is the base name of your application? gateway
  4. As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port confli cts. 8080
  5. What is your default Java package name? com.jetherrodrigues.gateway
  6. Which service discovery server do you want to use? JHipster Registry (uses Eureka, provides Spring Cloud Config support and monitoring dashboards)
  7. Which type of authentication would you like to use? OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)
  8. Which type of database would you like to use? MongoDB
  9. Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node)
  10. Would you like to use Maven or Gradle for building the backend? Maven
  11. Which other technologies would you like to use? (Press to select, to toggle all, to invert selection) Nothing
  12. Which Framework would you like to use for the client? Angular
  13. Would you like to use a Bootswatch theme (https://bootswatch.com/)? Lumen
  14. Choose a Bootswatch variant navbar theme (https://bootswatch.com/)? Primary
  15. Would you like to enable internationalization support? Yes
  16. Please choose the native language of the application English
  17. Please choose additional languages to install Portuguese (Brazilian)
  18. Besides JUnit and Jest, which testing frameworks would you like to use? Gatling, Cucumber, Protractor
  19. Would you like to install other generators from the JHipster Marketplace? (y/N) N

Import JDL

  1. jhipster import-jdl ../blog/blog.jdl
  2. jhipster import-jdl ../store/store.jdl

Generated Docker Compose Resources

  1. cd docker-compose-msa

  2. jhipster docker-compose

  3. Which type of application would you like to deploy? Microservice application

  4. Which type of gateway would you like to use? JHipster gateway based on Netflix Zuul

  5. Enter the root directory where your gateway(s) and microservices are located ../

  6. Which applications do you want to include in your configuration? blog, gateway, store

  7. Which applications do you want to use with clustered databases (only available with MongoDB and Couchbase)? (Press to select, <a

to toggle all, to invert selection) Nothing

  1. Do you want to setup monitoring for your applications ? No
  2. JHipster registry detected as the service discovery and configuration provider used by your apps - Enter the admin password used to secure the JHipster Registry admin

Images

To generate the missing Docker image(s), please run: ./mvnw -ntp -Pprod verify jib:dockerBuild in ../blog ./mvnw -ntp -Pprod verify jib:dockerBuild in ../gateway ./mvnw -ntp -Pprod verify jib:dockerBuild in ../store

  • cd docker-compose-msa && docker-compose up -d

Docker Services Managment Tool

https://github.com/maxdevjs/kitematic.wiki-my/blob/master/Linux-Install.md

if an error occurred in installation access this link to help to solve the install problem:

https://www.how2shout.com/how-to/how-to-install-kitematic-on-ubuntu-20-04.html