/ Ghost

Setting up Ghost on Digital Ocean and Ubuntu

I just manually set up this Ghost blog on a Digital Ocean droplet running Ubuntu.

Digital Ocean offers a one-click solution for deploying Ghost, but I assume (and do not know) that the one-click solution doesn't allow for Nginx proxying, which is a requirement for me.

And, I wanted to set this up myself anyways...

However, the setup process was initially counterintuitive to how I tend to deploy new sites on my droplet, so it took a bit more time to get going than I might have hoped.

Once I understood I was thinking about the setup backwards, things moved in the right direction very quickly.

My issue

My usual workflow for deploying sites to my droplet is to:

  1. Build locally
  2. git push to production
  3. Repeat

(This is, of course, a massive simplification, but these are the important steps.)

I attempted this same pattern with Ghost, only to have Ghost's grunt processes complain at me about not having access to a git working tree on the server. This is because I tend to use bare git repos on the server; there is no working tree by design.

Getting help

At this point, I reached out to the Ghost community Slack, and in less than two minutes heard back from Ghost's CTO and lead developer, Hannah Wolfe. She pointed out that the better workflow is to install an official build directly to the server.

Of course Digital Ocean already had an article describing in detail my exact needs, i.e. how to:

  1. Install a Ghost build directly to Ubuntu
  2. Edit the Ghost config file
  3. Proxy with Nginx
  4. Fire up the blog server permanently with modules like forever and pm2

What worked for me

Digital Ocean's excellent "How To Create a Blog with Ghost and Nginx on Ubuntu 14.04" guide by Tammy Fox got me 95% of the way there.

A couple of minor hickups for my setup worth calling out:

  1. I use pm2 instead of forever. The guide only covers forever, but it's the same concept, so the forever section of the guide is still worth reading for pm2 folks.

    Where with forever, you might input:
    NODE_ENV=production forever start index.js

    Using pm2 it would be:
    NODE_ENV=production pm2 start index.js

    (Side note: The production environment variable is important, as Ghost will launch in development mode without it. See your Ghost config file for details.)

  2. I hit the sqlite3 module snag that some people see when firing up the Ghost blog server. This Ghost troubleshooting guide helped me sort that out fairly quickly.


Hopefully this gives you a few hints that help speed up deployment of your Ghost blog.