Write Freely - Host WriteFreely in Containers

WriteFreely is a blogging and publish tool as well as an important part of the Fediverse network. It is lightweight and easy to host. However, the official Container (Docker) setup is not even correct. So here comes a working deployment notes.

· 2 min read
Write Freely - Host WriteFreely in Containers

WriteFreely is a blogging and publish tool as well as an important part of the Fediverse network. It is lightweight and easy to host. However, the official Container (Docker) setup is not even correct. So here comes a working deployment notes.

Compose File

The first thing you need to know is that there is actually an image avaible on Docker Hub. You don't need to build the image locally unless you need some changes in the source code. So here we have a compose file like below:

version: '2'
services:
    writefreely:
        image: writeas/writefreely:latest
        volumes:
            - "./web:/go/src/app"
            - "./config.ini:/go/config.ini"
        ports:
            - "127.0.0.1:8080:8080"

It is so simliar to the official-provided one, right? But notice the volumes mount - according to writefreely#139, the configuration file should be mounted at /go/config.ini rather than /go/src/app/config.ini in the official compose file.

Docker issue · Issue #139 · writeas/writefreely
Describe the bug Hi there - I followed the Docker instructions properly but after running docker-compose up -d I am unable to run the setup script since the web container never launches properly. A...

Configuration File

If you don't want to read so many documentation, you can download the official example configuration file to start with.

$ wget -O config.ini https://raw.githubusercontent.com/writeas/writefreely/develop/config.ini.example

Then change the content accordingly. But wait before you think you are set - there are some very essential lines or options you need to change so that the application accepts the connections.

[server]
bind        = 0.0.0.0
....
[app]
host              = https://wr.itefree.ly
....

You can add or adjust other options at this time.

Getting Things Up

Now you are ready to go - except preparing the database schemas. Ensure that you have a working database connection in the configuration file. Then start the container and initilize the schema. Finally create an administrator as the first user.

# docker-compose up -d
# docker-compose exec writefreely /go/cmd/writefreely/writefreely --init-db
# docker-compose exec writefreely /go/cmd/writefreely/writefreely --create-admin username:password

Do not use the official-provided schema.sql. It is a rather old version.

Now you can point your browser to your instance. Start writing and pushlish over the ActivityPub network!