Deploying WriteFreely via Dokku

I'm a big fan of Dokku for simple deployment on my server. It's running this website you're currently reading, for one! However, deploying apps on it that break outside of the patterns. WriteFreely is one of those.

If you want to deploy it via Dokku, it's actually pretty easy. To save others the trouble of having to figure it out themselves, I've put together the required files and instructions in a git repo.

You can also follow the instructions below.


You must have Dokku installed on your server already for these steps to work. I won't walk through all that here.


First, create a new folder on your local computer and create a file named Dockerfile in it. Put the lines below in that file with a text editor:

FROM writeas/writefreely

COPY config.ini .


CMD ["bin/writefreely"]

Next, create a file named config.ini and put the lines below in that file with a text editor (note: you'll want to change some of the values to match your desires):

hidden_host          = 
port                 = 8080
bind                 =
tls_cert_path        = 
tls_key_path         = 
templates_parent_dir = 
static_parent_dir    = 
pages_parent_dir     = 
keys_parent_dir      = 

type     = sqlite3
filename = db/writefreely.db
username = 
password = 
database = 
host     = localhost
port     = 3306

site_name         = Write Freely
site_description  = 
host              =
theme             = write
disable_js        = false
webfonts          = true
single_user       = false
open_registration = true
min_username_len  = 3
max_blogs         = 3
federation        = true
public_stats      = true
private           = false
local_timeline    = true
user_invites      = user

Then, connect to your server via SSH and create the writefreely app.

dokku apps:create writefreely

Then, setup the directories for WriteFreely's data so it won't be wiped each time you re-deploy.

mkdir -p /var/lib/dokku/data/storage/writefreely/{db,keys}
chown daemon:daemon /var/lib/dokku/data/storage/writefreely/*
dokku storage:mount writefreely /var/lib/dokku/data/storage/writefreely/keys:/go/keys
dokku storage:mount writefreely /var/lib/dokku/data/storage/writefreely/db:/go/db
dokku proxy:ports-set writefreely http:80:8080

Next, open the folder the files you downloaded from this repo are in. Initialize a git repo in it.

git init
git add --all
git commit -m "Init"
git remote add dokku dokku@[YOUR SERVER'S IP OR URL]:writefreely
git push dokku master

This deploy will fail. You can then initialize WriteFreely's database and keys.

dokku run writefreely bin/writefreely --init-db
dokku run writefreely bin/writefreely --gen-keys

Finally, you can rebuild the app and it'll run as expected.

dokku ps:rebuild writefreely

If you have any problems, contact me via Mastodon or Twitter and I'll try to help.