This repository provides various example applications which can be deployed to GCP Cloud Run.
Very crudely, Cloud Run are hosted containers that act as services based on runtime images like Springboot. These services are cheaper to run than Cloud Functions and are able to provide faster cold start times.
These samples assume you have a basic understanding of GCP, hosted compute services and Docker.
You can setup a service which monitors a repo and will then kick off a build/deploy process if a change to that repo is detected. These repos can either be: -
- Source repos - like Git
- Container repos - like GCR.IO
Cloud Run Status: Ready for use
The following samples are provided. You can use the Run on Cloud
button to build and deploy the
samples directly to GCP - assuming you have an account setup to use GCP!
Sample | Description | Deploy |
---|---|---|
samples/FileSampleApp | A simple File loading sample | |
samples/GCESample | A simple GCE compute sample | |
samples/SimpleSpringApp | A simple SpringApp sample | |
samples/StorageGCSSample | A simple GCS storage sample |
Which one to use? Well, that is essentially up to the scenario you are coding for. They both achieve the same functionally, but do it in slightly different ways.
Generally, I would suggest using Cloud Run for REST and HTTP/S service endpoints and using Cloud Functions for event based operations. There is a fairly long discussion about which approach to use here.
One of the challenges with the public cloud providers is that there is always multiple ways of doing the samething. You have to choose the one that best serves the problem you are trying to solve.
The following are additional Cloud Run samples and documentation
- https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/run
- https://cloud.google.com/run
- https://cloud.google.com/run/docs/continuous-deployment-with-cloud-build
- https://cloud.google.com/run/docs/tutorials
- https://cloud.google.com/run/docs/quickstarts
- https://cloud.google.com/run/docs/how-to
- https://docs.spring.io/spring-framework/docs/4.3.1.RELEASE/javadoc-api/index.html?overview-summary.html
The contents of this repository (documents and examples) are provided “as-is” with no warrantee implied or otherwise about the accuracy or functionality of the examples.
You use them at your own risk. If anything results to your machine or environment or anything else as a result of ignoring this warning, then the fault is yours only and has nothing to do with me.