Getting a Ghost Blog running on Glitch

Ghost is an open-source CMS. I recently got a blog up and running on Glitch using @jenn’s example project and documentation in this thread.

After I got it spun up, I wanted to update Ghost from 3 to 3.4. As I did, I figured I’d document some of the steps I went through for both updating Ghost and also a few other nice tips I stumbled into.

You can see the project here - just remix to get started:

Steps to update Ghost

Ghost on Glitch is installed with a bit of a workaround due to disk size. As a result, you can’t simply run the ghost update command within the Glitch terminal. So here’s a workaround that is working for current builds. This example is done updating 3.0.0 to 3.40.2.

  1. Install Ghost locally (using the same version you’re running on Glitch). First install the ghost-cli with npm install ghost-cli and then install your version (in my case, 3.0.0) with ghost install 3.0.0 --local.
  2. Download your project’s .data/ghost-local.dbfrom your glitch project. It may be easiest to simply download your whole project and fish it out of the .data hidden folder. I opened up my terminal to the app’s folder and used mv .data/ghost-local.db ghost-local.db to bring it to the project root folder.
  3. Move ghost-local.db to your local install’s data folder. By default, that’s LOCAL_GHOST_INSTALL/content/data. Overwrite the existing sqlite3 db file.
  4. Run ghost update to bring your local version up to the latest Ghost version.
  5. Update your Glitch’s package.json with the relevant package version numbers (that’s ghost, ghost-cli, and knex-migrator).
  6. Upload your local .db file (now correctly updated to 3.40.2) to the Glitch project’s assets folder
  7. Move it to your .data folder using wget -O .data/ghost-local.db YOUR_URL.
  8. Wait for everything to update!

Log into your admin page

You probably know this already, but by default your admin page is available at PROJECT_DOMAIN.glitch.com/ghost.

Turn off logs

Ghost’s log files take a huge amount of bandwidth. We’ve turned them off but you can turn them back on within your config file.

Get custom domains working

  1. Set your domain in config-development.json.base (it’s the one with the line “SET ME!”)
  2. Duplicate the file and rename it config.development.json
  3. Enable Glitch’s custom domains feature by going to the tools drawer and clicking “custom domain”
  4. Update your .env file and set NODE_ENV=production.
  5. If it’s working correctly, logging into your admin panel (PROJECT_DOMAIN.glitch.com/ghost) and clicking “Design” should show your current domain.
  6. Still not working? Try opening up terminal and typing refresh and/or enable-pnpm. Sometimes that helps. It’s the Glitch equivalent of turning it off and turning it on again.

Trouble with packages?

I haven’t run into this yet but if you have problems with Sharp or other packages (especially if your project goes to sleep and takes forever to wake up), you might try looking at this thread.

11 Likes