Skip to content

Commit f54f2bc

Browse files
committed
Merge pull request #9585 from dsyer:feature/appengine
* pr/9585: Add short docs on using Google App Engine
2 parents 85c7643 + 21f616f commit f54f2bc

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

spring-boot-docs/src/main/asciidoc/deployment.adoc

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,64 @@ Maven build to run the app.
439439

440440

441441
[[cloud-deployment-gae]]
442-
=== Google App Engine
443-
Google App Engine is tied to the Servlet 2.5 API, so you can't deploy a Spring Application
442+
=== Google Cloud
443+
444+
Google Cloud has several options that could be used to launch Spring Boot applications. The
445+
easiest to get started with is probably App Engine, but you could also find ways to run
446+
Spring Boot in a container with Container Engine, or on a virtual machine using Compute Engine.
447+
448+
To run in App Engine you can create a project in the UI first, which
449+
sets up a unique identifier for you and also HTTP routes. Add a Java
450+
app to the project and leave it empty, then use the
451+
https://cloud.google.com/sdk/downloads[Google Cloud SDK] to push your
452+
Spring Boot app into that slot from the command line or CI build.
453+
454+
App Engine needs you to create an `app.yaml` file to describe the
455+
resources your app requires. Normally you put this in
456+
`src/min/appengine`, and it looks something like this:
457+
458+
[source,yaml,indent=0]
459+
----
460+
service: default
461+
462+
runtime: java
463+
env: flex
464+
465+
runtime_config:
466+
jdk: openjdk8
467+
468+
handlers:
469+
- url: /.*
470+
script: this field is required, but ignored
471+
472+
manual_scaling:
473+
instances: 1
474+
475+
health_check:
476+
enable_health_check: False
477+
478+
env_variables:
479+
ENCRYPT_KEY: your_encryption_key_here
480+
----
481+
482+
You can deploy the app, for example, with a Maven plugin by simply
483+
adding the project ID to the build configuration:
484+
485+
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
486+
----
487+
<plugin>
488+
<groupId>com.google.cloud.tools</groupId>
489+
<artifactId>appengine-maven-plugin</artifactId>
490+
<version>1.3.0</version>
491+
<configuration>
492+
<project>myproject</project>
493+
</configuration>
494+
</plugin>
495+
----
496+
497+
Then deploy with `mvn appengine:deploy` (if you need to authenticate first the build will fail).
498+
499+
NOTE: Google App Engine Classic is tied to the Servlet 2.5 API, so you can't deploy a Spring Application
444500
there without some modifications. See the <<howto.adoc#howto-servlet-2-5, Servlet 2.5 section>>
445501
of this guide.
446502

0 commit comments

Comments
 (0)