From 21f616f853b9dbb8d9325a45cebc818250de09e9 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 23 Jun 2017 16:32:14 +0100 Subject: [PATCH] Add short docs on using Google App Engine Now that Google actually supports arbitrary docker container execution in app engine, we can provide some more guidance on how to use it in the "deployment" section. Closes gh-9585 --- .../src/main/asciidoc/deployment.adoc | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/deployment.adoc b/spring-boot-docs/src/main/asciidoc/deployment.adoc index f002e6d1cce..5136bb00dc0 100644 --- a/spring-boot-docs/src/main/asciidoc/deployment.adoc +++ b/spring-boot-docs/src/main/asciidoc/deployment.adoc @@ -439,8 +439,64 @@ Maven build to run the app. [[cloud-deployment-gae]] -=== Google App Engine -Google App Engine is tied to the Servlet 2.5 API, so you can't deploy a Spring Application +=== Google Cloud + +Google Cloud has several options that could be used to launch Spring Boot applications. The +easiest to get started with is probably App Engine, but you could also find ways to run +Spring Boot in a container with Container Engine, or on a virtual machine using Compute Engine. + +To run in App Engine you can create a project in the UI first, which +sets up a unique identifier for you and also HTTP routes. Add a Java +app to the project and leave it empty, then use the +https://cloud.google.com/sdk/downloads[Google Cloud SDK] to push your +Spring Boot app into that slot from the command line or CI build. + +App Engine needs you to create an `app.yaml` file to describe the +resources your app requires. Normally you put this in +`src/min/appengine`, and it looks something like this: + +[source,yaml,indent=0] +---- +service: default + +runtime: java +env: flex + +runtime_config: + jdk: openjdk8 + +handlers: +- url: /.* + script: this field is required, but ignored + +manual_scaling: + instances: 1 + +health_check: + enable_health_check: False + +env_variables: + ENCRYPT_KEY: your_encryption_key_here +---- + +You can deploy the app, for example, with a Maven plugin by simply +adding the project ID to the build configuration: + +[source,xml,indent=0,subs="verbatim,quotes,attributes"] +---- + + com.google.cloud.tools + appengine-maven-plugin + 1.3.0 + + myproject + + +---- + +Then deploy with `mvn appengine:deploy` (if you need to authenticate first the build will fail). + +NOTE: Google App Engine Classic is tied to the Servlet 2.5 API, so you can't deploy a Spring Application there without some modifications. See the <> of this guide.