Marmot is a database backup tool that automatically backs up MySQL, PostgreSQL, and MongoDB to S3-compatible storage or local disk.
Supports AWS S3, Cloudflare R2, Backblaze B2, Wasabi, MinIO, and local-only mode for users who just need automated local backups with retention management.
| Version | Status | Channel | Description |
|---|---|---|---|
| v0.4.0 | Stable (Current) | Release | Current stable release |
Current Recommendation:
- Available version: Use v0.4.0
See RELEASES.md for our full release strategy and version compatibility.
- Release Status
- Features
- Quick Start
- Installation
- Supported Storage Providers
- Commands
- Configuration
- Backup Verification
- Database Management
- Environment Variables
- Development
- License
- Multi-Database Support: MySQL, PostgreSQL, and MongoDB
- Flexible Storage: Cloud (S3/R2/B2/Wasabi/MinIO) or Local-only mode
- Automatic Discovery: Scans Docker containers to auto-discover databases
- Scheduled Backups: Cron-based scheduling for automated backups
- Retention Management: Automatic cleanup of old backups (local mode)
- Encryption: AES-256-GCM encryption for secure backups
- Compression: Gzip compression to reduce storage costs
- Backup Verification: Validate backups without restoring
- Direct Storage: No hub or middleware required - backups go straight to your storage
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bashmarmot initThis interactive wizard will:
- Choose between Cloud storage (S3/R2/B2/Wasabi/MinIO) or Local-only mode
- For cloud: Ask for provider credentials (once, securely stored)
- For local: Configure retention and disk space management
- Discover databases in Docker containers
- Generate encryption keys
- Test the connection (cloud mode)
# Backup all configured databases
marmot backup --all
# Or backup a specific database
marmot backup --db my-postgresmarmot init now starts the daemon automatically in the background so scheduled backups begin right away.
# Check daemon and storage status
marmot status
# Check daemon process only
marmot daemon status
# Stop/restart daemon
marmot daemon stop
marmot daemon restart
# Install and start as a system service (recommended)
marmot service installLatest Stable (Recommended for Production):
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bashSpecific Version:
# Install a specific stable version
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bash -s v0.2.0
# View install help
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bash -s --helpPre-release Versions (For Testing Only):
# Install alpha/beta/rc version (requires confirmation)
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bash -s v0.5.0-alpha
# Skip confirmation (use with caution)
curl -fsSL https://raw.githubusercontent.com/pol-cova/marmot-cli/main/install.sh | bash -s v0.5.0-alpha --yesSee RELEASES.md for our release channel strategy and versioning.
git clone https://github.com/pol-cova/marmot-cli.git
cd marmot
make build
./bin/marmot --versionThe version is automatically determined from git tags:
- If on a tagged release: shows tag (e.g.,
v0.3.0) - If on a commit after tag: shows tag+commits (e.g.,
v0.3.0-5-gabc123) - If no tags exist: shows
dev
Install system-wide:
sudo make installmake build-linux # Linux AMD64
make build-darwin # macOS (Intel and Apple Silicon)
make build-windows # Windows AMD64For users who just need automated local backups with retention management:
marmot init
# Select: local
# Configure backup directory (optional, defaults to ~/.local/share/marmot/backups)
# Set retention days (default: 30, 0 = unlimited)
# Set minimum free space warning (default: 10 GB)Benefits:
- No cloud credentials needed
- Zero storage costs
- Data never leaves the server
- Automatic retention/cleanup with
marmot cleanup
Note: Backups are stored locally only - ensure you have proper disaster recovery procedures.
marmot init
# Select: r2
# Enter: https://<account-id>.r2.cloudflarestorage.com
# Enter: bucket name
# Enter: access key from R2 API tokens
# Enter: secret key from R2 API tokensmarmot init
# Select: s3
# Enter: bucket name
# Enter: region (e.g., us-east-1)
# Enter: access key ID
# Enter: secret access keymarmot init
# Select: b2
# Enter: https://s3.us-west-004.backblazeb2.com
# Enter: bucket name
# Enter: key ID
# Enter: application keymarmot init
# Select: wasabi
# Enter: bucket name
# Enter: access key
# Enter: secret key
# Region defaults to us-east-1marmot init
# Select: minio
# Enter: http://localhost:9000 (or your MinIO endpoint)
# Enter: bucket name
# Enter: access key
# Enter: secret keymarmot init
# Select: other
# Enter: provider name
# Enter: S3-compatible endpoint URL
# Enter: bucket name
# Enter: access key
# Enter: secret key| Command | Description |
|---|---|
marmot init |
Interactive setup wizard |
marmot backup [db-id] |
Perform manual backup |
marmot backup --all |
Backup all databases |
marmot start |
Start backup daemon |
marmot restore |
Restore from backup |
marmot verify |
Verify backup integrity |
marmot status |
Show daemon and storage status |
marmot cleanup |
Clean up old local backups (local mode) |
| Command | Description |
|---|---|
marmot db list |
List configured databases |
marmot db add |
Add a database manually |
marmot db remove |
Remove a database |
| Command | Description |
|---|---|
marmot decrypt |
Decrypt backup file locally |
marmot queue |
Manage upload queue |
marmot service |
Systemd service management |
marmot key export |
Export encryption key |
marmot key import |
Import encryption key |
Configuration is stored in ~/.config/marmot/config.yaml (Linux/macOS) or %APPDATA%\marmot\config.yaml (Windows).
storage_type: local
local:
path: /backup/marmot # Custom backup directory (optional)
retention_days: 30 # Keep backups for 30 days (0 = unlimited)
min_free_space_gb: 10 # Warn if less than 10 GB free
databases:
- id: prod-postgres
type: postgres
container_id: abc123def456
name: myapp
user: postgres
password: secret
schedule: "0 2 * * *" # Daily at 2 AM
enabled: trueRetention Management:
# Preview what would be cleaned up
marmot cleanup --dry-run
# Clean up old backups
marmot cleanup
# Skip confirmation
marmot cleanup --forcestorage:
provider: r2
endpoint: https://<account>.r2.cloudflarestorage.com
bucket: my-backups
access_key: <access-key-id>
secret_key: <secret-access-key>
server_id: web-01
prefix: backups
databases:
- id: prod-postgres
type: postgres
container_id: abc123def456
name: myapp
user: postgres
password: secret
schedule: "0 2 * * *"
enabled: truestorage:
provider: s3
bucket: my-backup-bucket
region: us-east-1
access_key: AKIAXXXXXXXXXXXXXXXX
secret_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
server_id: web-01
databases:
- id: prod-mysql
type: mysql
dsn: "mysql://user:pass@localhost:3306/mydb"
schedule: "0 */6 * * *"
enabled: trueAll configuration can be set via environment variables (useful for CI/CD):
export MARMOT_STORAGE_TYPE=local
export MARMOT_LOCAL_PATH=/backup/marmot
export MARMOT_LOCAL_RETENTION_DAYS=30
export MARMOT_LOCAL_MIN_FREE_SPACE_GB=10export MARMOT_STORAGE_TYPE=s3
export MARMOT_S3_PROVIDER=r2
export MARMOT_S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com
export MARMOT_S3_BUCKET=my-backups
export MARMOT_S3_ACCESS_KEY=<access-key>
export MARMOT_S3_SECRET_KEY=<secret-key>
export MARMOT_S3_SERVER_ID=web-01
export MARMOT_S3_PREFIX=backupsThe verify command validates backup integrity without modifying your database:
# Verify from storage by backup ID
marmot verify s3://my-bucket/web-01/2024/01/15/mydb-1705312800.enc
# Verify latest backup for a database
marmot verify --db prod-mongo --latest
# Verify local file
marmot verify --file ./backup.enc
# Summary only
marmot verify s3://my-bucket/... --format summaryWhat it checks:
- ✅ File integrity (decrypts successfully)
- ✅ Structure validation (valid dump format)
- ✅ Table/collection counts
- ✅ Row/document counts per structure
- ✅ Sample data preview (3 records each)
MySQL via Docker:
marmot db add --type mysql --id prod-mysql \
--container mysql-container \
--name mydb --user root --password secret \
--schedule "0 2 * * *"PostgreSQL via DSN:
marmot db add --type postgres --id prod-pg \
--dsn "postgres://user:pass@localhost:5432/mydb" \
--schedule "0 3 * * *"MongoDB via DSN:
marmot db add --type mongo --id prod-mongo \
--dsn "mongodb://root:secret@localhost:27017/admin" \
--schedule "0 4 * * *"Backups are organized in your bucket as:
[prefix/]<server-id>/YYYY/MM/DD/<database-name>-<timestamp>.enc
Example:
backups/web-01/2024/01/15/myapp-1705312800.enc
backups/web-01/2024/01/15/analytics-1705316400.enc
Each object includes metadata:
server-id: The server that created the backupdatabase-name: The database that was backed uptimestamp: ISO 8601 timestamp of the backup
make version # Show current version info
make build # Build binary (auto-detects version from git tags)
make test # Run tests
make test-coverage # Generate coverage report
make lint # Run linterVersion Management:
- Version is automatically set from git tags at build time
- Create a release:
git tag -a v0.3.0 -m "Release v0.3.0" && git push origin v0.3.0 - The Makefile uses
git describe --tags --alwaysto get the version - Commit hash and build time are also embedded in the binary
- Encryption: All backups are encrypted with AES-256-GCM before upload
- Key Management: Encryption keys are stored locally at
~/.config/marmot/key - Backup Your Key: Run
marmot key exportand store the key securely offline- Without this key, backups cannot be decrypted
- Store it in a password manager or secure location outside your servers
- Credentials: Storage credentials are stored in config with 0600 permissions
- No Data Leakage: Backups go directly to your S3 bucket - no middleware
We welcome contributions! See Contributing Guidelines.
This project adheres to a Code of Conduct.
MIT License - see LICENSE file.
- GitHub Issues: github.com/pol-cova/marmot-cli/issues
- CLI Help:
marmot --help - Command Help:
marmot <command> --help