Update WriteFreely server instance

Today 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.

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/src.

After sources are retrieved change directory to ~/go/src/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

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.

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 😎