Deploy a Python app on Google App Engine and integrate it with GitHub


I tried deploying the same Python app on Heroku, AWS Beanstalk, and Azure, and wondered if I could do the same on Google Cloud Platform. However, it was overwhelmingly complicated compared to other services. I had a lot of trouble with linking with GitHub, but in the end I found that it was very easy to do, so I will describe the details here.


--There is a Python application that has been confirmed to work locally or on other PaaS, IaaS, etc. --The above app is on the GitHub repository --You have a Google Cloud Platform account

Deploy manually

At first, I decided to deploy it manually from local without linking with GitHub. <a href=> As per the official tutorial , install the Google Cloud SDK and gcloud app deploy from the command line Deploy with. At first, it didn't work because there was no app.yaml, or even after adding app.yaml, the application name of entrypoint was main instead of app, and an error occurred, but that can be resolved quickly. It was. (It took me a while to find the error log.)

GitHub cooperation-addicted

Next, I will try to link with GitHub, but if you first google on the net, there will be a way to link with GitHub using Google Cloud Run and Google Cloud Build. This didn't work. For the time being, if I create a Cloud Run service and create a Cloud Build trigger that works with GitHub, the trigger works properly every time I push, and it deploys normally, but even if I open the web page on App Engine Not reflected at all ,? ?? ?? Will be. I wasn't sure what Cloud Run was, so I didn't realize it was running separately from App Engine. When I was looking at the service details page of Cloud Run, I noticed that there was a link called URL, and when I clicked on it, a page that reflected the contents of the latest GitHub repository was displayed. Oh, I finally understand that.

See the official documentation

In conclusion, it was all written in the official documentation. I didn't need Cloud Run from the beginning.

All you need

  1. Allow integration with GAE in Cloud Build settings,

  2. Add cloudbuild.yaml, which describes the configuration information for deploying with Cloud Build, to the project.

  3. Create a build trigger and specify the cloudbuid.yaml created above in [Build Configuration]-[Cloud Build Configuration File].

Now every time you push to the GitHub repository, it will be automatically deployed to App Engine. Why didn't you reach this page from the beginning?

Remaining questions

If you want to run the source on GitHub, you only need Cloud Run and Cloud Build, right? The question arises. What is App Engine for? If you use it with the same image as other Paas, is it App Engine and Cloud Build? I don't know how to use it properly.

Recommended Posts

Deploy a Python app on Google App Engine and integrate it with GitHub
Deploy a Django application on Google App Engine (Python3)
Deploy your Go app on Google App Engine with GitHub Actions
PIL with Python on Windows 8 (for Google App Engine)
[Python] Run Flask on Google App Engine
A memo with Python2.7 and Python3 on CentOS
I can't deploy with google app engine
Building a development environment with Maven on Google App Engine [Java]
Tweet (API 1.1) on Google App Engine for Python
Install selenium on Mac and try it with python
Getting Started with Google App Engine for Python & PHP
How to use Django on Google App Engine / Python
Deploy a Django app made with PTVS on Azure
Quickly create a Python data analysis dashboard with Streamlit and deploy it to AWS
Until you create a machine learning environment with Python on Windows 7 and run it
Associate Python Enum with a function and make it Callable
(Failure) Deploy a web app made with Flask on heroku
Create a deploy script with fabric and cuisine and reuse it
Get the matched string with a regular expression and reuse it when replacing on Python3
Google App Engine development with Docker
Integrate Modelica and Python on Windows
When I deploy a Django app with Apache2 and it no longer reads static files
Do you have any recommendations for a commentary book on Google App Engine / Python development?
Use ndb.tasklet on Google App Engine
Create AtCoder Contest appointments on Google Calendar with Python and GAS
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Build a Python environment on your Mac with Anaconda and PyCharm
Get data from MySQL on a VPS with Python 3 and SQLAlchemy
Make a scraping app with Python + Django + AWS and change jobs
Install lp_solve on Mac OS X and call it with python.
Using properties files with Flexible Environment Java 8 on Google App Engine
Map rent information on a map with python
Daemonize a Python web app with Supervisor
Use external modules on Google App Engine
Use Django's ImageField on App Engine / Python
Make a desktop app with Python with Electron
2. Make a decision tree from 0 with Python and understand it (2. Python program basics)
Deploy Python face recognition model on Heroku and use it from Flutter ②
Until you deploy a SpringBoot project in Gradle on App Engine Flexible
Build your Django app on Docker and deploy it to AWS Fargate
Deploy Python face recognition model on Heroku and use it from Flutter ①
Scrap the published csv with Github Action and publish it on Github Pages
Create and edit spreadsheets in any folder on Google Drive with python
[Detailed version] Creating a comfortable Python environment with Google Compute Engine (Ubuntu 16.04)
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
Make a decision tree from 0 with Python and understand it (4. Data structure)
Create a decision tree from 0 with Python and understand it (5. Information Entropy)
[AWS lambda] Deploy including various libraries with lambda (generate a zip with a password and upload it to s3) @ Python
Make a thermometer with Raspberry Pi and make it visible on the browser Part 3
[Python] I introduced Word2Vec and played with it.
Try running Google Chrome with Python and Selenium
Build a python environment with ansible on centos6
Vienna with Python + Flask web app on Jenkins
Divide each PowerPoint slide into a JPG file and output it with python
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Trial and error]
Install OpenCV 4.0 and Python 3.7 on Windows 10 with Anaconda
Integrate with Python
Folium: Visualize data on a map with Python
Build a flask app made with tensorflow and dlib to work on centos7
Launch a web server with Python and Flask
I generated a lot of images like Google Calendar favicon with Python and incorporated it into Vue's project