Updating Pleroma (on Debian, installed from source)

Before the first backup:

mkdir /var/cache/pleroma-backup
chown -R postgres:postgres /var/cache/pleroma-backup

Every time:

systemctl stop pleroma
cd /opt/pleroma
sudo -Hu postgres pg_dump -d pleroma --format=custom -f /var/cache/pleroma-backup/pleroma-20240505.pgdump
cp -r config/prod.secret.exs config/setup_db.psql uploads /var/cache/pleroma-backup
cd /var/cache/pleroma-backup
mkdir 20240505
mv pleroma-20240505.pgdump prod.secret.exs setup_db.psql uploads 20240505
systemctl start pleroma

Starting Pleroma at this point caused issues but seems to have been because of some malformed lines at the end of config/prod.secret.exs regarding frontends – I commented these out and then it worked. Of course, there’s no need to start Pleroma at this point because we’re about to stop it again, but probably worth checking that there’s no issue with starting the service before attempting to update it, for that very reason.

Check for the latest tagged release here; in this case it was v2.6.2.

cd /opt/pleroma
sudo -Hu pleroma git pull
sudo -Hu pleroma git checkout v2.6.2
sudo -Hu pleroma MIX_ENV=prod mix deps.get
systemctl stop pleroma
sudo -Hu pleroma MIX_ENV=prod mix ecto.migrate

This may take several minutes.

systemctl start pleroma