logo
Steps
1
Introduction
2
Create Simple NextJS Application
3
Configure Google Cloud Project
4
Build A Docker Image
5
Publish Docker Image on GCP
6
Create a Kubernetes Cluster
7
Deploy the Docker to K8s Cluster
8
Creating a Load Balancer
9
Changing your DNS Settings
10
Clean Up
11
Conclusion

Introduction

NextJS is a popular framework to write react web applications. It has amazing features like Static Site Generation (SSG) and Server Side Rendering to make your web applications extremely fast and gives a boost to your SEO.  It comes correctly configured with all the bells and whistles needed to make your react application production-ready. 
But deploying an app to cloud environment requires quite a lot of configuration and learning new things. This tutorial guides you on how you can deploy NextJS application to a Kubernetes Cluster on Google Cloud Platform and then point your custom domain name to it.

Prerequisites

  • Domain Name 
    In the last stage, we will pointing your custom domain name to your NextJS application hosted on Google Cloud Platform.  You can buy domain names from various sites like NameCheap, Or Domain.Google
  • Google Cloud Account
    You also need to have account created on Google Cloud Console with billing account setup. If you don't have one, you can create here

Running on Google Cloud may incur charges

Please make sure you follow instructions in last step to clean up your cluster after you are done.

What you need?

Before we begin, we need below dependencies installed on your machine -
  1. NodeJS 10.13Or Above
  2. gcloud Utilities
To confirm if your environment setup is correct, you can run simple version commands on your terminal as shown below
bash
If any of the dependencies are missing, please use the links given to setup your environment properly.

Expected Output

At the end of this codelab, you would be able to get your web application hosted on your custom domain name and served by a kubernetes cluster hosted in GCP

Source Code

The entire source code is available here 
Let's get Started !
Next
Discussion
You
0