Deploy a Python Visualization Panel App to Google Cloud Run
Key Takeaways
Deploy a Python Visualization Panel App to Google Cloud Run using Google Cloud SDK, Cloud Build, and Terraform.
Full Transcript
hello everyone today i would like to talk about how to deploy a python app or dashboard to google cloud run with three simple scripts and also how to automate your google cloud setup through cloud build and terraform first let's set up our google cloud account the google cloud run documentation mentioned the following steps you need to do to enable running a project so first let's go to the project select selector you will need to create a new project here i created one called panel cloud run so i'm just gonna use this project for now i like to keep my project id the same as my project name so that i can keep track of my project um and then second you want to go to this link to confirm that billing is enabled and also then install the cloud sdk following this link so i have done all that so once we have uh downloaded the google cloud sdk you should be able to do gcloud in it to initialize the google cloud sdk on your local machine you can also do cloud config set project panel cloud run to set your current project to the project id you want it to be okay so that's it for the setup in terms of creating the app there are three scripts we need to create a panel app and then deploy it the first one app.pi this is the python file that creates the panel app to run this app locally you can simply do conda install panel edge replot and run panel serve app.pi second we have the requirements.txt which lists all the package dependencies of our panel app so for our panel app we only need panel bokeh and h3plot the third file we need is the docker file installs python and its project's dependencies and then run the commands panel serve app.pi to run our panel app okay with everything ready i have um so i have this repo in my local machine so i can just direct um myself into this folder this is the same thing and then to deploy my app i can simply run cloud run deploy we need to define the service folder and then let it run so after a few minutes you should see the service url showing up and then let's go to this url and take a look cool it seems working and then if we go to our dashboard and then go to the cloud rom uh so this is the information of the app we just deployed we can delete this one if we don't want this anymore and then this page should give us a 404. okay so the next thing i would like to talk about is to deploy app to google cloud run using terraform so when we did the gcloud run deploy we have to define the region of the project we also need to enable a bunch of services apis if we're running it the first time terraform can help us capture all those decisions in code so that can we have a place to see how the infrastructure is exactly doing and how it is set up to use terraform with google cloud round there are two parts part one is to use cloudbuild.yaml file to build a container image to execute your app with this cloudbuild.yml file we could simply do cloud builds submit to submit a build using google cloud build okay so here's the docker images we have under our project so right now we see there's no pro no docker image here but after a few minutes after this command finished running we should see a darker image now this finished running let's see if anything showed up so yeah so here we see a docker image uploaded to our container registry under the current project so that is part one part two part two is to use terraform so we have a file called main.pdf this is a terraform configuration file it does the following things first it creates a variable project for us so we we can define what project we want in the command line it enables the crowd the cloud round service it specifies the crowd run services for example we use the image that we just uploaded from from the cloud build in the cloud run service here we also set the service public and then we return our service url so this defines everything we need to be able to create and run a cloud run service okay so in order to run terraform first of all we need to if you're running it locally like i do you need to do con install conda forge terraform i already did that so let's see conda list terraform you can see i have terraform installed in my environment already and then we can do terraform in it to initialize terraform next we can do a terraform plan variable project equals your project name here i have piano crowd cloud run this gives us a chance to review your execution plan so you can see this is the things we're gonna do with our google cloud project and after we confirm everything looks good we can do terraform apply to the project we want so now we got another service url let's take a look cool now we have this app served again using terraform if you would like to remove the cloud run service you can also do terraform destroy or you can simply go to the project list and delete your project that's probably the safest way to to delete an app so that's it for today's video thank you so much for watching bye bye
Original Description
Deploy a Python Visualization Panel App to Google Cloud II: Google Cloud Run, Google Cloud Build, and Terraform
In my last video, I talked about how to deploy a Python visualization Panel App to Google Cloud App Engine. App Engine works well, but it can be expensive because the app runs continuously whether anyone is using it or not. Luckily, there is a cheaper option called Cloud Run that only runs when receiving requests.
In this video, I will walk you through how to deploy a Python app or dashboard to Google Cloud Run with three simple scripts, and also how to automate your Google Cloud setup via Cloud Build and Terraform.
Article link: https://sophiamyang.medium.com/deploy-a-python-visualization-panel-app-to-google-cloud-ii-416e487b44eb?sk=aac35055957ba95641a6947bbb436410
Github link: https://github.com/sophiamyang/panel_cloud_run
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Sophia Yang · Sophia Yang · 5 of 60
1
2
3
4
▶
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Customer lifetime value in a discrete-time contractual setting (math and Python implementation)
Sophia Yang
Time series analysis using Prophet in Python — Math explained
Sophia Yang
Multiclass logistic/softmax regression from scratch
Sophia Yang
Deploy a Python Visualization Panel App to Google Cloud App Engine
Sophia Yang
Deploy a Python Visualization Panel App to Google Cloud Run
Sophia Yang
[Read a paper (with code)] Beyond Accuracy: Behavioral Testing of NLP models with CheckList
Sophia Yang
5-step data science workflow
Sophia Yang
Multi-armed bandit algorithms - ETC Explore then Commit
Sophia Yang
Multi-armed bandit algorithms - Epsilon greedy algorithm
Sophia Yang
User retention analysis framework | data science product sense
Sophia Yang
Visualization and Interactive Dashboard in Python: My favorite Python Viz tools — HoloViz
Sophia Yang
Multi-armed bandit algorithms: Thompson Sampling
Sophia Yang
The Easiest Way to Create an Interactive Dashboard in Python
Sophia Yang
Big Data Visualization Using Datashader in Python | How does Datashader work and why is it so fast?
Sophia Yang
Why do you want to be a data scientist? Don't be a data scientist if ...
Sophia Yang
Johnny Depp v Amber Heard Twitter Sentiment Analysis | Is Camille Vasquez the real winner | 🤗 NLP
Sophia Yang
How to build a product that sells itself | Product-led Growth | Book Summary | Read a book with me
Sophia Yang
Designing Machine Learning Systems | book summary | Read a book with me
Sophia Yang
Where do data scientists/analysts go next? Love and hate in data analytics (ft. Shashank Kalanithi)
Sophia Yang
Meet the Author: Fundamentals of Data Engineering | DS/ML book club
Sophia Yang
What's new in hvPlot releases 0.8.0 & 0.8.1?
Sophia Yang
Meet the Author: Machine Learning Design Patterns | What do ML/Research Engineers do at Google?
Sophia Yang
Machine Learning Design Patterns | Google Executive | Investor | Meet the Author
Sophia Yang
How to solve data quality issues | Data Reliability | Meet the Author
Sophia Yang
Reliable Machine Learning author interview | DS/ML book club
Sophia Yang
Toronto VLOG | First vlog | Meet my favorite author | Toronto ML Summit conference
Sophia Yang
TOP 6 tech news in 2022 #shorts
Sophia Yang
How to deploy a Panel app to Hugging Face using Docker?
Sophia Yang
Tech news this week | ChatGPT, Hacks, Snowflake, CES #shorts
Sophia Yang
🗞️ Tech news this week: ChatGPT, DreamerV3, Muse, VALL-E, Mineral, DoNotPay, Tesla, SBF... #shorts
Sophia Yang
Tech news this week | Boston Dynamics, Microsoft, Snowflake, Google, and more #shorts
Sophia Yang
The story of Metaflow | Effective Data Science Infrastructure | Book author interview
Sophia Yang
Tech news this week #shorts
Sophia Yang
A day in life of a data scientist | Data Day Texas | Interview 12 authors/speakers
Sophia Yang
Tech news this week #shorts
Sophia Yang
Explainable AI with Shapley Values (Part 1: Game Theory)
Sophia Yang
Explainable AI with Shapley Values (Part 2: Estimate Shapley Values)
Sophia Yang
Explainable AI with Shapley Values (Part 3: KernelSHAP)
Sophia Yang
Tech news this week | AI search war between Microsoft and Google #shorts
Sophia Yang
The Story of ChatGPT's creator OpenAI | From Riches to Fame
Sophia Yang
Explainable AI for Practitioners | Must-read for XAI | author interview
Sophia Yang
Train your own language model with nanoGPT | Let’s build a songwriter
Sophia Yang
The easiest way to work with large language models | Learn LangChain in 10min
Sophia Yang
The BEST browser? AI article summary, image generation, website insights. Microsoft Edge Copilot!
Sophia Yang
startup scene in data | insights from 50+ data startups from Data Council
Sophia Yang
NLP with Transformers author interview with Lewis Tunstall from Hugging Face
Sophia Yang
4 ways to do question answering in LangChain | chat with long PDF docs | BEST method
Sophia Yang
5 Steps to Build a Question Answering PDF Chatbot: LangChain + OpenAI + Panel + HuggingFace.
Sophia Yang
4 Autonomous AI Agents: “Westworld” simulation, Camel, BabyAGI, AutoGPT, Camel ⭐ LangChain ⭐
Sophia Yang
MiniGPT4: image understanding & open-source!
Sophia Yang
BEST Practices in Prompt Engineering: Learnings and Thoughts from Andrew Ng's New Course
Sophia Yang
Designing Machine Learning Systems author interview with Chip Huyen
Sophia Yang
Tech news this week: code interpreter, Mojo, Redpajama, MPT7b, StarCoder #shorts
Sophia Yang
🤗 Hugging Face Transformers Agent | LangChain comparisons
Sophia Yang
📢 Tech news this week #shorts
Sophia Yang
📢 Tech news this week #shorts
Sophia Yang
The BEST ChatGPT Plugins | Brand NEW Bing Search | Web browsing, CODING, summarizing, and more
Sophia Yang
Tech news this week #shorts #short
Sophia Yang
📢 Tech news this week #shorts
Sophia Yang
Deep Learning with PyTorch Author Interview with Eli Stevens, Luca Antiga, and Thomas Viehmann
Sophia Yang
More on: AI Workflow Automation
View skill →
🎓
Tutor Explanation
DeepCamp AI