Make Gadgets Work

Ghost Upgrade errors and fixes (1.19.x)

Ankit Mittal

I have found the recent ghost upgrades quite painless but there have been few hiccups for last two times so I kept a record of what helped and it is as listed below:

General Update should be as simple as:

cd /var/www/html/ghost/
ghost update

If after this step, there are any errors or an indication to update ghost-cli, following command should be used.

sudo npm install -g ghost-cli

After this if there are issues accessing the blog over internet, we may need to do a bit of checks. Logical sequence is to first check that access for all folders is right and proper. If it needs to be updated, command to be used is:

cd ghost
sudo chown -R <your username>:www-data .

cd content/
sudo chown -R ghost:ghost images/

If there are any errors when starting ghost, following command is indicated by the ghost-cli and it does help.

ghost setup linux-user systemd

If still accessing the blog is an issue following command will list the ghost log file:
ghost log

If there are database migration errors on log file, following commands may help:

sudo npm install -g knex-migrator
ghost setup migrate
ghost setup migrate does work very well and must be remembered.

If you have digitalocean setup such as mine, memory can be an issue you may want to restart the virtual machine and reload the swap files.

sudo reboot now
sudo swapon /swapfile1
sudo swapon /swapfile2

If there are still issues accessing the blog with error 503, check the apache logs:

sudo nano /var/log/apache2/error.log

If issue is with accessing the upstream ghost server. Try changing the port on ghost config and updating the apache conf files.

##Change Directory to ghost install
cd /var/www/html/ghost
##Stop the ghost server
ghost stop
##Change port to another number
nano config.production.json
##Change directory apache2 server
cd /etc/apache2/sites-available/
##Open the ghost.conf file and change the localhost port to same number that was changed in config.production.json
sudo nano ghost.conf
##Open the ghost-le-ssl.conf file and change the localhost port to same number that was changed in config.production.json
sudo nano ghost-le-ssl.conf
##Disable and enable the conf files on apache.
sudo a2dissite ghost.conf ghost-le-ssl.conf
sudo a2ensite ghost-le-ssl.conf ghost.conf 
sudo service apache2 reload 
##Finally change directory to your ghost install and start ghost server.
cd /var/www/html/ghost
ghost start