Firefly III does not come with a built-in backup routine. Using your native OS tools is way more useful and faster.
The export function of Firefly III is not a backup mechanism
Make sure you grab the following and store it somewhere safe:
.envfile in the root of your installation or the exact command you've used to launch Firefly III.
- The entire database or database file (in
- All uploads from
The database can be exported using tools like phpMyAdmin or pgAdmin.
If you're running Firefly III in Docker, backup the following:
- The Docker variables you've used to launch the container (s), and especially the
- Any secrets you have used (database passwords).
- The two volumes used by Firefly III: "upload" and "db"
That way you have everything you need in case of problems.
Manual backup using Docker
To backup the database volume, you could run something like this.
Backup with the following command:
docker run --rm -v "firefly_iii_db:/tmp" -v "$HOME/backups/firefly:/backup" ubuntu tar -czvf /backup/firefly_db.tar /tmp
And restore with:
docker run --rm -v "firefly_iii_db:/recover" -v "$HOME/backups/firefly:/backup" ubuntu tar -xvf /backup/firefly_db.tar -C /recover --strip 1
A word of caution: Check that the volume exists before trying to back it up. If a named volume doesn't exist Docker will create an empty one, and the command will backup that empty volume. This wipes out the existing backup.
To get a better idea of how this works, see Docker's official documentation.
Automated backup using Docker
See GitHub issue #4270 for some hints.
Automated backup using a bash script and crontab
An installation of Firefly III installed using
docker-compose can be backed up using this script provided by GitHub user @dawid-czarnecki. The script will backup the database, capture the Docker volumes,
.env-file, and relevant Docker files. It will also backup the configuration of the Firefly III Data Importer if you installed it with the same
Copy the bafirefly-iii/docsckuper-script to the same location where your
.env files are located.
Create a cron job that will run regularly, like so. This will create the necessary backups in the
.tar file, named after the current date.
1 01 * * * bash /home/myname/backuper.sh backup /home/backup/$(date '+%F').tar
The same script can also restore the Docker configuration and the database, getting you up and running again. You can run this on the command line:
bash /home/myname/backuper.sh restore /home/backup/firefly-2022-01-01.tar