Update WriteFreely server instance

On July 2nd WriteFreely v.0.10 was released with two little commits by me: Lithuanian translation and lessc installation fix for CentOS – so proud to be listed among contributors 😊 To celebrate it I'm posting quick guide how to update WriteFreely instance when building binary from source.


This guide is tested with following version of WriteFreely: 0.11.2 (2019-12-26).

1. Backup

As always, use mysqldump to backup your database and preferably entire home directory of user running WriteFreely.

2. Stop system service

systemctl stop writefreely

At this point Nginx will start returning Bad gateway error to visitors.

3. Pull sources

Because I use my forked repository, I retrieve sources by using this command:

go get -d -u -v code.gyt.is/writefreely

Updated sources will be available in your user's home GOPATH, run below command to know:

echo $GOPATH

In my case it is ~/go.

After sources are retrieved change directory to ~/go/src/code.gyt.is/writefreely.

4. Build

Don't forget to ensure Go modules are enabled otherwise build will fail on sitemap.go as described in issue #93. So before building run:

export GO111MODULE=on

And initiate build process:

make build   # Compile the application

5. Run database migration

Might not be always necessary (check release notes) but better run database migration:

./cmd/writefreely/writefreely  --migrate

6. Initiate installation

make install

At this point interactive wizard will come up to update configuration. Don't worry – you won't need to re-enter MySQL credentials – they will be pre-filled. Just make sure to select WriteFreely modes correctly – “Production behind proxy”, “Multiuser” and so on. It might be good way to improve this wizard to read those values as well from config file.

7. Build interface

To build templates and CSS, run:

make ui # Generates CSS (run this whenever you update your styles)

Note – lessc runs fine with CentOS starting v.0.10 (my pull request there 😊).

8. Run binary

Run binary with”

make run

This will copy writefreely binary to to your GOBIN path.

When upgrading to v0.11.1 on CentOS I've got this error:

[user@server writefreely]$ make run
go-bindata -pkg writefreely -ignore=\\.gitignore -debug -tags="!wflib" schema.sql sqlite.sql
go install -ldflags="-X 'github.com/writeas/writefreely.softwareVer=`git describe | cut -c 2-`'" -tags='sqlite' ./...
writefreely --debug
make: writefreely: Command not found
make: *** [run] Error 127

Will need to take a look at make script. Anyway to check executable I ran below:

./cmd/writefreely/writefreely  --debug

9. Start system service

systemctl start writefreely

At this point you should have #writefreely running fine and #nginx reverse-proxying to it successfully.

Note – it's always a good idea to ensure your WriteFreely service runs on dedicated system user.

Read more #server tips on my blog and don't forget to toot me @gytis@mastodon.lt!

Happy lightweight federated blogging 😎


My name is Gytis Repečka, I am Solution Architect and data professional. I enjoy using, promoting and contributing to open source software and love communicating about tech to both advanced and non-tech people. Visit Inretio for consulting services. Comment by mentioning me @gytisrepecka@social.gyt.is on Fediverse.