Deploying Ghost via Dokku with PostgreSQL

To start, you'll need a working Dokku installation (tested with v0.3.15) and have installed a suitable PostgreSQL plugin.

First, we clone the Ghost on Heroku repository, setup the Dokku remote, and push it.

(Note: I have used desktop$ to indicate the commands should be run locally (e.g. where you want to keep a checkout of your Ghost blog) and dokku$ to indicate commands that should be run on the Dokku host directly.)

desktop$ git clone https://github.com/cobyism/ghost-on-heroku \
             blog-jay-sh
desktop$ cd blog-jay-sh/
desktop$ git remote add dokku dokku@dokku.lan:blog-jay-sh
desktop$ git push dokku master

dokku$ dokku config:set blog-jay-sh \
           HEROKU_URL=http://blog-jay-sh.dokku.lan.jay.sh
dokku$ dokku postgresql:create blog-jay-sh"

Done! You should now be able to browse to your equivalent of http://blog-jay-sh.dokku.lan.jay.sh and see your blog.

If you want to enable image uploads, we'll need to enable them in config.js (in reality, we delete the line that disables it) and mount an appropriate directory from the host (the ability to do this is unique to Dokku, which is why config.js is hardcoded this way). You'll need Dokku's persistent-storage plugin for this.

dokku$ echo "/apps/blog-jay-sh/content/images:/app/content/images" \
           > /home/dokku/blog-jay-sh/PERSISTENT_STORAGE"

desktop$ sed -i '/fileStorage: false/d' config.js
desktop$ git commit -m 'Enable image uploads.' config.js
desktop$ git push dokku master