maphew

Install WriteFreely on NFSN

January 22, 2024

Recipe to install WriteFreely on Nearly Free Speech Net. Adpated from WriteFreely start guide and this forum thread. Posted to nfsn wiki.

NFSN website#

Login » Sites » Your WF Site

  • set Software Realm to “White”
  • set Server Type to “Kitchen Sink” (in order get Daemons and Proxies).

SSH#

Begin by verifying WF is available, download the WF release archive to get templates and assets, put the WF config and database into your protected directory. We're going to use sqlite db.

which writefreely

...should emit “/usr/local/bin/writefreely”

Download the latest release for MacOS. It probably doesn't matter which system though as  we're just after the templates and other resources.

cd ~/../protected
wget https://github.com/writefreely/writefreely/releases/download/v0.14.0/writefreely_0.14.0_macos_amd64.tar.gz
tar -xzvf writefreely_0.14.0_macos_amd64.tar.gz
cd writefreely

# delete the MacOS executable
rm ./writefreely

Settings#

writefreely config start

Use whatever values you want for ones not listed. Afterwards peruse config.ini for other things you might want to change that aren't part of the wizard.

Deployment Production, behind reverse proxy
Local port 8080 (or anything above 1024)
Database Sqlite
Filename writefreely.db (or mywf-blog.db or whatever)
Site type Single user blog
Public URL https://sitename.nfshost.com/ or https://yourdomain.org/(trailing slash, no port)

We generate keys as  WF errors out without them even though they're unecessary with external TLS, and then allow web server to read the keys.

writefreely keys generate
chgrp web keys keys/*
chmod g+r keys keys/*

NFSN website#

Site » select site : Daemons and Proxies

DAEMON

    tag = writefreely
    command line = /usr/local/bin/writefreely
    working directory = /home/protected/writefreely
    Run daemon as = web

PROXY

    protocol = HTTP
    base uri = /
    document root = /
    target port = 8080

File and directory permissions#

cd /home/protected/writefreely
# Recursively add files and dirs to Web group
chgrp -R web ./
# strip existing permissions for group and other
chmod -R g-rwx ./
chmod -R o-rwx ./
# Allow web user to read all files recursively
chmod -R g+r ./
# Allow web user to enter direcories
find ./ -type d -exec chmod g+x {} +
# Allow web user to create and write sqlite journalling files
chmod g+w ./
# Allow Web user to modfify the db
chmod g+w ./*.db

At this point you should be able to point a browser at https://sitename.nfshost.com or your domain name and login to WriteFreely. Leave off the port selected above, that's for internal communication.

Visit the NFSN Sites page to start/stop/restart etc. the daemon. For troubleshooting see:

/home/logs/daemon_writefreely.log

Cross posted to https://members.nearlyfreespeech.net/wiki/Applications/WriteFreely.

#nfsn #webadmin #install