[MUSIC PLAYING]
SPEAKER: Cloud Shell Editor makes it easy
for you to write code directly in your web browser
and deploy it to the Cloud, and Cloud Run
makes it easy to deploy highly scalable
containerized applications on a fully managed serverless
platform.
So you might be wondering, can I write the code for my Cloud Run
apps in Cloud Shell Editor?
Yes, you definitely can.
Thanks to its Cloud Code integration, Cloud Shell Editor
works great with Cloud Run development workflows,
allowing you to build, deploy, and debug your application
in just a couple of clicks.
In this video, we're going to see
how to use Cloud Shell Editor to deploy an application to Cloud
Run.
Let's go.
First, visit ide.cloud.google.com
to launch the Cloud Shell Editor.
On the status bar at the bottom of your screen,
click Cloud Code.
From the Cloud Code menu, click New Application,
and then select the Cloud Run application
for the type of sample app we want to create.
After that, we'll get a list of Cloud Run templates
to choose from.
Let's go with the Python Flask option.
Next, select a folder in your Cloud Shell environment
to save your application to, and give it a name.
If that looks good, click Create New Application.
Cloud Shell Editor clones the files
for your sample application from GitHub into a new workspace.
You can see the list of files in the Explorer panel located
on the left side of the screen.
Now let's go ahead and deploy the service.
Let's go down to the status bar again and click Cloud Code.
This time, we'll click Deploy to Cloud Run.
Click Authorize to authorize Cloud Shell to make Google
Cloud Platform API calls to give Cloud Shell Editor access
to your Google Cloud resource.
Since this is the first time using
Cloud Run in this project, we're prompted here
to enable the Cloud Run API.
In the Deploy to Cloud Run dialog, under Service Settings,
we can set the name for our service.
And under Deployment, we can select the region
we want it to be deployed to.
Since we want to make this a public service,
we'll keep Allow Unauthenticated Invocations selected.
There are some additional settings
we can adjust, like container settings, environment
variables, and Cloud SQL connections.
There are also build settings, where
you can choose your builder from Docker and Buildpacks.
For now, we'll leave those as their default values
and click Deploy.
Cloud Code now builds your image,
pushes it to the Container Registry,
and deploys your app to Cloud Run.
Once you see the message "Deployment completed
successfully," your service is live and accessible
via the URL displayed in the Deploy to Cloud Run dialog.
That was pretty easy, and updating your Cloud Run app
is just as simple.
Let's redeploy your app with an update to this message.
Back in our Cloud Shell Editor from the Explorer panel,
let's open the file app.py.
In the hello function, we'll find the message variable
that holds the friendly HTTP greeting we just saw.
Let's update that message.
Cloud Shell Editor automatically saves all file changes.
Once we make our changes, we can head back down to Cloud Code
down in the status bar.
Once again, let's click Deploy to Cloud Run.
This time, the service we created before
is listed here in the Service Settings.
Let's hit Deploy to deploy our updated service.
Once it's done, we can head back to our deployment URL
and refresh the page.
And there it is.
Our app has been redeployed with the updated code.
With just a couple of clicks, we were
able to deploy, update, and redeploy a simple Cloud Run
application, and we were able to do it all directly
from our browser window without having to leave our Cloud Shell
Editor.
Do you want to give it a try yourself?
Check out the interactive tutorial
linked in the description below, or by launching it
from the Cloud Shell Editor Welcome page.
For more videos on Cloud Shell Editor and a whole lot more,
make sure to subscribe to the channel.
Join me next time, when I'll show you
how easy it is to use Cloud Shell Editor to deploy
to Google Kubernetes Engine.
See you then.
[MUSIC PLAYING]