My Blog Stack

My Blog Stack

Dec 9, 2020
Cloud Architecture
App Engine, Blog, GCP, Hugo, CICD, Static Site

This blog is written in Hugo and deployed to Google App Engine as a static site. “Whoa whoa whoa” you might say, a static site? Sure. App Engine handlers are basically nginx listeners and you can specify static content, default index.html, etc, so why not? You don’t have to define a script endpoint at all even and I’d argue it’s actually easier to get a static site up and running here than it is to use a bucket with an endpoint and a load balancer. Plus, I get all the other stuff that comes with App Engine when and if I need it, without having to move anything.

So, the blog lives in a Google Source Repository and commits trigger a Code Build operation that downloads Hugo, git pulls the latest version of the blog, builds the blog, then gcloud’s it to App Engine. Here’s the cloudbuild.yaml config for those that might be interested in doing something similar.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
steps:
- name: 'gcr.io/cloud-builders/wget'
  args:
  - '--quiet'
  - '-O'
  - 'hugo.tar.gz'
  - 'https://github.com/gohugoio/hugo/releases/download/v0.75.1/hugo_extended_0.75.1_Linux-64bit.tar.gz'

- name: 'ubuntu:18.04'
  args:
  - 'bash'
  - '-c'
  - |
    mv hugo.tar.gz /tmp
    tar -C /tmp -xzf /tmp/hugo.tar.gz
    cd site
    /tmp/hugo --minify
    cd ..
    mv site/public www

- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy']
  timeout: 1600s