Upgrading Ghost Versions

Upgrading Ghost Versions

While I've written a number of posts since I initially moved to Ghost, I haven't actually updated the software that is running on my blog. While I'm impressed by any software that can run continuously for 2 years, it was beyond time to update (for both security and features).  I had Ghost 0.9.0 installed. The current version is 2.25.3. As you might imagine, there was quite a bit of change over that period of time, including several backwards incompatible changes. Additionally, I was running ghost in a docker container behind an nginx proxy, so that made it a bit more difficult to upgrade.

In order to upgrade to version 2, you must first be on version 1. To get on version 1, you must be on a Long-Term support version of 0.x. So here's what I did-

  1. Backup /var/lib/ghost
  2. Update to the latest 0.11
    1. Export the blog contents from the labs section of the admin panel
    2. sudo docker stop ghost where ghost is the name of your ghost container.
    3. sudo docker run -d --name ghost-0-11 -p 2368:2368 ghost:0.11-alpine
      1. This assumes that 2368 is the port that nginx is set up to direct ghost traffic to.
    4. Navigate to the site
    5. Set up an account
    6. Import the exported JSON file.
    7. Export it again (with a new name)
    8. sudo docker stop ghost-0-11
  3. Update to 1.x
    1. sudo docker run -d --name ghost-1 -p 2368:2368 ghost:1-alpine
    2. Navigate to the site
    3. Import the exported JSON file from 0.11
      1. I got warnings about the author account not existing and posts not having an author, neither of which are a problem since I'm the only one writing posts.
    4. Export it again (with a new name)
    5. sudo docker stop ghost-1
  4. Update to 2.x [1]
    1. sudo docker run -d --name ghost-2 -p 2368:2368 -v /var/lib/ghost2/content:/var/lib/ghost/content ghost:latest
      1. Here, we mount a new data directory because it has a different structure than our old one.
    2. Navigate to the site
    3. Import the exported JSON file from 1.x
      1. I got some more warnings here just like above, but none of them mattered.
    4. Copy the images directory from /var/lib/ghost/images to /var/lib/ghost2/content/images

You'll then probably want to delete the Ghost user, under which lots of default posts were added. I deleted them one by one, but I've since learned that you can just delete the user.

  1. I actually created my 2.x setup on a different virtual machine with traefik instead of nginx as my reverse proxy, but it doesn't really matter. ↩︎

So far, I'm liking the new features. Dark Mode is great and the new settings are nice, too. I'm not sure about the new editor yet. The image features are much better, but there are some missing text features.

Fortunately, you can fall back to the old editing experience for the most part (as I did above), so it seems to be mostly a net positive.