Google has come up with a neat idea to promote its serverless container service, Cloud Run, by asking developers to incorporate a "Run on Google Cloud" button into their git repositories.
The Cloud Run Button is a "single click" option to build and deploy a container-based application to Google's cloud – though in practice a little bit more user interaction is required.
It works by opening a Google Cloud Shell, a browser-based terminal into a small Linux VM with access to Google Cloud services, but set to a custom Cloud Shell image with Cloud Run deployment scripts. The code for these scripts is here. If a Dockerfile is present in the repository, that will be used to build the container, or it can use Cloud Native Buildpacks.
Developers who want to take advantage of this option can customise the process further by adding an app.json configuration file to the repository. This will prompt the user to use specific values for environment variables to configure the application.
Cloud Run is Google's serverless solution for deploying containers. It comes in two flavours. The fully managed version, which is what you would be likely to use with the Cloud Run button, requires very little configuration (you can change the memory available for each container instance) and includes autoscaling from one up to 1,000 instances, or more if you pre-arrange with support. The snag is that containers have no access to your compute engine network and uses an automatic service URL by default.
The other flavour of Cloud Run uses Google's Kubernetes Engine (GKE). You get full access to your Google VPC (Virtual Private Cloud) and compute engine network, and can use a custom domain. However, autoscaling is limited to the size of your GKE cluster.
The Cloud Run Button project on Github states that it is "not an official Google project", but the company is now promoting its use through an official blog post.
"Cloud Run Button works with any repository that has a Dockerfile, or that can be built using Cloud Native Buildpacks," said developer advocate James Ward. "When you click the Cloud Run Button to deploy an application, it packages the application source code as a container image, pushes it to Google Container Registry, and deploys it on Cloud Run."
Google is not alone in offering easy deployment of containers to a managed service. AWS has the two varieties of Fargate, the fully managed Fargate launch type or EC2 (Elastic Compute Cloud), which leaves it to you to specify the provisioning of the virtual servers. Unlike Cloud Run, though, Fargate does not have a Kubernetes option. Fargate for EKS (Elastic Kubernetes Service) is promised but not yet available.
Microsoft Azure also has options for running containers serverless. You can use Azure Container Instances, with an option to autoscale on Azure Kubernetes Service, or Azure Web App for Containers for simple container deployment to a managed service.
Google's Cloud Run button nicely demonstrates how quickly you can get a containerised application up and running on Google's cloud, but not really easier than what is on offer from its rivals. Embedding the option into a git repository might make sense for internal use in companies that have standardised on Google's cloud platform, though there is a risk of proliferating little demo applications that are created but never deleted. ®