I needed to make a change, I should write more often. I decided to switch my personal website to Ghost platform.
Sean V Baker wrote fantastic article "A Ghost Workflow" on how to automate Ghost deployment with Git. Following Sean's article and Ghost installation tutorial I set up the workflow, modified Crossing theme and I was ready!
The only difference, instead of using Upstart script described in the article I used supervisor to run Ghost at startup.
Install Supervisor:
apt-get install supervisor
service supervisor start
Create a new script file in /etc/supervisor/conf.d/ghost.conf
[program:ghost]
command = node /var/www/ghost/index.js
directory = /var/www/ghost
user = ghost
autostart = true
autorestart = true
stdout_logfile = /var/log/supervisor/ghost.log
stderr_logfile = /var/log/supervisor/ghost_err.log
environment = NODE_ENV="production"
Run
supervisorctl reread
supervisorctl update
Ghost can be controlled by executing supervisorctl start ghost
and supervisorctl stop ghost
My post-receive hook:
#!/bin/sh
GIT_WORK_TREE=/var/www/ git checkout -f
sudo /usr/bin/supervisorctl restart ghost
It will probably take a few days to transfer old content and services, but Ghost's speed and ease of use are amazing.