Multiple Ghosts on single Droplet


So what's the best way to bring up a Ghost site on Digital Ocean and then have another site which is the test one. There is some support for a development version and a production site in a separate place.
I tried the instructions in Digital Ocean but this didn't work and nginx failed. I think this is because you can't have multiple default server, so on one configuration you need to delete the default server. Sean Baker seems to have a better complete workflow including how to use git to manage source. I just wiped out my post database, so you pretty clearly have to think about backups with a sqllite database in it.
I did this and it still didn't quite work. I created two ghosts and had them on different ports, but nginx was very unhappy. So took out the two things and will try later. But for reference, this is what I tried:

  1. In /etc/nginx/sites-available, I created two servers, ghost and ghost-test where the only difference is I removed the default-server lines and replaced with server 80 so that they both listened to port 80 and used the host name vs to differentiate. Then changed one to to to and the other to
  2. Then created two different ghost instances in /var/www/ghost and /var/www/ghost-test and then put different git branches each. Master and then a branch v0.1 so that ghost would also be at a standard branch and then test could be at the latest master for testing.

  3. Moved form init.d to init scripts and had one ghost which cd'd in the /var/www/ghost and the other in /var/www/ghost-test. Also change the NODE_ENV as production in one and development the other.

The result sort of worked. But when both ghosts were started, then NGINX threw a 503 bad gateway message. Sigh
Even trying to get the script to work seemed to cause problems in /etc/init. I keep getting an abnormal termination and the log entry "Ghost process ended"
In plunking around, I think the digital ocean instructions are probably wrong. You should just copy the init.d script over. Looking at seems much closer and a better init script which for instance retains the log file from node which is handy and this seems to get rid of the init script failure.
Also looking at running both a debug and production environment. The config.js sort of allows for it. If you start in development mode, it listens to a different port, uses a different url and also uses a different post database. However, it uses the same hbs files, so you can run simultaneous test and development setups really. Seems like the only viable option is to maintain two different ghost installations which kind of defeats the purpose of a development mode.

Related Posts