Why S3 Backups?
- Continuous replication: Changes are streamed to S3 as they happen
- Point-in-time recovery: Restore to any point in time
- Off-server storage: Survives server failures or data loss
- Low cost: S3-compatible storage is inexpensive
- Works with multiple providers: AWS S3, Backblaze B2, Cloudflare R2, MinIO, etc.
Configuration During Install
The install script prompts for S3 configuration. If you skipped this step, you can configure backups manually.Manual Configuration
Add S3 credentials to .env
Edit For AWS S3, use endpoint
/opt/dubly/.env and add:https://s3.amazonaws.com.For Backblaze B2, use endpoint like https://s3.us-west-001.backblazeb2.com.For Cloudflare R2, use endpoint like https://<account-id>.r2.cloudflarestorage.com.Update systemd service
Edit This wrapper script handles Litestream replication.
/etc/systemd/system/dubly.service and change the ExecStart line:Litestream Configuration File
The configuration lives in/opt/dubly/litestream.yml:
/opt/dubly/.env.
How the Backup Process Works
Initial Deployment (No Database)
When/opt/dubly/dubly.db doesn’t exist, the start script attempts to restore from S3:
-if-replica-exists flag makes this safe for first-time deployments (exits successfully if no backup exists).
Normal Operation
The service runs Dubly under Litestream supervision:- Starts the Dubly process
- Monitors the SQLite WAL (Write-Ahead Log) for changes
- Continuously uploads changes to S3
- Manages snapshot creation
What Gets Backed Up
Your S3 bucket will contain:- Snapshots: Full database backups at points in time
- WAL segments: Incremental changes between snapshots
- Generations: Track different deployment histories
Restoring From Backup
Restore to Current Server
Restore to New Server
Install Dubly without S3 prompts
Run the install script and skip S3 configuration, or manually add S3 credentials to
.env before starting.Monitoring Backups
Check Replication Status
View Litestream logs in the Dubly service output:Verify S3 Contents
List your S3 bucket to confirm files are being uploaded:Check Last Backup Time
Litestream embeds timestamp information in the WAL segment filenames. Recent segments indicate active replication.Cost Estimation
Dubly’s SQLite database is typically small (< 100MB for thousands of links). Example monthly costs:| Provider | Storage (100MB) | Requests | Total/month |
|---|---|---|---|
| AWS S3 | $0.002 | $0.01 | ~$0.01 |
| Backblaze B2 | $0.005 | Free | ~$0.01 |
| Cloudflare R2 | $0.015 | Free | ~$0.02 |
Backup Best Practices
- Use a dedicated S3 bucket for Dubly backups
- Enable S3 bucket versioning for extra protection
- Restrict S3 credentials to minimum required permissions
- Store S3 credentials securely (not in version control)
- Monitor for Litestream errors in service logs
S3 Provider Examples
AWS S3
Backblaze B2
Cloudflare R2
Troubleshooting
Litestream not starting
Check for missing environment variables:- Missing S3 credentials in
.env - Invalid endpoint URL
- Incorrect bucket permissions
Permission errors on S3
Your S3 credentials need these permissions:Restore fails with “replica not found”
This means no backup exists in S3 yet. Verify:- Litestream has been running long enough to upload initial snapshot
- S3 bucket name and path are correct
- S3 credentials are valid
Next Steps
Updating Dubly
Learn how to safely update your deployment
Configuration
Explore all environment variables