Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Labs

Cloud Run Data in GCS and Firestore

In this lab, we'll deploy a basic image gallery app with Cloud Run, and then refactor it so it uses Cloud Storage instead of local file system storage. Then, we'll add the ability to add metadata to images, which we'll store in the Cloud Firestore NoSQL database. You should be familiar with the GCP console and Cloud Shell to perform this hands-on lab. Some experience with Python will be beneficial.

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Aug 21, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Deploy the image-gallery App to Cloud Run

    1. Download the image-gallery code from the course GitHub repo.
    2. Build the container image from the 1-local-storage directory.
    3. Deploy the container to Cloud Run.
    4. Upload a picture of a dog (any dog will do).
  2. Challenge

    Refactor the App to Use Cloud Storage

    1. Create a Cloud Storage bucket for image uploads.
    2. Refactor the code to use Cloud Storage instead of local storage. You can refer to the updated code in 2-cloud-storage, or just use the code in that directory instead of updating your own. Don't forget to change the value of BUCKET_NAME.
    3. Rebuild the container and deploy the updated version of the app to Cloud Run, using gcloud run deploy options of --cpu=2 --max-instances=1 --memory=4Gi.
    4. Re-upload your dog picture.
    5. Deploy a new revision to force the instance to be removed and recreated. The image you uploaded should persist.
  3. Challenge

    Deploy the Cloud Firestore Version of the App

    1. Go to the Cloud Firestore section in the GCP console, and enable Firestore in Native Mode. Choose the us-east1 region.
    2. Refactor the code to use Cloud Firestore in addition to Cloud Storage. You can refer to the updated code in 3-firestore, or just use the code in that directory instead of updating your own.
    3. Rebuild the container and deploy the updated version of the app to Cloud Run.
    4. Upload a dog picture with a description. You should see the image uploaded to Cloud Storage and a document created in Cloud Firestore.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans