The Autodidacts

Exploring the universe from the inside out

A few more things I've learned about self-hosting Ghost on Fly’s free tier

Following on from my previous two posts on the topic, here are some additional things I’ve learned running this blog for free on Fly:

HN traffic spike HTTP response count graphHN traffic spike disk usage
HTTP response count & volume usage on the day of the spike.
  1. You can survive a HackerNews traffic spike, without scaling. However, your access logs will pile up. One of my posts made it to #3 on HN while I was sleeping, without any downtime. (In fact, average response times went down.) However, if you stayed at #1 for long you might run out of disk space.

  2. Fly forgives monthly bills under $5. This means you can scale to 512MB RAM on both Ghost and MySQL instances, without having to actually pay anything. To be nice, you should probably stay at 256MB. But it's good to know you can scale up during traffic spikes (or when expecting traffic spikes) without being billed for it.

  3. Importing a large JSON file takes lots of RAM. However, you can just scale up for a few minutes and the bill will be forgiven. I scaled up to 1GB RAM when I migrated from an out-of-date version of Ghost on Heroku to Ghost 5 on Fly, importing ~8 years of content. (Other things that seem to use a lot of RAM: saving posts too frequently, and creating bookmark cards.)

  4. The script kiddies will come for you. So far, the amount of traffic looking for security vulnerabilities (which fortunately don't exist) has been low. But it is there. If it increases, I will have to put this blog back on Cloudflare, or configure Fail2Ban.

  5. Be careful when fiddling with firewall rules. When tinkering with iptables, ufw, and fail2ban trying to block an attacking IP address, I made the mistake of running ufw enable … which instantly froze my SSH session, took down my app, locked me out of my fly volume, and prevented me from redeploying. After frantically scrabbling to spin up a new application instance and restore from my most recent backup, my Fly app recovered. Lesson learned.

  6. Managed Ghost hosting is expensive for a reason. If I was billing for the time it takes to run this blog for free, it would be way more expensive than Ghost(Pro) (referral link) or any of the other managed hosting providers. Then again, I don't really know what I'm doing, which might have something to do with it...

  7. Eventually, your backup will be all you have. In addition to the incident with ufw enable, one time back in 2014 I deleted my entire production database on Heroku, losing many posts permanently. Backups are important! I regularly export my blog's content as JSON, and use Fly's SFTP shell to backup my content. (Tutorial coming soon. The TL;DR version: flyctl ssh sftp shell -a APPNAME, then get /var/lib/ghost/content/ GHOST-CONTENT-BACKUP-YYYY-MM-DD.)

  8. The Fly staff are very friendly and helpful even though I haven't paid them a cent. They’ve promptly answered every question I’ve posted to the forum, and even tweeted my blog post … which was specifically about how to run a blog on their infrastructure without paying them money. Just sayin’.