It's been a good run with Heroku, but it got a bit too hard to keep everything updated, and I get impatient waiting for free apps to spin-up as well. Perhaps I'll find other uses for Heroku.
Google provides a permanently free VM (alongside several other services, see them here). This is the smallest instance type (f1-micro) that's available on Google Cloud Platform. We get:
- 614 MB of RAM
- 30 GB persistent storage
- 1 GB egress
For a small personal website, this is more than sufficient.
Create VM Instance
This should be pretty straight forward. From GCP console, navigate to Compute Engine and click on "Create and instance". Make sure to select f1-micro
and use a disk size of 30GB for things to be free. You should see that this costs approximately $5 a month, but also an additional note saying that the first 744 hours of this instance is free. Follow the on screen instructions and after a few minutes, your instance should be ready!
A static public IP should be assigned as well, and you should set up DNS setting accordingly with your registrar.
Installing Ghost
I chose Ubuntu as my starting image and configuration for most things is a breeze. Detailed instructions on installing Ghost can be found on Ghost's Documentation page, but as always, there's a paste-able block to save time.
With all the software components required, its now time to actually install Ghost. MySQL, in some cases, might require you to have a password, this can be set with:
Finally, we will install ghost in /var/www
as that's the convention.
The install script will ask you several questions. It's pretty straightforward and allowing the script to set up Nginx, MySQL user and database, systemd for automatic startup, etc. Site name and other details isn't important if you are importing from another site.
Updating Ghost
New version is release? Updating is way easier now as we don't need to dance around Heroku's peculiarities.
Migrating Content
Fortunately, migrating content with Ghost is incredibly painless. Every single configuration and post can be exported as a giant, glorious json file. Just head over to the admin page /ghost/
and click on "Labs". There you should see an option to export your content.
This json
file can then be easily imported. Just head to the same "Labs" page on the newly running Ghost website hosted on the free-tier VM.
Performance of the VM
I'm serving quite a few things on the VM, mostly random stuff that I'm experimenting with. For the most part, things run reasonably well. However, occasionally the SQL server seems to quit as memory is very limited. I found it helpful to enable swap. This can be done so easily with dphys-swapfile
Finally, Cloudflare's free website plan could also be used to improve overall site performance and some bandwidth. Simply create a free account, add a free website and everything else should be pretty straightforward.