Fix `ghost start` not work
While trying to upgrade my Ghost blog to to latest version 3.15.1 last week, it always freezed at Starting Ghost
step.
+ sudo systemctl is-active ghost_muyexi-im
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
+ sudo systemctl is-active ghost_muyexi-im
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
+ sudo systemctl start ghost_muyexi-im
☲ Starting Ghost: muyexi-im
From the log we can see ghost start
is using systemctl
to manage ghost service, use systemctl status ghost_muyexi-im
we can see the sercie status:
● ghost_muyexi-im.service - Ghost systemd service for blog: muyexi-im
Loaded: loaded (/var/www/ghost/system/files/ghost_muyexi-im.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-05-14 21:13:05 CST; 3min 2s ago
Docs: https://docs.ghost.org
Main PID: 25752 (ghost run)
Tasks: 18 (limit: 1149)
CGroup: /system.slice/ghost_muyexi-im.service
├─25752 ghost run
└─25767 /usr/bin/nodejs current/index.js
The system node /usr/bin/nodejs
is a version not supported by Ghost, and I'm using nvm for managing node versions, so I need to change the systemd service file at /var/www/ghost/system/files/ghost_muyexi-im.service
.
[Unit]
Description=Ghost systemd service for blog: muyexi-im
Documentation=https://docs.ghost.org
[Service]
Type=simple
WorkingDirectory=/var/www/ghost
User=1000
Environment="NODE_ENV=production"
#ExecStart=/usr/bin/nodejs /usr/bin/ghost run
ExecStart=/usr/local/bin/node /usr/bin/ghost run // Switch to nvm node
Restart=always
[Install]
WantedBy=multi-user.target
After changed the node path, reload the service file:
systemctl daemon-reload
Now try ghost start
, it should work again!