Running ghost start, starts Ghost but goes in 503 errors loop, the ghost log command output that ghost restarts every few seconds.
Running ghost run allows the site to stay up.
That is where I am at.
Thank you for your help.
Edit: node -v command outputs: v12.21.0
Logs in /var/www/ghost/content/logs are too big to be pasted here.
I have no way to tell why this happened without knowing the history of how node has been installed and used on the server. However the problem is that when you updated node prior to updating Ghost, you have ended up only updating one node install and now Ghost is getting different node versions.
To solve this, you need to either uninstall one version or get them both to be the same.
I removed with rm -rf the local node folder which then gives me the following output
GhostU@GhostS:/var/www/GhostF$ which node
/usr/bin/node
GhostU@GhostS:/var/www/GhostF$ /usr/bin/node --version
v14.16.0
GhostU@GhostS:/var/www/GhostF$ /usr/local/bin/node --version
-bash: /usr/local/bin/node: No such file or directory
And I also followed those steps.
reinstall Ghost-CLI
run ghost update 4.0.1 --force
ghost start make the ghost instance to restart every second or so. ghost run makes ghost run well.
I will write how I did it: maybe you can just copy paste from there:
uninstall nvm
rm -rf $NVM_DIR ~/.npm ~/.bower
unset NVM_DIR;
which node;
rm -rf {path_to_node_version}
rm -rf {path_to_node_version} (local one also)
reinstall node (I checked where is pointer for node in my settings for me it is without local) wget https://nodejs.org/download/release/latest-v12.x/node-v12.21.0-linux-x64.tar.gz
sudo tar --strip-components 1 -xzvf node-v* -C /usr/
I did as you suggested, I removed the files I also did apt purge nodejs to uninstall it.
I tried with the wget command but it didn’t fixed my issue so I uninstalled node again.
Then I reinstalled node using the Ghost documentation, same for the ghost-cli and did force the ghost update.
I have again:
GhostU@GhostS:/var/www/GhostF$ which node
/usr/bin/node
GhostU@GhostS:/var/www/GhostF$ /usr/bin/node --version
v14.16.0
GhostU@GhostS:/var/www/GhostF$ /usr/local/bin/node --version
-bash: /usr/local/bin/node: No such file or directory
but, it isn’t fixed.
Edit:
Here is my systemd file
[Service]
Type=simple
WorkingDirectory=/var/www/GhostF
User=999
Environment=“NODE_ENV=production”
ExecStart=/usr/bin/node /usr/bin/ghost run
Restart=always
I tried the latest release (4.1.0), just in case, but no luck.
Edit:
I tried to poke around more and compare how others managed to fix their issue, but for some reason, even if it looks very similar to what they had and I apply their fix, it does not work. ghost start fails, but ghost run still works fine.
I ran the commands based on the link you provided, just changed the 14x by 12x and ran apt purge nodejs prior the reinstall process to remove my version of node.
After running the commands, here is the output I have for node (which to me looks fine):
GhostU@GhostS:/var/www/GhostF$ which node
/usr/bin/node
GhostU@GhostS:/var/www/GhostF$ node --version
v12.21.0
GhostU@GhostS:/var/www/GhostF$ /usr/bin/node --version
v12.21.0
GhostU@GhostS:/var/www/GhostF$ /usr/local/bin/node --version
-bash: /usr/local/bin/node: No such file or directory
I ran the update for ghost 4.1.0, which was the version I was already running, with the force flag. However with ghost start I end up at the same result as before, and ghost run still works as well.
ghostU@ghostM:/var/www/ghost$ sudo systemctl status ghost_ghost-instance
â—Ź ghost_ghost-instance.service - Ghost systemd service for blog: ghost-instance
Loaded: loaded (/var/www/ghost/system/files/ghost_ghost-instance.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-03-19 08:26:08 EDT; 4s ago
Docs: Ghost: The #1 open source headless Node.js CMS
Main PID: 63516 (node)
Tasks: 22 (limit: 2281)
Memory: 124.9M
CGroup: /system.slice/ghost_ghost-instance.service
├─63516 ghost run
└─63542 /usr/bin/node current/index.js
Mar 19 08:26:08 ghost systemd[1]: Started Ghost systemd service for blog: ghost-instance.
Mar 19 08:26:09 ghost node[63516]: - Inspecting operating system
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Ghost is running in production…
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Your site is now available on hxxps://myghostblog.com/
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Ctrl+C to shut down
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Ghost server started in 0.96s
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Database is in a ready state.
Mar 19 08:26:10 ghost node[63542]: [2021-03-19 12:26:10] INFO Ghost database ready in 1.48s
Here is my /etc/systemd/system/ghost_ghost-instance.service file:
I’m still battling with this issue.
Going back to node 12 instead of 14 didn’t help. Checking the node install path, it’s seems to be fixed.
Path for systemd looks good as well.