Deploy Your Website On Google Cloud in 10 mins

Shola Slick Akinrolie
Shades of Cloud
Published in
4 min readFeb 28, 2022

Google Cloud as a cloud service provider is obviously one of the best in the world, delivering cloud services to businesses, startups and organizations.

Whether your business is just getting started or your Startup is in the ideation stage or on its way to digital transformation, Google Cloud can help you solve your toughest challenges by building on Google Cloud with $300 in free credits and 20+ always free products.

Google also provides space for funding and mentorship in its Google for Startups program including thousands of USD worth of Cloud credits.

With Google’s core infrastructure, data analytics, computing power, enhanced security, you can easily deploy your web applications at a go without spending much.

Below are the 7 basic steps on how to deploy your website on Google Cloud using Cloud Run.

  1. Environment setup:
  • Make sure you have a Google Account(Gmail):
    Sign in to the Google Cloud Console — Click Project > Create project.

New users of Google Cloud are eligible for a $300 free trial.

2. Clone source repository of your web app from GitHub

This tutorial shows that you’re deploying an existing website, so you only need to clone the source from your repository on your GitHub, so you can focus on creating Docker images and deploying to Cloud Run.

Run these commands to set up your environment for your website using Monolith-Microservice.
Run the following commands to clone the repository to your Cloud Shell instance and change it to the appropriate directory. You’ll also install the Node.js dependencies so that you can test your app before deployment.

cd ~
git clone https://github.com/googlecodelabs/monolith-to-microservices.git
cd ~/monolith-to-microservices
./setup.sh

Run these commands to start your web server:
cd ~/monolith-to-microservices/monolith
npm start

Your Output should be: Monolith listening on port 8080!

3. Create Docker container with Cloud Build.
Now you need to containerise or dockerize your App.

You can build a Docker container and push it to a registry to store the image for GKE(Google Kubernetes) to pull, or you can use Cloud Build to build the Docker container and put the image in Container Registry with a single command!
Follow this Codelab for more instructions

4. Deploy container to Cloud Run.

Now that you have containerized your website and pushed it to Container Registry, it’s time to deploy to Cloud Run!

There are basically two approaches for deploying to Cloud Run:

  • Cloud Run (fully managed) is the PaaS model where the entire container lifecycle is managed.
  • Cloud Run for Anthos is Cloud Run with an additional layer of control, which allows you to bring your clusters and Pods from GKE.

We are using Cloud Run fully managed(Option 1) to deploy, by specifying the region you will like to run your cloud in, and this should be the closest region to you, say US-Central1 or EU-West1

Follow the remaining simple step in this Codelab to finish up.

5. Create a new revision with lower concurrency.
Redeploy the same container image: follow the link for the final step

6. Make changes to the website. Click the link for procedures.

7. Update the website with zero downtime. Click the link for procedures.

You can agree with me that the steps are pretty easy and simple, I can’t wait to see what you will build. Feel free to drop a comment and clap for this article for better reach.

In the coming articles, the focus will be around deployment on the cloud either on GCP, AWS or Azure.

Stay tuned and see you in the cloud.

Follow Shades of Cloud Publication for more insightful stuff on cloud computing.
Medium: Shades of Cloud Publication.
Twitter: @shadesofcloud
Facebook: @Shadesofcloud
Blog: Shadesofcloud
Author: Follow @meetslick on all platforms </>
Thank You!!

Resource: Google Cloud, Free $300 Cloud Credits CodeLab GCP

--

--

Shola Slick Akinrolie
Shades of Cloud

Simplifying Products and Technology for Developers and Users Consumption, Adoption and Happiness🔥• Software Engr • Developer Advocate •