部署到谷歌云平台

Google Cloud Platform

You can deploy JHipster applications to Google Cloud Platform easily and run on:

You can obtain Google Cloud Platform free trial to deploy your applications. Please check the Always Free tiers for free usages up to the specified usage limits during and past the free trial period.

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.

  1. Generate a new monolith application: jhipster
  2. Run Google App Engine generator: jhipster gae
  3. When prompted, create a new Cloud SQL instance if creating a brand new application

This generator will:

  1. Add src/main/webapp/WEB-INF/application-web.xml that describes the App Engine instance and autoscaling configuration.
  2. Add the App Engine plugin to Maven / Gradle.

To deploy:

  1. 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.

  1. Enable API: gcloud services enable container.googleapis.com containerregistry.googleapis.com
  2. Install kubectl CLI if not already installed: gcloud components install kubectl
  3. 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.

  1. Generate Kubernetes deployment files: jhipster kubernetes
  2. If you want to use Google Container Registry to host container images in a private registry:
  3. What should we use for the base Docker repository name set to gcr.io/YOUR_PROJECT_ID

Build the container image.

  1. If you use Google Container Registry, you can build directly to the registry without local Docker daemon: ./mvnw package -Pprod jib:build
  2. Otherwise, build to Docker daemon: ./mvnw package -Pprod jib:dockerBuild

Deploy to Kubernetes cluster:

  1. Apply the Kubernetes configurations: ./kubectl-apply.sh

For full Kubernetes generator features, see Deploying to Kubernetes.