Microservices are a specific kind of JHipster applications. Please refer to our main Using JHipster in production documentation for more information on doing a production build, optimizing it and securing it.
Please refer to our JHipster Registry documentation for learning which runtime dashboards are available, and how to use them.
Our monitoring documentation is also very important, to learn specific information on using:
- JHipster 控制台来使用 ELK；
- Zipkin 来创建 HTTP 服务请求追踪；
- 当有错误发生时，Elastalert 获取告警
When using the Docker-Compose sub-generator, you will be asked if you want to add monitoring to your infrastructure. This option will add the JHipster Console to your
docker-compose.yml file. Once started, it will be available on http://localhost:5601 and start to gather your applications’ logs and metrics.
For gateways and microservices applications, additional features are provided to help you effectively monitor a microservices cluster. For example logs are enriched with each application’s name, host, port and Eureka/Consul ServiceId so that you can trace from which service instance they are originating from. The JHipster Console also comes with default dashboards that give you an overview of all your services metrics.
使用微服务架构意味着你将会有好几个不同的服务和数据库，这种场景下使用 Docker Compose 将会是一个管理你开发、测试、生成环境的强大工具。
在我们的 Docker Compose 说明文档 有一个章节介绍微服务，我们强烈推荐使用微服务架构的你能熟悉这个文档。
Docker Swarm，使用和 Docker Machine 一致的 API，使得在云平台内开发微服务架构就和在你本机上开发一样。查阅我们的 Docker Compose 说明文档 来了解更多关于 Docker Compose 和 JHipster。
The Cloud Foundry sub-generator works the same with a microservices architecture, the main difference is that you have more applications to deploy:
- Use the Cloud Foundry sub-generator to deploy first the JHipster Registry (which is a normal JHipster application).
- Note the URL on which your JHipster Registry is deployed. Your applications must all point to that URL:
- In the
spring.cloud.config.urimust point to
- In the
eureka.client.serviceUrl.defaultZonemust point to
- In the
- Deploy your gateway(s) and microservices
- Scale your applications as usual with Cloud Foundry
One important point to remember is that the JHipster Registry isn’t secured by default, and that the microservices are not supposed to be accessible from the outside world, as users are supposed to use the gateway(s) to access your application.
Two solutions are available to solve this issue:
- Secure your Cloud Foundry using specific routes.
- Keep everything public, but use HTTPS everywhere, and secure your JHipster Registry using Spring Security’s basic authentication support
Heroku sub-generator works nearly the same with a microservices architecture, the main difference is that you have more applications to deploy:
Deploy a JHipster Registry directly with one click:
Please follow the Heroku sub-generator documentation in order to understand how to secure your JHipster Registry.
Note the URL on which your JHipster Registry is deployed. Your applications must all point to that URL in their
application-prod.yml file. Change that configuration to be:
eureka: instance: hostname: https://admin:[password]@[appname].herokuapp.com prefer-ip-address: false
You can now deploy and scale the gateway(s) and microservices. The Heroku sub-generator will ask you a new question, to know the URL of your JHipster Registry: this will allow your applications to fetch their configuration on the Spring Cloud Config server.