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:
- In /etc/nginx/sites-available, I created two servers,
ghost
andghost-test
where the only difference is I removed the default-server lines and replaced withserver 80
so that they both listened to port 80 and used the host nametest.foo.com
vswww.foo.com
to differentiate. Then changed one to to to 127.0.0.1:2368 and the other to 127.0.0.1:2370. -
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. -
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 http://seanvbaker.com/a-ghost-workflow/ 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.