My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Host a Hugo blog on Google AppEngine for free

Michal Mazurek's photo
Michal Mazurek
·Apr 22, 2020

Hugo is a static site generator for blogs. You write your articles in Markdown and export them to html. This post assumes you're already familiar with Hugo.

Why AppEngine?

AppEngine is a serverless platform from Google. It allows you to run your applications as docker containers in their cloud. They handle scaling automatically and provide a plethora of helpful tools, like a nosql database or a very convenient DNS server. Running one instance, even with your own domain name, is free forever.

Some people advise that you use a static file hosting service like Amazon S3 or Google Cloud Storage for your Hugo blog. It's simpler, but unfortunately you can’t do redirects that way - something a serious blog must have. And if you want to start a blog for business you have to be serious. AppEngine gives you the control you need and it's free.

Okay, let's set it up

Here are the steps:

  • Create a new AppEngine project.
  • Fork this skeleton repository.
  • Edit the Makefile and set PROJECT to the project's name.
  • Put your hugo sources into hugo/.
  • Type make hugo when working on your blog.
  • Type make deploy to publish it.

Your new blog will have a /blog/ prefix in the URL. That's in case you change your mind and want to host something more under that domain in the future.

The app.yaml file limits autoscaling to at most one instance, making sure the hosting stays free:

service: default
runtime: go113

automatic_scaling:
  max_instances: 1

  handlers:
  - url: /.*
    script: auto
    secure: always

If your blog grows popular later just remove the max_instances line and Google will do automatic scaling for you.

And that's it!