DevOps Blog - Nicolas Paris

Google App Engine With Hugo

GCP

Last time, i setup a docker image for this website, served with a reverse proxy Traefik. It's nice, it works on a low price OVH server.

This time, i want to test Google App Engine with the static website. The setup is done, it works fine.

Here some explanations.

mkdir gcloud
cd gcloud
touch app.yaml
ln -s /home/nicolas/.../hugo-blog/public www

Here is my app.yaml working.

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /robots.txt
static_files: www/robots.txt
upload: www/robots.txt
secure: always

# file with extensions (longer cache period)
- url: /(.*\.(css|js|woff|woff2|ico|png|jpg))
static_files: www/\1
upload: www/(.*)
expiration: "14d"
secure: always

# file with extensions
- url: /(.*\..*)
static_files: www/\1
upload: www/(.*)
secure: always

# assume file without extensions use index.html
- url: /(.*)/
static_files: www/\1/index.html
upload: www/(.*)/index.html
secure: always

- url: /
static_files: www/index.html
upload: www/index.html
secure: always

Deploy it.

gcloud app deploy

Here is an update, I've been trying for a month, it work fine for me, it cost me nothing as I almost dont have visit on the website.
I having a good response time and a easy workflow to keep up.

Update 2021 : I'm not using this method anymore, I'm using Firebase hosting. I dont remember the exact reason why, meaby it's faster to send to production. The approch of using a python runtime could also look weird for static html content, and the rewriting part not so lovely.