Google App Engine Hosting
You will get insight in how simaec.net builds, hosts and maintains websites hosted in Google Cloud using Google App Engine, Flask and optionally Cloud SQL in case of content being stored in database.
A Warning: There are simplier approaches to host a static website than the one described here. The approach we use is trimmed down version of the more complex Google Cloud application which connects to a database.
The core of the website is a collection of functions written in Python depending on Google App Engine, Flask, Talisman and dealing mostly with responding to different website requests with the appropriate response.
There are essentially three files, app.yaml, requirements.txt and main.py:
- app.yaml provides instructions how to initiate the google app engine instance
- requirements.txt provides the different third party libraries required to run the app
- main.py is the main script of the app itself defining how to respond to website requests
Additionally to these three files we have:
- Folder named root with static files which will be served from the root directory. E.g. robots.txt, favicon.ico
- Folder named html which contains the templates for the different website pages. In case of a static site, a template corresponds to every website page and includes the content of the page.
These files are stored on a local drive and can be maintained as a git repository allowing editing by a team of developers and webmasters.
With a simple command at the terminal prompt, the application can be deployed to the Google cloud serving the website.
You always can push changes directly to the public website but you may prefer to review the modified website before it replaces the production site.
The simplicity of pushing a new application to the production environment without replacing the version of the production is where Google Cloud service shines.
You deploy the new version as a new application version which you can view publicly and you can perform all the tests necessary
After the reviw you then promote the new version as production version. If needed you always can roll back. You can also phase in a new version by directing only a percentage of the traffic to the new version.
What is Google App Engine?
Google App Engine is a cloud computing platform for hosting web applications in Google-managed data centers.
What is Flask?
Flask is a micro web framework written in Python. It doesn't include common web pubishing components such as database connectors, web forms but it allows extending with third-party or custom-developped libraries.
Alpha, beta and production versions of a web application.
- Github Repository
- Explanatory Video (coming soon)
Do you plan to host your own website in Google Cloud? Feel free to contact me for assistance: karlheinz[at]gmail.com. We can setup a hangout to discuss your project.