How to Install WriteFreely on Your Synology NAS

How to Install WriteFreely on Your Synology NAS

WriteFreely is a clean, minimalist publishing platform made for writers. Start a blog, share knowledge within your organization, or build a community around the shared act of writing. WriteFreely supports federation via ActivityPub, a protocol spoken by popular platforms like Mastodon and Pixelfed. This means that other people can directly follow your blog from the decentralized social network known as the “fediverse”, if your WriteFreely admin has enabled federation (STEP 34). In this step by step guide I will show you how to install WriteFreely on your Synology NAS using Docker and Portainer. Note: The guide proposed below is using MySQL as database, but if you want to use SQLite as database, just follow my guide on How to Install WriteFreely SQLite on Your Synology NAS.

Note: This guide works perfectly with the latest WriteFreely v0.13.2 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 5

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 1

  • STEP 6

Now click the “Create” button. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 2

  • STEP 7

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in WriteFreely. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: writefreely.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 9800

WriteFreely MySQL Synology NAS Set up 3

  • STEP 8

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 9

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 4

  • STEP 10

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 5

  • STEP 11

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it writefreely. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

WriteFreely MySQL Synology NAS Set up 6

  • STEP 12

Now create two new folders inside the writefreely folder that you created at STEP 11 and name them data and db. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

WriteFreely MySQL Synology NAS Set up 7

  • STEP 13

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 14

In the Name field type in writefreely. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  db:
    image: mariadb:jammy
    container_name: WriteFreely-db
    hostname: writefreely-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: out=$$(mysqladmin ping -h localhost -P 3306 -u root --password=rootpass 2>&1); echo $$out | grep 'mysqld is alive' || { echo $$out; exit 1; }
    environment:
      - TZ=Europe/Bucharest
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_DATABASE=writefreely
      - MYSQL_USER=writefreelyuser
      - MYSQL_PASSWORD=writefreelypass
    volumes:
      - /volume1/docker/writefreely/db:/var/lib/mysql:rw
    restart: always

  writefreely:
    image: algernon/writefreely:latest
    container_name: WriteFreely
    hostname: writefreely
    security_opt:
      - no-new-privileges:true
    user: 1026:100
    ports:
      - 9800:8080
    volumes:
      - /volume1/docker/writefreely/data:/data
    environment:
      - WRITEFREELY_SITE_NAME=Mariushosting blog
      - WRITEFREELY_HOST=https://writefreely.yourname.synology.me
    restart: always
    depends_on:
      db:
        condition: service_started

Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for WRITEFREELY_SITE_NAME and type in your own site name. Mariushosting blog is an example for a site name.
Note: Before you paste the code above in the Web editor area below, change the value for WRITEFREELY_HOST and type in your own synology.me DDNS that you have previously created at STEP 7.

WriteFreely MySQL Synology NAS Set up 8 new2 2023

  • STEP 15

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

WriteFreely MySQL Synology NAS Set up 9 new2 2023

  • STEP 16

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

WriteFreely MySQL Synology NAS Set up 10

  • STEP 17

On the left sidebar in Portainer, click Containers. Identify your WriteFreely instance, then click on the little terminal icon. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 11

  • STEP 18

After you click on the little terminal icon at STEP 17, a new page will open. From the Command dropdown menu select /bin/sh then click Connect. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 12

  • STEP 19

After you click Connect at STEP 18, a Console will open. Type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

cd /data

WriteFreely MySQL Synology NAS Set up 13

  • STEP 20

After pressing enter at STEP 19, type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

/writefreely/writefreely --config

WriteFreely MySQL Synology NAS Set up 14

  • STEP 21

Using the arrow keys on your keyboard select “Production, behind reverse proxy” then confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 15

  • STEP 22

After Selecting Production, behind reverse proxy at STEP 21, type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

8080

WriteFreely MySQL Synology NAS Set up 16

  • STEP 23

Using the arrow keys on your keyboard select “MySQL” then confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 17

  • STEP 24

After Selecting MySQL at STEP 23 type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

writefreelyuser

WriteFreely MySQL Synology NAS Set up 18

  • STEP 25

After pressing enter at STEP 24, type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

writefreelypass

WriteFreely MySQL Synology NAS Set up 19

  • STEP 26

After pressing enter at STEP 25, type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

writefreely

WriteFreely MySQL Synology NAS Set up 20

  • STEP 27

After pressing enter at STEP 26, type in the text below instead of localhost. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

writefreely-db

WriteFreely MySQL Synology NAS Set up 21

  • STEP 28

After pressing enter at STEP 27, type in the text below. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

3306

WriteFreely MySQL Synology NAS Set up 22

  • STEP 29

Using the arrow keys on your keyboard select “Single user blog” then confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 23

  • STEP 30

Type in your own Username and confirm by pressing Enter on your keyboard. Follow the instructions in the image below. Note: You will need this Username at STEP 42.

WriteFreely MySQL Synology NAS Set up 24

  • STEP 31

Type in your own Password and confirm by pressing Enter on your keyboard. Follow the instructions in the image below. Note: You will need this Password at STEP 42.

WriteFreely MySQL Synology NAS Set up 25

  • STEP 32

Your blog name should appear automatically. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 26

  • STEP 33

Your DDNS Address should appear automatically. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 27

  • STEP 34

Select to Enable or Disable Federation. I chose Enabled. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 28

  • STEP 35

Select Public for usage stats. This depends on your needs. I chose Public. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 29

  • STEP 36

Select Public for metadata privacy. This depends on your needs. I chose Public. Confirm by pressing Enter on your keyboard. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 30

  • STEP 37

Done. The MySQL database will be written.

WriteFreely MySQL Synology NAS Set up 31

  • STEP 38

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 39

On the left sidebar in Portainer, click Containers. Identify your WriteFreely instance, select it then click Restart. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 32

  • STEP 40

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 41

Now open your browser and type in your HTTPS/SSL certificate like this https://writefreely.yourname.synology.me that you have previously created at STEP 7. In my case it’s https://writefreely.mariushosting.synology.me If everything goes right, you will see the main WriteFreely page. At the top left click on the Menu then Log in. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 33

  • STEP 42

Type in your own Username and your own Password that you have created at STEP 30 and STEP 31, respectively. Click Login. Follow the instructions in the image below.

WriteFreely MySQL Synology NAS Set up 34

You can start to write on your WriteFreely blog!

WriteFreely MySQL Synology NAS Set up 35

  • STEP 43

If you need to modify something in the configuration of your WriteFreely, like opening user registration to all or preventing new user registration, or enabling or disabling federation, you can do it by going to the data folder that you have previously created at STEP 12 and opening the config.ini file. Note: to be able to open the config.ini file, you need to have installed Synology Text Editor on your NAS as per instructions at STEP 4.

WriteFreely MySQL Synology NAS Set up 36

Apply the changes you want, then save the file. Note: After you save the config.ini file, remember to restart the WriteFreely container like you did at STEP 39 to apply the changes.

WriteFreely MySQL Synology NAS Set up 37

Enjoy WriteFreely with MySQL!

Note: Find out how to update the WriteFreely container with the latest image.
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Sunday / January 29th, 2023 at 5:33 AM