Creating this ghost 5.0 blog and hosting it for free

I'll keep this up to date as much as possible. dm me on twitter @ https://twitter.com/winnieletsgo if you have issues and I'll update

I always wanna be using the latest and greatest but for the price that makes sense.

This price is a no brainer: free.fifty

Skip to step by step tutorial

I followed a couple guides (guide 1, guide 2) that promised easy ghost set ups on fly.io. Guide 1 didn't actually work for me because I realized that the script was for linux. (cue sudo apt get light bulb moment) And I use a mac. Thankfully, the author linked guide 2 in their post.

There was one main issue that there is a typo in the guide saying to set the internal service port to 2386 but it's actually 2368 . I was able to get a ghost 4.36.3 site up and running on fly.io very easily. I was happy that I finally got it up and running but then I checked the latest major version of Ghost is 5.0.

I thought maybe I can just redeploy and update the docker image in the fly.toml to ghost.

Nope, no dice.

I toiled for a bit and kept getting the same error described this post on the ghost forums. The team that is managing the ghost docker image has migrated from the default database as SQLite to MySQL (breaking change), which is because the maintainers believe that SQLite will break for Ghost 6.0. (official ghost staff answer here)

Going down the grapevine, I finally found my answer: here.

Set these environment variables on fly.io and voilà.

database__client: sqlite3
database__connection__filename: /var/lib/ghost/content/data/ghost.db

Step by step

Let's get started and set up our own https://ghost.org site (the latest and greatest 5+ version) and deploy it on https://fly.io absolutely free.

  1. follow flyctl install commands for your operating system https://fly.io/docs/hands-on/install-flyctl/
  2. signup for fly.io https://fly.io/docs/hands-on/sign-up/
  3. run flyctl auth login
  4. create a folder and name it whatever you want e.g.
mkdir my-blog
cd my-blog

5.  run flyctl launch --image=ghost --no-deploy - follow the cli prompts and name your app. we want to use the --no-deploy flag  because we need to edit the fly.toml that is created from this command before deploying

6. run flyctl volumes create data --size 3 - this sets up a free fly.io database to use for your ghost site. (you will probably have to add a credit card but 3GB databases are free on fly.io)

7. copy my fly.toml and add your application name. I've already added set the environment variables, changed the internal_port, and mounted the volume we created earlier

# fly.toml file generated

app = "<ADD YOUR APP NAME HERE>"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  image = "ghost"

[env]
  url = "https://<ADD YOUR APP NAME HERE>.fly.dev"
  database__client = "sqlite3"
  database__connection__filename =  "/var/lib/ghost/content/data/ghost.db"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 2368
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"
[mounts]
  source="data"
  destination="/var/lib/ghost/content"

8. run flyctl deploy and voilà

9. bonus: you can follow this guide to register a cheap domain on cloudflare and update the DNS so your domain points to your site!  (don't forget to update the URL in your fly.toml to your website domain after all the DNS works) https://winstonzhao.com/cloudflare-dns-fly-io-issues/

Congratulations

You are now deployed on fly.io for absolutely free: $0/month and are using the latest and greatest Ghost platform.

When I upgrade to Ghost 6.0, I'll update this guide as well!  

Subscribe to winnie's homebase

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe