# ๐Ÿณ Compose Backup & Restore Tool A simple backup & restore tool for Docker Compose projects, including volume data. Ideal for migrating projects or creating point-in-time snapshots of your stack. --- ## ๐Ÿ“ฆ Features - ๐Ÿ” Full backup of your Docker Compose project folder - ๐Ÿ’พ Archives all named Docker volumes (excluding bind-mounts) - ๐Ÿง  Automatic project detection and naming - ๐Ÿง™ Interactive restore menu with project/version selection - โ˜๏ธ Stores backups in `~/.compose-backup` - ๐Ÿ Uses Python + Docker + Bash (no external services) --- ## ๐Ÿ“ Project Structure ``` compose-backup/ โ”œโ”€โ”€ bin/ โ”‚ โ”œโ”€โ”€ compose-backup # Bash launcher (patched on install) โ”‚ โ””โ”€โ”€ compose-restore # Bash launcher (patched on install) โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ backup.py # Backup logic โ”‚ โ””โ”€โ”€ restore.py # Restore logic โ”œโ”€โ”€ requirements.txt โ”œโ”€โ”€ install.sh # Install script (creates venv & installs commands) โ””โ”€โ”€ README.md ```` --- ## ๐Ÿš€ Installation ```bash git clone https://your.repo/compose-backup.git cd compose-backup ./install.sh ```` This will: * Set up a virtual environment in `.venv` * Install required Python packages * Patch & install `compose-backup` and `compose-restore` to `/usr/local/bin` > ๐Ÿ”’ Youโ€™ll be prompted for your sudo password to copy binaries system-wide. --- ## ๐Ÿ” Usage ### ๐Ÿ“ค Backup From inside a folder containing your `docker-compose.yml`: ```bash compose-backup ``` Creates a full backup (project files + named volumes) into: ``` ~/.compose-backup/ โ””โ”€โ”€ myproject_backup_20250711_183012.tar.gz ``` --- ### ๐Ÿ“ฅ Restore To restore a backup, anywhere on your system: ```bash compose-restore ``` * Step 1: Choose project * Step 2: Choose version * Step 3: Project files are restored to your current folder * Step 4: Volumes are restored via temporary containers --- ## ๐Ÿงผ Uninstall To remove installed commands: ```bash sudo rm /usr/local/bin/compose-backup /usr/local/bin/compose-restore ``` (Optional) remove `.venv` and the repo folder. --- ## ๐Ÿ›  Requirements * Docker * Python 3.8+ * Linux or macOS (tested on Ubuntu) --- ## ๐Ÿ“Œ Notes * Only **named volumes** (declared under `volumes:` in your `docker-compose.yml`) are backed up. * **Bind mounts** like `./data:/app/data` are not included. * The tool does **not** stop running containers before backup โ€” ensure consistency manually if needed. --- ## ๐Ÿค License MIT โ€” feel free to fork and improve! --- ## ๐Ÿ‘จโ€๐Ÿ’ป Author Built by gmarth โ€” Contributions welcome!