Challenge 2: Containerizing your Application

Previous Challenge Next Challenge

Introduction

Now that our cluster is ready for action, we need to work on our monolithic application. Currently it is a stand alone node.js/React application that runs on the command line. We will be going through the steps to make this ready to deploy onto our Kubernetes cluster.

Description

In this challenge, you will begin by installing the application and making sure it works standalone first, before starting any work on it.

We’ve made the application available on github as a zip file at this link. Download the zip and extract its contents into your Cloud Shell (or local dev) environment.

To set up required node.js libraries in a fresh download, run the setup.sh script. Afterwards, you need to start the node.js application in the monolith folder and pull up the home page of your app to make sure it is working.

Now that we’ve confirmed it is working, we need to containerize the application and deploy it to a Docker repository.

You’ll need to do the following:

  • Create a new standard Artifact Registry to store docker containers (choose a region near you)
  • Using Google Cloud Build, issue a single gcloud command that will build a container and push it up to your new Artifact Registry.
    • NOTE: You will need to run this command in the global region

Success Criteria

  • You successfully started the application and were able to navigate to its home page on port 8080
  • You have a new Artifact Registry docker repository provisioned in a region near you
  • With one command, you built the container and pushed it to your new Artifact Registry using Cloud Build in the global region.

Learning Resources

Tips

  • If using the Cloud Shell as recommended, there is an easy way to open a browser window to a port of your choice running in the Cloud Shell.
  • A Dockerfile is already provided for you in the git repository you cloned.

Previous Challenge Next Challenge