App Engine
Deploy a JAR to a fully managed PaaS with just one command.
App Engine is a fully managed Platform-as-a-Service that can run your application, provision a HTTPS load balancer, and scale out your workload as needed. When no one is using your application, it can scale down to zero.
Getting Started
Clone
cd $HOME
git clone https://github.com/saturnism/jvm-helloworld-by-example
cd jvm-helloworld-by-example/helloworld-springboot-tomcat
Build
./mvnw package
Deploy
gcloud app deploy target/helloworld.jar
Once you select the region, you cannot change it for an App Engine application.
Connect
Once deployed, the command will output the HTTPs URL. To open the URL in your browser:
gcloud app browse
To find the URL without opening the browser:
gcloud app browse --no-launch-browser
You can curl
the URL:
URL=$(gcloud app browse --no-launch-browser)
curl ${URL}
Additional Configuration
By default, App Engine will deploy with the smallest F1
instance class. You can specify a larger instance, configure environment variables, and more tuning parameters using an app.yaml
:
runtime: java11
instance_class: F4
env_variables:
SPRING_PROFILES_ACTIVE: "prod"
Deploy the JAR file with the configuration:
gcloud app deploy target/helloworld.jar \
--appyaml app.yaml
Learn More
Last updated
Was this helpful?