There wasn't really any documentation on how to deploy Ghost with the datastore set to MySQL on dokku. So here is my attempt at doing that.


Let's begin by creating a dokku app for the blog and a MySQL db to act as the ghost datastore. Sqlite3 and Postgres are also supported by ghost, but for the purposes of this example, we'll be using MySQL.

dokku apps:create myblog
dokku mysql:create myblog

Configure DB

Then link the mysql db you created with the dokku app.

dokku mysql:link myblog myblog

After running this, you should something like below printed out:


Take note of these as you will need this to set up the ghost database in the next step.

Ghost configuration file

Then you will need to create a config.production.json file that ghost will use. In this you will need to set the database credentials that were obtained from the previous step and any other configurations.

i.e. Replace <DB-USER>, <DB-PASSWORD>, <DB-HOST>, <DB-NAME> with whatever you saw in the previous step.

Also replace the url value to whatever domain you're pointing your blog to.

NOTE: I won't go over setting up Mailgun here, but you can find tutorials on that elsewhere.

  "url": "",
  "server": {
    "port": 2368,
    "host": ""
  "database": {
  "client": "mysql",
    "connection": {
      "host": "<DB-HOST>",
      "port": 3306,
      "user": "<DB-USER>",
      "password": "<DB-PASSWORD>",
      "database": "<DB-NAME>"
  "mail": {
      "transport": "SMTP",
      "options": {
          "service": "Mailgun",
          "auth": {
              "user": "",
              "pass": "<MAILGUN PASSWORD>"
  "logging": {
    "transports": [
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"

Then scp this into your dokku instance.

scp config.production.json youruser@yourdokku.thingy:/home/yourremoteuser/

Dokku storage mounts

ssh into your Dokku instance.

Create the folder into which you're going to store your configuration files and other ghost stuff.

mkdir -p /var/lib/dokku/data/storage/myblog/content

Then mv the config.production.json from earlier to the myblog folder.

cp config.production.json /var/lib/dokku/data/storage/myblog

Finally, mount these new locations:

dokku storage:mount myblog /var/lib/dokku/data/storage/myblog/content:/var/lib/ghost/content
dokku storage:mount myblog /var/lib/dokku/data/storage/myblog/config.production.json:/var/lib/ghost/config.production.json

Deploy the app

For this we'll be using dokku's neat docker image deploy method.

Pull the image:

docker pull library/ghost:2

Then retag it:

docker tag library/ghost:2 dokku/myblog:2

The finally deploy:

dokku tags:deploy myblog 2