Skip to content

Automated deployment of a web app using Google Cloud Run and Google Cloud Build, with seamless GitHub integration and HTTPS support.

Notifications You must be signed in to change notification settings

Oxford-Research-Cloud-Competency-Centre/Hello-gcloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

© The Chancellor, Masters and Scholars of The University of Oxford. All rights reserved.

Explore different providers

This course is available for multiple cloud providers. Choose your preferred platform:

Note: Entries marked with "Coming Soon" are planned versions that are currently under development.

Instructions

Step 1. Fork (or make a copy of) this repository

Step 2


Step 2. Go to the Google Cloud Console and type "Cloud Run" in the search bar

Step 2


Step 3. Go to Deploy Container -> Service

Step 3


Step 4. Select "Continuously deploy from a repository (source or function)" then "Set up with Cloud Build"

Step 4


Step 5. Select the git repository

Step 5


Step 6. Select the "Google Cloud's buildpacks" option. Leave all the parameters empty: Cloud Run will figure out on its own that you are using Python.

Step 6


Step 7. Select the region (europe-west2 in this case), allow unauthenticated invocations, allow internet traffic, then press Create

Step 7


Voilà! Access the URL.

Voilà

Going further

Modifying the code

You can commit some changes to your repository and watch how the service is updated automatically.

Cleaning up

Don't forget to delete the service when you are done.

Deleting a service

Adding an API endpoint

Add the following code in app.py

@app.route("/hello_api")
def hello_api():
    return {
		"name": "Wrinkle Five Star",
		"species": "Duck",
		"breed": "American Pekin",
		"hatching_date": "2020-09-09",
		"sex": "Male"
    }

Then test your endpoint

API endpoint

User interface

Missing content

Database writing/reading

Go to the Google Cloud Console and type "SQL" in the search bar Missing content

Storage bucket writing/reading

Go to the Google Cloud Console and type "buckets" in the search bar Missing content

Local testing

After a while, it's not fun anymore to wait for deployment. You want to test your changes before.

Step 1. Install git and clone the repository on your local machine
	git clone {repository_link}

Step 2. Install Python
https://www.python.org/downloads/

Step 3. Install dependencies
	 py -m pip install flask

Step 4. Run flask
	 py -m flask run

Open localhost:5000 in your browser.


Local testing

Running a job on a separate machine

This web server is not powerful enough to handle sophisticated tasks. What if GPUs are needed for a heavy workflow? Then you need the ability to create machines dynamically and control them remotely (Infrastructure as Code).

Install dependencies Missing content

About

Automated deployment of a web app using Google Cloud Run and Google Cloud Build, with seamless GitHub integration and HTTPS support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published