Using Ubuntu Snap Package Node for Ghost Review

Does anyone have experience with Node snap package on Ubuntu with Ghost installation? (It might not be recommended?)

I have done a Ghost upgrade and Node.js needed to be upgraded to a newer version than Ubuntu provided on the current package manager.

I had a look at the snap package option for node. It seemed to be quite a good option (to me) for managing node versions. (Simple install and remove commands etc)

Examples:

sudo snap install node --classic
OR
sudo snap install node --channel=18/stable --classic

So I decided to give it a go for my ghost installation. (I got backup and snapshot to roll back my changes)

Installation Information:
OS: Ubuntu, v22.04.4 LTS
Node Version: v20.14.0
Ghost Version: 5.82.12
Ghost-CLI Version: 1.26.0
Environment: production
Command: ‘ghost doctor’

After I did the upgrade to Node v20.14.0, I ran ghost doctor.

Ghost Doctor Results:

:heavy_check_mark: Checking system Node.js version - found v20.14.0
:heavy_check_mark: Checking logged in user
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Checking system compatibility
:heavy_check_mark: Checking for a MySQL installation

  • sudo systemctl is-active ghost_****************-co-uk
    :heavy_check_mark: Validating config
    :heavy_check_mark: Checking folder permissions
    :heavy_check_mark: Checking file permissions
    :heavy_check_mark: Checking content folder ownership
    :heavy_check_mark: Checking memory availability
    :heavy_check_mark: Checking binary dependencies
    :heavy_check_mark: Checking free space
    :heavy_check_mark: Checking systemd unit file
    :heavy_multiplication_x: Checking systemd node version
    One or more errors occurred.
  1. SystemError

Message: Unable to determine node version in use by systemd
Help: Ensure ‘ExecStart’ exists in /lib/systemd/system/ghost_*********-co-uk.service and uses a valid Node version

I then changed the file as requested.

Old Config:

[Unit]
Description=Ghost systemd service for blog: ***********-co-uk
Documentation=Ghost: The #1 open source headless Node.js CMS

[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=999
Environment=“NODE_ENV=production”
ExecStart=/usr/bin/node /usr/bin/ghost run
Restart=always

[Install]
WantedBy=multi-user.target

New Config:

[Unit]
Description=Ghost systemd service for blog: ************-co-uk
Documentation=Ghost: The #1 open source headless Node.js CMS

[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=999
Environment=“NODE_ENV=production”
ExecStart=/snap/bin/node /usr/bin/ghost run
Restart=always

[Install]
WantedBy=multi-user.target

Current State

I then tried to run ghost doctor and got the same issue, which has confused me.

I have rebooted the server just encase it needed services restarted but still the same issue sadly.

If anyone has any advice or additional information, I would be much appreciated. I will do my own research and will try to update this forum post If I find anything.

Thanks for taking the time to read this post.

I suspect the snap package could work fine, but Ghost Doctor is failing to consider it a valid option.

While there are pros and cons to using containers, if Ghost ran in a container, all issues with node on the host would be solved.

There is a bit of discussion about that now because the new ActivityPub feature, at least for now, may be a separate service. So Docker Compose or something like that is needed to bring up two services.

Personally, I run Ghost in containers now.

1 Like

AFAIK only Node v18 LTS is supported.
See Supported Node Version