first commit
This commit is contained in:
127
README.md
127
README.md
@@ -1,2 +1,127 @@
|
||||
# compose-backup
|
||||
|
||||
# 🐳 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!
|
||||
|
||||
Reference in New Issue
Block a user