Documentation
¶
Overview ¶
Example: Litestream Library Usage with S3 and Restore-on-Startup
This example demonstrates a production-like pattern for using Litestream: - Check if local database exists - If not, restore from S3 backup (if available) - Start replication to S3 - Graceful shutdown
Environment variables:
- AWS_ACCESS_KEY_ID: AWS access key
- AWS_SECRET_ACCESS_KEY: AWS secret key
- LITESTREAM_BUCKET: S3 bucket name (e.g., "my-backup-bucket")
- LITESTREAM_PATH: Path within bucket (e.g., "databases/myapp")
- AWS_REGION: AWS region (default: us-east-1)
Run: go run main.go
Click to show internal directories.
Click to hide internal directories.