Every time I update Ghost, there is always some problems taking down the site. A lot of the times it's just because things like I forgot to update nodejs before updating Ghost CLI. Here I'm writing the steps down so next time I can follow them exactly, and hopefully they will be useful for other folks.

Just a little background, the instance is running on Ubuntu 18.04 LTS at DigitalOcean.

The first step is to make sure npm and nodejs is updated to the latest version supported by Ghost. Go to https://ghost.org/faq/node-versions/ to find the recommneded nodejs version.

# update npm to the latest
npm install -g [email protected]

# update nodejs to recommended version, e.g., v12
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

Once you have npm and nodejs updated, run sudo npm install -g [email protected] to update to the latest Ghost CLI.

Next, go to the directory where the instance is running, then switch to the user who owns the directory.

Be sure to check the Upgrading Ghost page to find out if additional instruction is needed, especially when there's a major version upgrade.

Always back up the content directory! A simple cp -r content ~/backup-dir would do the trick.

Finally, it's time to run ghost update to actually update Ghost.

Well, I lied. ghost update sometimes may not be the final step. In case of failures, try running ghost update --force to do the update for the 2nd time, which might just work the 2nd time. If the update is successful, but the blog still isn't up and running, reboot.

If the update still fails, ghost doctor might give you some information. If you lose the patience by now, ghost update --rollback could be handy to revert back to the previous stable version of Ghost.

Lastly, if still nothing works, and you still want to proceed with the update and you don't want to spend too much time dealing with it anymore, just reinstall Ghost and restore from the backup.

You can hate WordPress however you want it, but it's never a pain to upgrade(if the environment is set up correctly).