Build JHipster Microservices and Deploy to Google Cloud with Kubernetes

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.

Diagram

Last week, I spent an evening recording a screencast of how to generate a microservices architecture using the following steps:

  1. Convert blog demo app from a monolith to a gateway by changing .yo-rc.json to the following values and running yo jhipster --with-entities.
    hibernateCache: "hazelcast"
    serviceDiscovery: "eureka"
    applicationType: "gateway"
    
  2. Create a "store" microservices app with MongoDB and generate a product entity.
  3. Create a UI for the product entity in the gateway app using yo jhipster:entity product.
  4. Clone the JHipster Registry in a parallel directory to apps, start everything (using Docker Compose for MongoDB) and prove it all works.
  5. Create a k8 directory alongside apps and run yo jhipster:kubernetes.
  6. Create a Google Cloud project at console.cloud.google.com.
  7. Install Google Cloud SDK and set project using gcloud config set project $project-name.
  8. Create a cluster:
    gcloud container clusters create demo --machinetype=n1-standard-2 --scopes cloud-platform
  9. Run kubectl commands to deploy.
  10. Use port-forwarding to see the registry app locally.
    kubectl port-forward jhipster-registry-0 8761:8761
  11. 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! 🤕


← Back to Home All Posts