Still unable to update self-hosted Ghost blog

I am getting to the point of considering getting back to Wordpress. I mean, I have an IT background and have been managing Linux servers for years in the past, so I know a thing or two about *Nix systems, but Ghost is making me wonder why I chose this platform.

So perhaps some kind soul can help me:

  • I am running Ghost 5.75 on Debian 11.
  • Initially I have node 16.X
  • If I try to update Ghost to 5.80, it won’t let me because it requires Node 18.X.
  • So I install Node 18 via nvm
  • Then I run ghost update and it fails because the version of Node should be 16???
  • I tried running npm -g to install the latest update of the Ghost cli without results.
  • The ending result, if I do a --force, is that the version 5.75 is erased (???) from the versions directory and of course the new version fails to install so the versions/ folder end up empty (congrats! :)
  • Then I said: ok, let’s try to install ghost in a new directory from scratch and then I migrate the JSON config files and content files. No luck, as apparently something has changed and it asks me for the MYSQL database name, meaning it runs on MySQL now and previously I was running it on SQLite .db file (computer (config) says yes):
"database": {
    "client": "sqlite3",
    "connection": {
      "filename": "/var/www/html/micropreneur_new/content/data/ghost-local.db"
    }
  },

SO it got to a point where I had to restore my Linode backup from a couple of days ago.

Without entering in WHY is making Ghost so difficult to upgrade and have all these issues (I mean, imagine if a non-IT savvy guy tries to upgrade this, freak out!), can any kind soul please help me figure out how the heck can I upgrade my Ghost blog?

I see two things happening here:

  • What’s with this Node versions loop that won’t allow you to upgrade from either node 16 or node 18?
  • Should I migrate my database to MySQL before? How can I do that?

Message when I am in 5.75.1 with Node 16 and try to force an update: (same with 5.80, 5.82)

✔ Checking system Node.js version - found v16.18.1
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✔ Checking for latest Ghost version

# 5.75.1

* 🐛 Fixed deleting members with email disabled (#19222) - Simon Backx

---

View the changelog for full details: https://github.com/tryghost/ghost/compare/v5.75.0...v5.75.1

💻 We're looking for DevOps engineers to join Ghost: https://careers.ghost.org/devops-engineer

✔ Fetched release notes
✖ Downloading and updating Ghost to v5.75.1
A SystemError occurred.

Message: Ghost v5.75.1 is not compatible with the current Node version. Your node version is 16.18.1, but Ghost v5.75.1 requires ^18.12.1

Ok, so I install Node 18 and then…:

Running in development mode

You are running an outdated version of Ghost-CLI.
It is recommended that you upgrade before continuing.
Run `npm install -g ghost-cli@latest` to upgrade.


✖ Checking system Node.js version - found v18.20.2
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
One or more errors occurred.

1) Checking system Node.js version

Message: The version of Node.js you are using is not supported.
Supported: ^12.22.1 || ^14.17.0 || ^16.13.0
Installed: 18.20.2
See https://ghost.org/docs/faq/node-versions/ for more information

Debug Information:
    OS: Debian GNU/Linux, v11
    Node Version: v18.20.2
    Ghost Version: 5.80.2
    Ghost-CLI Version: 1.23.1
    Environment: development
    Command: 'ghost update 5.75.1 --force'

Edit: I was able to get my blog back up by restoring a backup from a couple of days ago, but now I am so scared of trying to update it…

I’d appreciate your help a lot.
A frustrated Ghost blog user :smiley:
Thank you.

Yes, that would simplify the upgrade process. I presume there are already good Ghost SQLite to MySQL migration guides out there, but ask a separate question here if you get stuck.

Addressing Node version problems

I also ran into some Node version upgrade problems. Here’s some general advice:

  1. Don’t use nvm for installing node. That tool switches between Node versions based on environment variables. This makes it fragile. For example, Ghost is run by systemd, which tightly controls the environment variables that are set for the the service. I doubt anything installed via nvm is going to be visible to the systemd service. The official Ghost docs recommend installing Node from a custom repo, so you could try that. How to install & setup Ghost on Ubuntu 20.04 or 22.04

Time to containerize?

For a long time I have advocated for using the Ghost CLI method of installing recommended by the official install doc. But as your case and mine illustrate, even seasoned Linux managers can get tripped up by Node version upgrade problems.

Containers eliminate that issue, by bundling the precise required Node version needed with the software itself.

So when I rebuilt my server most recently, I did not install Node at all. Instead, I installed Ghost in containers.

Now, containers bring their own set of complexity, but they are also extremely popularly and lots of people understand how to solve container-related problems now. The Ghost container on Docker hub has over 100 million downloads at this point . If you go that route, you have set up for yourself details like making sure the service starts at boot an handling a reserve proxy for it yourself, but there are a lot of guides for setting up Ghost in a container out there at this point.

Personally, I use Ansible and Podman at work to manage containers so that’s how I’m managing mine: Interested in Ansible Role to install Ghost to run with podman containers / systemd / private networking?

Docker is more popular and their are plenty of guides for that:

1 Like