Overview
Duckling provides comprehensive automation for zero manual intervention. All automation features are enabled by default and support multi-database operations.Features
Auto Sync
Incremental sync every 15 minutes (configurable)
Auto Backup
Daily local and S3 backups with retention policies
Auto Cleanup
Daily storage cleanup and maintenance
Auto Recovery
Health monitoring and auto-restart on failures
Endpoints
GET /automation/status
Get automation service status for a specific database. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)Whether automation service is active
Sync interval in minutes (default: 15)
Timestamp of last sync operation
Whether automatic backups are enabled
Whether health monitoring is active
POST /automation/start
Start automation service (sync, backup, cleanup, health monitoring). Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)Automation starts automatically on server boot if
AUTO_START_SYNC=true (default).POST /automation/stop
Stop automation service. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)POST /automation/backup
Trigger manual backup (local + S3 if configured). Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)- DuckDB database file (
duckling-{db}.db) - Metadata tables (watermarks, sync logs)
- S3 upload (if S3 is configured)
- Local:
data/backups/backup-{db}-{timestamp}/ - S3:
s3://{bucket}/{pathPrefix}/backup-{timestamp}.db.enc(if S3 enabled)
POST /automation/restore
Restore from latest local backup. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)POST /automation/cleanup
Trigger manual cleanup (VACUUM, WAL cleanup, old logs). Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)- DuckDB VACUUM (reclaim disk space)
- WAL file cleanup
- Old backup rotation (keeps last 7 days by default)
- Sync log cleanup (keeps last 90 days by default)
S3 Backup Endpoints
GET /api/backups
List all backups (local + S3) for a database. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)POST /api/backups/s3
Trigger immediate S3 backup. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)S3 backups are encrypted with AES-256-CTR if
encryption: 'client-aes256' is configured.POST /api/backups/s3/restore
Restore from a specific S3 backup. Authentication: Required Query Parameters:Database ID (defaults to
default if omitted)S3 object key of the backup to restore
Environment Configuration
Configure automation via environment variables:Automation Schedule
| Task | Default Frequency | Configurable |
|---|---|---|
| Incremental Sync | Every 15 minutes | SYNC_INTERVAL_MINUTES |
| Local Backup | Daily at midnight | BACKUP_INTERVAL_HOURS |
| S3 Backup | Daily at midnight | s3BackupIntervalHours (per database) |
| Cleanup | Daily at midnight | CLEANUP_INTERVAL_HOURS |
| Health Check | Every 60 seconds | Fixed |
Best Practices
- Enable S3 Backups - Configure S3 for disaster recovery (especially for large databases 200GB+)
- Monitor Logs - Check
/automation/statusregularly for failed operations - Test Restores - Periodically test backup restoration to verify integrity
- Adjust Intervals - Tune sync and backup intervals based on data change rate
- Use Encryption - Enable
client-aes256encryption for sensitive data in S3