/ Ghost

Updating ghost-cli process name

Imagine you've created your new Ghost install but have set it up with the incorrect process name. The official documentation does not tell us how to update it, it just tells us that it can be set using the --pname flag during initial installation. Let's look at how we can update the process name after we've installed our site.

Run ghost ls


So in this case, I wanted to rename bitsnbytes-thecurlybraces-com to bitsnpieces-thecurlybraces-com

First stop the running server process using ghost stop bitsnbytes-thecurlybraces-com.

Open the .ghost-cli file in the folder where the site / server is deployed. You'll see the following content,

  "cli-version": "1.0.3",
  "active-version": "1.8.6",
  "name": "bitsnbytes-thecurlybraces-com",
  "extension": {},
  "running": "production"

Change the name key to the following - bitsnpieces-thecurlybraces-com.

Restart with ghost restart bitsnpieces-thecurlybraces-com and you should now see the updated name in the ghost ls.

After you do this, you might have to reconfigure systemd. To do that, run the following command -

ghost setup systemd

Incase you forget to stop the server before renaming the ghost-cli file, and you had configured systemd, you'll not be able to start the server. You might be shown the following error -

abijeet@Discovery:/var/www/html/bitsnpieces.thecurlybraces.com$ ghost start bitsnpieces-thecurlybraces-com
✖ Validating config
A ConfigError occurred.

Error detected in the production configuration.

Message: Port '3002' is in use.
Configuration Key(s): server.port
Current Value(s): 3002

Help: Run `ghost config <key> <new value>` for each key to fix the issue.

Debug Information:
    Node Version: v6.11.2
    Ghost-CLI Version: 1.1.1
    Environment: production
    Command: 'ghost start bitsnpieces-thecurlybraces-com'

Please refer to https://docs.ghost.org/v1/docs/troubleshooting#section-cli-errors for troubleshooting.

To fix this, you'll have to go through some extra steps.

Disable systemd for the blog and restart

Delete this file from the ghost site installation folder first -

sudo rm /var/www/html/bitsnpieces.thecurlybraces.com/system/files/ghost_bitsnpieces-thecurlybraces-com.service

Also remove a symlink from under /etc/systemd/system/ that was created by ghost-cli.

rm /etc/systemd/system/ghost_bitsnpieces-thecurlybraces-com.service

Restart systemd.

Stop the old server process

Now that we've disabled systemd, killing the node process will not cause it to restart.

Use a software like htop to kill the running server process. If you don't do this and try to start the new server, you'll get an error stating that the port is already in use.

Once done, you should be able to start your server again.

Note that if you are doing this, you might also have to do the following,

  1. Update the virtual host in nginx from bitsnbytes.thecurlybraces.com to bitsnpieces.thecurlybraces.com. Click here to find out how to do that.
  2. Add or update the domains under your Let's Encrypt certificate. Click here to find out how to do that.