JHipster has the ability to generate a microservices architecture. A typical microservices architecture is composed of a registry and config server, a gateway, 1-many microservice applications, and a monitoring application. The diagram below shows the open source components that JHipster uses.
Last week, I spent an evening recording a screencast of how to generate a microservices architecture using the following steps:
- Convert blog demo app from a monolith to a gateway
by changing
.yo-rc.jsonto the following values and runningyo jhipster --with-entities.hibernateCache: "hazelcast" serviceDiscovery: "eureka" applicationType: "gateway"
- Create a "store" microservices app with MongoDB and generate a
productentity. - Create a UI for the
productentity in the gateway app usingyo jhipster:entity product. - Clone the JHipster Registry in a parallel directory to apps, start everything (using Docker Compose for MongoDB) and prove it all works.
- Create a
k8directory alongside apps and runyo jhipster:kubernetes. - Create a Google Cloud project at console.cloud.google.com.
- Install Google Cloud SDK and set project using
gcloud config set project $project-name. - Create a cluster:
gcloud container clusters create demo --machinetype=n1-standard-2 --scopes cloud-platform
- Run
kubectlcommands to deploy. - Use port-forwarding to see the registry app locally.
kubectl port-forward jhipster-registry-0 8761:8761
- Scale microservice apps as needed:
kubectl scale deployment store —replicas=3
I recorded a screencast of this process and published it to YouTube.
I also attended Devoxx US last week and spoke about What's New in JHipsterLand. You can see the slides from my talk below. The source code for the microservices demo I did is available on GitHub.
The next JHipster talk I'll be doing will be at Devoxx UK. Until then, stay hip my friends!
Update: Devoxx US has posted a video of What's New in JHipsterLand on YouTube. You might notice I have a black eye in this video. That's from skiing the trees at Northstar and getting nipped by a branch the weekend before. It was so warm, I wore sunglasses instead of goggles. Doh! 🤕