Invoke application deployed in Cloud Run from Apigee Proxy
Summary
TLDRThis tutorial demonstrates deploying a Cloud Run application and an Apigee proxy using Cloud Build. It covers setting up the environment, enabling necessary APIs, and assigning roles for Cloud Build service account. The process includes building a container image, pushing it to Container Registry, and deploying it to Cloud Run. An Apigee service account with invoker role is created for accessing Cloud Run. The tutorial concludes with testing the API call to ensure successful deployment and a reminder to clean up resources.
Takeaways
- 🔧 Demonstrates how to call a Cloud Run app from Apigee using Cloud Build for deployment.
- ☁️ Cloud Run is a managed platform for deploying containers on Google's scalable infrastructure.
- 🛠️ Cloud Build is a managed CI/CD platform for automated builds.
- 🔑 Prerequisites include Apigee exposure, external access configuration, and GCP deployment permissions.
- 🛠️ Required tools are gcloud, unzip, curl, and jq.
- 📝 The tutorial can be followed using Cloud Shell with QuickStart.
- 💻 Sets up environment variables in an 'environment.sh' file for the deployment process.
- 🔄 Enables necessary APIs like IAM, Cloud Build, Cloud Run, and Container Registry.
- 👤 Assigns roles to the Cloud Build service account for Apigee and Cloud Run access.
- 🚀 Triggers Cloud Build to deploy the application and sets up the service account for Apigee access.
- 🔗 Modifies the target URL in the 'cloudbuild.yaml' file to point to the Cloud Run service.
- 📈 Tests the API call to ensure successful deployment and returns the expected service message.
- 🗑️ Reminds viewers to clean up resources after deployment.
Q & A
What is Cloud Run and how does it relate to the video's content?
-Cloud Run is a managed compute platform that allows users to run stateless containers that are invocable via HTTP requests. It is part of Google Cloud's scalable infrastructure. In the video, Cloud Run is used to deploy a sample application that is then accessed via an API deployed through Apigee.
What is the role of Cloud Build in the context of this video?
-Cloud Build is Google Cloud's fully managed continuous integration and delivery platform. In the video, it is used to automate the deployment of a Cloud Run application by building a container image, pushing it to Container Registry, and then deploying it to Cloud Run.
What is Apigee and how does it interact with Cloud Run in the video?
-Apigee is an API management platform that allows developers to create, manage, and secure APIs. In the video, Apigee is used to deploy a proxy that acts as an intermediary for the Cloud Run service, enabling API traffic management and access control.
What are the prerequisites for the sample demonstrated in the video?
-The prerequisites include having an Apigee environment configured for external access, the ability to deploy a proxy to Apigee, deploy an application to Cloud Run, and the ability to trigger a Cloud Build job in the GCP project.
What tools does a user need to have installed to follow the video tutorial?
-A user needs to have tools like gcloud, unzip, curl, and jq installed to follow the tutorial. These tools are necessary for interacting with Google Cloud services and managing the deployment process.
How does the video demonstrate the setup of the environment for deploying the Cloud Run application?
-The video demonstrates environment setup by using Cloud Shell with QuickStart, authenticating with GCP, navigating to the Cloud Run directory, and setting up environment variables in an 'environment.sh' file.
What APIs need to be enabled before deploying the Cloud Run samples?
-Before deploying the Cloud Run samples, the IAM API, Cloud Build API, Cloud Run API, and Container Registry API need to be enabled.
What roles and permissions are assigned to the Cloud Build service account in the video?
-The Cloud Build service account is assigned the Apigee Org Admin role, Cloud Run Admin, and Service Account Admin and User roles to facilitate the deployment process.
What is the content of the application deployed to Cloud Run as per the video?
-The application deployed to Cloud Run is a simple Node.js application that prints the text 'Mocktarget Service.' This is demonstrated in the 'app.js' file within the 'app' directory.
How is the Apigee proxy deployed in the video?
-The Apigee proxy is deployed using a 'cloudbuild.yaml' file that outlines steps for building the container image, pushing it to the container registry, and deploying it to Cloud Run. It also sets up a service account with the invoker role and changes the target URL to the Cloud Run endpoint before running the Maven deploy bundle step.
How can one test the successful deployment of the Cloud Run application and Apigee proxy?
-After deployment, one can test the API call to ensure that the deployment was successful. In the video, this is demonstrated by making an API call that returns the expected response 'Mocktarget Service.'
Outlines
🚀 Deploying Cloud Run and Apigee Integration
The speaker introduces a tutorial on deploying a Cloud Run application and setting up a proxy in Apigee. Cloud Run is described as a managed platform for container deployment on Google's scalable infrastructure, while Cloud Build is a CI/CD platform for automated builds. The tutorial requires prerequisites such as Apigee exposure, external access configuration, and user permissions for deploying proxies and applications. Essential tools like gcloud, unzip, curl, and jq are necessary. The demonstration uses Cloud Shell with QuickStart, guiding through environment setup, authentication, directory navigation, and environment variable configuration. The video also covers enabling necessary APIs and assigning roles to the Cloud Build service account. The application to be deployed is a simple Node.js app, and the deployment process is detailed in the cloudbuild.yaml file, which includes building a container image, pushing it to the registry, and deploying it to Cloud Run. Lastly, it sets up a service account with the invoker role for Apigee to access Cloud Run.
🔧 Testing and Cleanup After Deployment
This paragraph details the final steps of the deployment process, including triggering the Cloud Build, which may take some time to complete. Upon completion, the service 'mock-target' is deployed in Cloud Run, and a proxy 'sample-cloud-run' is deployed in Apigee. The speaker demonstrates testing the API call to ensure successful deployment, which returns the expected 'Mocktarget Service.' message. The video concludes with a reminder to clean up the resources used and thanks the viewers for watching. It also provides a sign-up link for Apigee and directs viewers to the Apigee community for any questions.
Mindmap
Keywords
💡Cloud Run
💡Apigee
💡Cloud Build
💡IAM API
💡Service Account
💡Container Registry
💡Cloud Shell
💡Environment Variables
💡API Traffic
💡Maven
💡Clean Up
Highlights
Demonstration of calling a Cloud Run app from Apigee.
Use of Cloud Build for deploying a Cloud Run application.
Utilization of Apigee build and deploy plugin for sample proxy deployment.
Introduction to Cloud Run as a managed platform for container deployment.
Explanation of Cloud Build as a CI/CD platform for automated builds.
Prerequisites for the sample include Apigee exposure and external access configuration.
Requirements for user access to deploy proxies to Apigee and applications to Cloud Run.
Necessity of tools like gcloud, unzip, curl, and jq for the sample.
Demonstration using Cloud Shell with QuickStart tutorial.
Instructions on setting up environment and authenticating with GCP.
Guidance on setting environment variables in the environment.sh file.
Enabling of IAM API, Cloud Build API, Cloud Run API, and Container Registry API.
Assignment of roles to the Cloud Build service account for API access.
Triggering of Cloud Build to initiate deployment processes.
Overview of the application in the app directory and its functionality.
Explanation of the cloudbuild.yaml file and its steps for building and deploying.
Creation of a service account with invoker role for Apigee to access Cloud Run.
Modification of the target URL to the Cloud Run endpoint for Apigee proxy deployment.
Execution of deploy bundle step to deploy the Apigee proxy.
Observation of Cloud Build completion and deployment of services in Cloud Run and Apigee.
Testing the API call to confirm successful deployment.
Advice on cleaning up resources after deployment.
Invitation to sign up for Apigee and engage with the Apigee community for questions.
Transcripts
SPEAKER: Hi.
In this sample, I will demonstrate
how to call a Cloud Run app from Apigee.
I will use Cloud Build to deploy a Cloud Run application
and use the Apigee build and deploy plugin
to deploy a sample proxy.
Cloud Run is a managed contract platform
that lets you wrap containers directly
on top of Google's scalable infrastructure.
And Cloud Build is a fully managed continuous integration
delivery and deployment platform that
lets you run fast, consistent, and reliable automated build.
The prerequisite for the samples are--
have an Apigee exposure and configure external access
for API traffic.
As a user, you will need access to deploy a proxy to Apigee,
deploying an application to Cloud Run,
and also trigger a Cloud Build job in the GCP project.
Have tools like gcloud, unzip, curl, and jq installed.
The sample can be demonstrated using the Cloud Shell
Quickstart tutorial or following this setup instruction.
In this video, we will use a Cloud Shell with QuickStart.
Click the Open In Cloud Shell to open the Cloud Shell
environment.
Once the environment is loaded, let's follow the instructions
provided in the tutorial.
First, we will set up environment.
We will authenticate with GCP.
Then we will go to Cloud Run directory.
We need to set up environment variables.
For that, we need to edit environment dot sh file and add
some variables.
So in this case, our project is--
we will set other variables.
Once all the variables are set, we will Save this file,
and we will run the source command
to initiate these variables in my shell.
Before we deploy the Cloud Run samples,
we need to enable IAM API, Cloud Build API, Cloud Run API,
and Container Registry API.
Once these APIs are enabled, we need
to assign Apigee Org Admin role, Cloud Run Admin, and Service
Account Admin and User role to the Cloud Build service
account.
Now we need to trigger Cloud Build.
But before we trigger the Cloud Build,
let's look at the application that we need
to deploy in the Cloud Run.
So application is available in the app directory,
and you can look at the app.js file, which is a simple Node.js
application which prints a text, "Mocktarget Service."
Then let's look at the cloudbuild.yaml file.
The first step is to build container image.
Then it pushes the container image to container registry.
Then it deploys that image to Cloud Run.
Once it is deployed, Apigee needs a service account
with invoker role to access Cloud Run.
So this step sets those variables
and creates the service account.
Before it runs the Maven to deploy Apigee proxy,
it needs to change the target url to that
of the cloudrunandpoint url.
And once all these variables are set,
you run deploy bundle step to deploy the Apigee proxy.
Now let's go and trigger the Cloud Build.
This process takes some time.
The Cloud Build is finished.
You can see that the service called mock-target is deployed
in Cloud Run and a proxy called sample-cloud-run
is deployed in Apigee.
You can test the API call to make sure the deployment was
successful.
As you can see, it returns "Mocktarget Service."
Don't forget to clean up this.
Thanks for watching.
I hope this content was useful to you.
If you have not signed up for Apigee yet, use this link.
And if you have any questions, please
visit the Apigee community.
Посмотреть больше похожих видео
DE Zoomcamp 1.3.1 - Introduction to Terraform Concepts & GCP Pre-Requisites
you need to learn Kubernetes RIGHT NOW!!
Develop an app with Gemini assistance
Linux Basics: Enable Remote Desktop (RDP) on Linux
Full Node.js Deployment - NGINX, SSL With Lets Encrypt
Serverless API with Cloudflare Workers (Hono, D1 & Drizzle ORM)
5.0 / 5 (0 votes)