Deploying Ghost at start-up

This post is deprecated. Since Ghost 1.0 the ghost-cli installer configures systemd automatically

Deploying Ghost at start-up

This page is just basically a rehash of
http://support.ghost.org/deploying-ghost/

Get the Ghost.io deployment script and install into /etc/init.d

cd ~
sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost  -o /etc/init.d/travels
cd /etc/init.d
sudo nano travels

Change the:

  • DESC
  • NAME
  • GHOST_ROOT
  • GHOST_GROUP
  • GHOST_USER

parameters

e.g.

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Ghost for Travels"
NAME=travels 
GHOST_ROOT=/var/www/travels 
GHOST_GROUP=pi 
GHOST_USER=pi 
DAEMON=/usr/bin/node
DAEMON_ARGS="$GHOST_ROOT/index.js"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
export NODE_ENV=production

Also change the line clost to the top of the file to change the #Provides name from ghost to travels e.g.
# Provides: travels

Make the file executable
sudo chmod 755 travels
and reboot

Now you should be able to start and stop travels as a service - e.g.
sudo service travels start

To do this automatically at boot time

sudo update-rc.d travels defaults
sudo update-rc.d travels enable

Reboot and your ghost blog should be running as desired

Next: Adding Mail to Ghost