I have a simple script that will dump the database and prune older backups. This is run daily by a systemd timer.
#!/bin/bash BACKUP_LOCATION=/root/backups # Backup /usr/bin/docker exec -t ttrss-docker_db_1 pg_dumpall -c -U postgres | /usr/bin/xz > $BACKUP_LOCATION/ttrss_`date +%Y%m%d%H%M%S`.sql.xz # Prune backups older than 30 days /usr/bin/find $BACKUP_LOCATION -maxdepth 1 -name "ttrss_*.sql.xz" -type f -mtime +30 -delete
The systemd service:
# /etc/systemd/system/ttrss-backup.service [Unit] Description=Backup ttrss [Service] Type=oneshot ExecStart=/usr/local/bin/ttrss_backup.sh
The systemd timer:
# /etc/systemd/system/ttrss-backup.timer [Unit] Description=Timer to schedule backups for ttrss [Timer] OnCalendar=daily RandomizedDelaySec=30minutes Persistent=true [Install] WantedBy=timers.target
After I setup this backup system, the official docker-compose setup was changed to include an automatic back up feature. Since the machine this is hosted on has plenty of disk space, I leave them both enabled.