After I nuked my mastodon instance in December of 2023, something that took me 3 months to recover, I decided to implement a backup solution for this worst case scenarios.
The Evolution of My Infrastructure
It is 2026 now and decided to update the outdated guide and add a configurator too to help you backup your projects more easier.
In November 2025, I drastically overhauled my deployment stack. If you haven't seen it yet, check out A Production-Ready Laravel Architecture with Traefik and FrankenPHP. It is my safest, most performant stack yet, utilizing Laravel Octane and FrankenPHP.
My most safe and performant architecture. Consult it for an updated insight.
But backing up data is only half the battle. You also need to know the exact moment things start going sideways before your customers do.
To bridge that gap, I now pair my infrastructure with my premium New Relic Setup Package. For a single flat price, I completely instrument your stack. This covers #Laravel APM, host metrics, system logs, and Traefik dashboard visibility. I hand over The Foundation Kit runbook so you actually own your monitoring. I actively use this exact setup within my own LaraPlugins directory.
With deep observability taken care of, let's look at the final piece of the puzzle. Securing our persistent data automatically.
Idea
Initially, I wanted an open-source backup tool that met a heavy wishlist:
- Connect to multiple databases concurrently.
- Simple, one-click restore functionality.
- A beautiful web UI to manage tasks.
- 100% Docker-based.
Finding an open-source tool check-marking every single requirement proved nearly impossible. The UI requirement was the hardest to find.
Software selected
After reducing the requirements to the most important ones, I selected this OSS project called docker-db-backup from Dave Conroy.
My original setup bound one container per database. A major recent update completely refactored how it functions. It now introduces native multi-job configurations using prefixed environment variables like DB01_ and DB02_. It can target multiple types of database servers simultaneously. This includes MySQL, PostgreSQL, MongoDB, and Redis. It seamlessly ships dumps to local storage, AWS S3, or Azure.

Production Deployment & Config
Integrating this into a production-ready stack is incredibly straightforward. You simply drop the service into the docker-compose.yml file where your database sits.
Here is how I configure it inside my blog infrastructure under a shared Traefik network proxy setup:
services:
db_backup:
container_name: db_backup
image: nfrastack/container-db-backup:latest
depends_on:
- mysql
volumes:
- ../path/to/your/backup/folder/:/backup
environment:
# Global Container Options
- DEBUG_MODE=FALSE
- BACKUP_JOB_CONCURRENCY=2
# Job 1: Ghost Production MySQL
- DB01_TYPE=mysql
- DB01_HOST=ghost_mysql
- DB01_NAME=${DATABASE__CONNECTION__DATABASE}
- DB01_USER=root
- DB01_PASS=${DATABASE__CONNECTION__PASSWORD}
- DB01_BACKUP_INTERVAL=720 # Every 12 hours (12 * 60)
- DB01_CLEANUP_TIME=72000 # Keep history for 50 days
- DB01_CHECKSUM=SHA1
- DB01_COMPRESSION=GZ
- DB01_SPLIT_DB=TRUE
restart: always
networks:
- traefik
networks:
traefik:
external: true
name: traefikNaming of env variables update to reflect the new naming convention.
If you need different configs or databases, feel free to check them here https://github.com/nfrastack/container-db-backup (updated link from 2026 onward)
Finally, in my config, I back files in a directory relative to the parent folder.
I do not recommend keeping the on server backup folder long term. a better strategy is to use the native s3 integration of the service or mount external filesystem and point the path to there. Keeping the backups on the same servers can incur disk storage space exaustion and without proper monitoring can bring down your services. if you want to ensure something like that never happens feel free to hire me for putting up a monitoring system for your company while you focus on the core money making business: https://danielpetrica.com/newrelic/
I hope you found this short article a little helpful. I'll extend it to include more examples and configs once I go through them. If you have any advice or question, please use the comment section.
Database Backup Configurator
Configure multiple database engines dynamically. This tool generates ready-to-use Docker Compose variables and a separate .env file to keep your production credentials clean and structured.
Global Settings
Database Backup Jobs ({{ jobs.length }})
+ Add Database{{ activeTab === 'yaml' ? generatedYaml : generatedEnv }}
Daniel PetricaDaniel, Andrei-Daniel Petrica