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.
There are simplier approaches to host a static website than the one described here. The approach we use is a trimmed down version of the more complex Google Cloud application connected to a Cloud SQL database. We discontinued using this approach and host now static websites using Firebase Hosting.
The core of the website is a collection of functions written in Python hosted in a Google App Engine instances using Flask extended with Talisman.
- 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
- pages.py is a dictionary of pages published in a website and used to bind a request with the corresponding template, an html file.
Additionally to these files we have:
- Folder named root with files served from the root directory. E.g. robots.txt, favicon.ico
- Folder named html with the templates and content for different pages.
These files are stored and maintained on a local drive and can be administrated as 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 changes before replacing the production site.
The simplicity of pushing a new application to the production environment without replacing the active version in production is where Google Cloud service shines.
You deploy the new version as a new application version. This verrion can be viewed publicly and you can perform all the tests necessary.
After the review you then promote the new version to production. If needed you 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 components such as database connectors, web forms but it can be easily extended 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.