This is how I stood up a blog platform for free using the open source Ghost software running on a free-tier Google Cloud Platform (GCP) compute instance

Background

For some time now I've been wanting to move my blog off the Blogger platform and something else for these reasons:-

  • in terms of usability (mainly from my perspective writing the posts), Blogger is a bit dated. I struggle to put in code blocks, image uploading can be clunky amongst other things
  • I wanted to improve the style and readability of the articles and I wasn't comfortable spending the time to tweak/hack the templating engine Blogger has

I've reasearched (i.e.have a quick Google) a few different blogging platforms, always looking for something that looked nice, easy to use, and low cost. Ghost seamed to be a popular one among the other blogs I read on the net.

As my blog isn't a particularlly heavily viewed one, I wasn't prepared (yet) to put money behind Ghosts hosted solution it's simply not worth it right now, but in the future who knows! 🤔 The idea that I blog so much and/or blog articles so interesting to others that I'd get thousands of visits sounds a bit silly to me right now. As such, I looked for solutions of hosting Ghost myself for free or not much money

Solution

I use Google Cloud Platform for 2 other projects I manage and the free tier offers a lot of products including an always free linux compute instance. As I hadn't used this freebie so far, it gave me an opportunity to do just that, and have a play around with setting up a Linux box running Ghost

This is how I went about it:-

  1. Create a free Google Compute Instance (this has to be a f1-micro instance in any US region apart from Northern Virginia (aka us-east4) running Ubuntu 16.04 LTS

    google-compute-create-instance

  2. As the server is hosting a website, an IP adddress which won't change is a good idea. Under VPC Network -> External IP addresses, I changed the Type from Epermeral to Static
    google-compute-static-ip

  3. Once it's provisioned, SSH into the box using the browser connection

  4. As the compute instance has only 0.6GB of ram (less than the recommended 1GB), I created some swap space as per https://docs.ghost.org/docs/hosting#section-adding-swap-memory

    sudo -s
    dd if=/dev/zero of=/var/swap bs=1k count=1024k
    mkswap /var/swap
    swapon /var/swap
    echo '/var/swap swap swap defaults 0 0' >> /etc/fstab
    exit
    
  5. Next I copied/pasted the all the commands detailed in https://docs.ghost.org/docs/install which included letting the setup process get a free SSL certificate from LetsEncrypt

  6. As my domain name wasn't yet pointing to the GCP insance IP, to test it out I added an entry in my local hosts file to point to the IP. Once that was done, I could browse to https://www.tras2.co.uk.

I spent a bit of time looking through the settings and stated to form this blog post. I liked what I saw and how it worked, so made the decision to use it and updated my DNS for this domain. My next steps are to migrate the few posts I have on my Blogger blog over to here

Conclusion

There is a downside to free, and in this case it's that this blog will require more of my time to maintain (e.g. security updates for the Ubuntu server & software stack) than Blogger did. But right now I'm ok with that negative considering how many page reads I get. I'm hoping that the increased usability I'm getting from writing this post alone will encourage me to write and share more about the tech I play with and my other extra curricular activities.

Only time will tell how well this works so I'll aim to revisit this in a few months and give an update