After going through Part 1, Part 2 and Part 3, here is the last installment of this series. This is where your application is actually going live in the wild Internet. 😅

Preparing Google Cloud Build

The mission of Cloud Run in life is to deploy and scale HTTP/S-driven workloads packed in containers. So let’s build a container for our Ruby on Rails application. As the goal of this tutorial is to show you how to best leverage various GCP services, let’s rely on Google Cloud Build (GCB) to assemble our container.

Prior to launching the build command we must grant Cloud Build (or more precisely the service account that impersonates Cloud Build) with the cloudkms.cryptoKeyDecrypter role on the three pieces of information that we encrypted earlier (see Part 3). With this role Cloud Build is able to decrypt those secrets when needed in the build process (more on this in the cloudbuild.yaml


In Part 1 of this tutorial we setup our project environment and Part 2 was dedicated to running the Photo Album application in your local development environment.

Setting up Cloud Run

If not already done in Part 1, enable the Cloud Run API:

Also define the Google Cloud region Cloud Run will be running in:

Note: as of this writing Cloud Run is still in beta phase and, therefore, only available from the us-central1region

Setting up Rails master key

Since version 5.2, Rails generates a secret master key to encrypt user session parameters in cookies, other types of sensitive information going back and forth between the application and the browser as well as your own application data of need be. …


Part 1 was about setting up your GCP project as well as your work environment. Let’s now focus on the Photo Album application itself and run it locally before going to production.

Note: running the Photo Album application in your local environment is optional. You can safely skip this part (or just skim through it) and go to Part 3.

Introducing the Photo Album application

The Rails application we are using in this tutorial is a Photo Album. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store