Questions about updating writefreely binary

Hi,
when there is new update do i need to delete all files (including db, static files) or do i just swap the binary with it’s new version? (i know it sound dumb i just want to make sure) and if yes, would not my blogs get deleted too?


Also here is a script i wrote to update writefreely so if you interested feel free to use it:

#!/bin/sh
killall writefreely
curl -s https://api.github.com/repos/writefreely/writefreely/releases/latest \
| grep "linux_amd64.tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -O writefreely.tar.gz -qi -
tar --strip-components=1 -zxf writefreely.tar.gz
chmod +x writefreely
./writefreely 2>&1 1>/dev/null &
rm writefreely.tar.gz

Hey @esmailelbob, you’ll only want to replace your existing files with the ones in the archive. This includes the binary, static assets, and templates (in both the templates and pages directories).

That should cover everything. But in particular, you’ll want to be sure you always preserve these files across upgrades:

  • Configuration files (*.ini)
  • Databases and database files (*.db)
  • Your encryption keys (keys directory)

To add to this, here’s an upgrade script I use for existing WriteFreely instances, which also handles any new database and encryption key migrations:

tar -xvf writefreely.tar.gz --exclude='keys' --strip-components=1

./writefreely db migrate
sudo ./writefreely keys generate

(Not sure if the --exclude='keys' part is needed, though)

1 Like