Google App Engine With Hugo

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.

  • create directory for the app, with www simlinked to public of hugo.
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