Running Ghost on Dokku PaaS

Jan 29, 2018 · 4 min read

If you’re reading this, then you probably know Ghost’s development team never intended for Ghost to run on Heroku, and by extension, other Heroku-like PaaS implementations.

Version 1.x of Ghost makes several online guides for workarounds obsolete, and this post in particular aims to bring you an up-to-date workaround to getting Ghost installed in your own Dokku setup.

Before we start

This guide is very much based on Berge Greg’s post on getting Ghost 1.x to run on Heroku


  • Working Dokku installation
  • A database plugin for dokku (e.g. dokku-mariadb or dokku-mysql)
  • SSH access to the Dokku host (assumed to be of hostname dokku)
  • A domain pointing to your dokku host IP address (assumed to be
  • (Optional) Let’s Encrypt plugin for easy HTTPS

Getting Ghost installed on Dokku

1. Prepare Dokku

SSH into your Dokku host, then create a new app with accompanying database services and domain.

In this guide, we will use “blog” for the app and “blog-db” for the database service.

At this point, Dokku might inform you that the blog app has not been deployed. Do not worry, because we haven’t.

Now, we will need to disable checks as the checks will fail upon our first deployment due to the lack of database connection credentials

2. Environment Variables

We will be configuring Ghost via environment variables as opposed to a config file. The following commands are done on the Dokku host

Database Configuration

First up, we need to configure the database credentials. Retrieve the login details through the DATABASE_URL environment variable.

Based on the above, you will need to set the following:

Domain configuration

Here, we will be setting up the port and URL to access Ghost through:

3. Download Ghost

Back to your local machine, head to the [Ghost developers’ website]( and download the zip

Then, unzip the files into a directory to something you are comfortable with (e.g. “my-blog”)

4. Initialise a git repo

As with Heroku, Dokku works with the basis that projects are git repos, and that is how you will be deploying your Ghost app

Now, we will have to add our Dokku host as a remote to push to, and then push it.

5. Initialising the Database

At this point, the app should be deployed. What’s left is to initialise the database on the Dokku host:

Your output should be similar to:

6. Final Configuration

All that’s left is to re-enable the checks upon deployment

And then your app should be all ready to set up at

7. (Optional) Let’s Encrypt!

Thanks to the Dokku Let’s Encrypt plugin, enabling encryption on the domain is a simple matter of setting up an environment variable (DOKKU_LETSENCRYPT_EMAIL), and then running a command.

(Replace the email with your own)

Once that is done, Dokku will automatically configure your app to be accessible at in addition to

8. (Optional) Enable persistent storage

Dokku, like Heroku, does not have persistent storage by default. Any re-deploys will risk having any files that were written to the directories and not checked into git being removed.

Dokku provides a persistent storage plugin using dokku storage. As per the documentation, mount points are recommended to reside within /var/lib/dokku/data/storage/. We will first create the folder within this directory, then mount the content/images path of the ghost container onto that folder.


Before you embark on any troubleshooting steps, restart your dokku app to ensure that all environment variables you have configured are in effect.

Dokku may have configured a different port to serve your app at. If so, check on which port this is by checking the DOKKU_PROXY_PORT_MAP environment variable:

In the above, the port number is 5000.

Feel free to let me know if you have any further issues and I will update this section.


Koa and Company

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store