Deploying to Google Cloud Platform
You can deploy JHipster applications to Google Cloud Platform easily and run on:
- Virtual machines with Google Compute Engine
- Containers in Kubernetes with Google Kubernetes Engine
- Platform as a Service with Google App Engine
Before you start
Install and authenticate with the gcloud SDK on your local environment to access
gcloud CLI. For more information, visit this link:
Deploy to Google App Engine
Google App Engine is a fully managed Platform as a Service that can automatically scale up application instances under load, and scale down to zero when not used.
You can use the Google App Engine generator to generate and deploy JHipster application. Google App Engine generator is currently beta and supports monolith application, with Cloud SQL MySQL/PostgreSQL database.
- Generate a new monolith application:
- Run Google App Engine generator:
- When prompted, create a new Cloud SQL instance if creating a brand new application
This generator will:
src/main/webapp/WEB-INF/application-web.xmlthat describes the App Engine instance and autoscaling configuration.
- Add the App Engine plugin to Maven / Gradle.
- Use the App Engine plugin to deploy:
./mvnw appengine:deploy -DskipTests -Pprod,prod-gae
In addition to simply run your application, Google App Engine provides full suite of features to manage and operate:
- Traffic Splitting - Deploy multiple versions of your application and split traffic to different versions. This is also great for canary new changes.
- Stackdriver Logging - Automatically capture and store application logs in centralized logging that can be searched, monitored, and exported.
- Error Reporting - Automatically extract errors and exceptions for the log and notify you of new errors.
- Cloud Debugger - Allow you to debug your production application without stopping the world. If you needed more log messages to diagnose the issue, simply add new log messages without redeploying/restarting your application.
You can watch a walk through of features in 2018 JHipster Conf video on the Google App Engine generator with Ray Tsang and Ludovic Champenois.
Deploy to Google Kubernetes Engine
Google Kubernetes Engine is a fully managed Kubernetes cluster as a service. Once provisioned, you can deploy your containers and JHipster applications using standard Kubernetes commands.
- Enable API:
gcloud services enable container.googleapis.com containerregistry.googleapis.com
kubectlCLI if not already installed:
gcloud components install kubectl
- Create a new Google Kubernetes Engine cluster:
gcloud container clusters create mycluster
Once the cluster is created, you can use JHipster Kubernetes generator to generate the deployment descriptors.
- Generate Kubernetes deployment files:
- If you want to use Google Container Registry to host container images in a private registry:
- What should we use for the base Docker repository name set to
Build the container image.
- If you use Google Container Registry, you can build directly to the registry without local Docker daemon:
./mvnw package -Pprod jib:build
- Otherwise, build to Docker daemon:
./mvnw package -Pprod jib:dockerBuild
Deploy to Kubernetes cluster:
- Apply the Kubernetes configurations:
For full Kubernetes generator features, see Deploying to Kubernetes.