This repo contains a GCP Run project template. It comes with the following design decisions:
- It uses Spring Boot as the web framework.
- It uses Gradle to manage the build.
- It's 100% Kotlin (with Java 8 compatibility).
Besides the basic functionality provided by Spring Boot, the following features are included:
- A
Makefileto automate deploying and running locally using Docker (see below for details). - A
Dockerfilesuited for Gradle-based projects. - A sample
RootControllerthat will print out values for key environment variables. - Configured to use GCP Spring extensions (
spring-cloud-gcp-starter).
During development, you probably want to use IntelliJ IDEA. Simply open the project, the IDE will recognize it's a Spring project and will add the right run configuration.
The Makefile automates the basic tasks you need from this project:
make build-image: Builds the Docker image using GCP Cloud Build.make run-image: Runs the Docker image locally (for testing purposes).make deploy-image: Deploys the image. We're setting the memor to 512M instead of the default 256M (otherwise, the container will fail to deploy despite using-XX:+UseCGroupMemoryLimitForHeap).
/: Should respondOK.with a 200./info: It'll print a JSON object with a number of environment variables. A sample output would look like:
{
"now": 1555286644082,
"port": "8080",
"javaVersion": "jdk8u202-b08",
"krevision": "template-00003",
"kservice": "template",
"kconfiguration": "template"
}
If you find any issues, of thing of features that could benefit a majority of users, please cut a ticket or open a PR. Enjoy!