Book Image

Hands-On Serverless Computing with Google Cloud

By : Richard Rose
Book Image

Hands-On Serverless Computing with Google Cloud

By: Richard Rose

Overview of this book

Google Cloud's serverless platform allows organizations to scale fully managed solutions without worrying about the underlying infrastructure. With this book, you will learn how to design, develop, and deploy full stack serverless apps on Google Cloud. The book starts with a quick overview of the Google Cloud console, its features, user interface (UI), and capabilities. After getting to grips with the Google Cloud interface and its features, you will explore the core aspects of serverless products such as Cloud Run, Cloud Functions and App Engine. You will also learn essential features such as version control, containerization, and identity and access management with the help of real-world use cases. Later, you will understand how to incorporate continuous integration and continuous deployment (CI/CD) techniques for serverless applications. Toward the concluding chapters, you will get to grips with how key technologies such as Knative enable Cloud Run to be hosted on multiple platforms including Kubernetes and VMware. By the end of this book, you will have become proficient in confidently developing, managing, and deploying containerized applications on Google Cloud.
Table of Contents (19 chapters)
1
Section 1: App Engine
4
Section 2: Google Cloud Functions
9
Section 3: Google Cloud Run
14
Section 4: Building a Serverless Workload

Creating a simple web application

Now that we know how to build and deploy a container on Cloud Run on GKE, the next step is to explore how to link this together with other services to create an application. With our application deployed on GKE, we now need to configure Cloud Storage and Cloud Pub/Sub.

For our example, we are going to build a form to call our announce service:

  1. Create a new directory called simple-form:
mkdir simple-form && cd $_
  1. Initialize the environment:
npm init --yes
  1. Edit the package.json file and add the start command:

"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
  1. Install the npm packages (pug and express):
npm install pug
npm install express
In the following code, we will call our announce-service:1.0. Replace the service...