Back up your Funkwhale instance
Before performing big changes, we recommend you back up your database and media files. Follow the instructions in this guide to back up your instance.
Back up your database.
sudo -u postgres -H pg_dumpall -c funkwhale > /path/to/your/backup/dump_`date +%d-%m-%Y"_"%H_%M_%S`.sqlStop the running containers:
docker compose downDump the database to a backup file:
docker compose up postgres -d docker compose run --rm postgres pg_dump -U postgres postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Back up your media files. In this example we use rsync to back up the files.
rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music
rsync -avzhP /srv/funkwhale/data/media /path/to/your/backup/media rsync -avzhP /srv/funkwhale/data/music /path/to/your/backup/music
Back up your configuration files.
rsync -avzhP /srv/funkwhale/config/.env /path/to/your/backup/.envrsync -avzhP /srv/funkwhale/.env /path/to/your/backup/.env
If you are performing regular backups, you may need deduplication and compression to keep the size down. In this case, a tool like borg is more appropriate.
Restore a backup
Restore your files
To restart your files, do the following:
Rename your current file directories.
mv /srv/funkwhale/data/media /srv/funkwhale/data/media.bak mv /srv/funkwhale/data/music /srv/funkwhale/data/music.bak
Restore your backed-up files to the original directories.
mv /path/to/your/backup/media /srv/funkwhale/data/media mv /path/to/your/backup/music /srv/funkwhale/data/music
Restore the database
To restore your database, do the following:
Restore your database backup:
sudo -u postgres psql -f /path/to/your/backup/dump.sql funkwhaleRun the
funkwhale-manage migratecommand to set up the database.cd /srv/funkwhale venv/bin/funkwhale-manage migrate
Restore your database backup.
docker compose run --rm -T postgres psql -U postgres postgres < "/path/to/your/backup/dump.sql"Run the
funkwhale-manage migratecommand to set up the database.docker compose run --rm api funkwhale-manage migrateRestart the services.
docker compose up -d