Skip to main content

Lightweight SQLite WAL sync to S3/Tigris

Project description

walsync

Lightweight SQLite WAL sync to S3/Tigris.

Like Litestream but:

  • ~7MB binary (vs Litestream's runtime overhead)
  • Watch multiple databases at once
  • Minimal memory footprint (~5-10MB RSS)

Installation

cargo install walsync

Quick Start

# Watch databases and sync to S3
walsync watch db1.db db2.db -b s3://my-bucket/backups

# With Tigris endpoint
walsync watch app.db -b s3://my-bucket --endpoint https://fly.storage.tigris.dev

# Take immediate snapshot
walsync snapshot app.db -b s3://my-bucket

# List backed up databases
walsync list -b s3://my-bucket

# Restore database
walsync restore mydb -o restored.db -b s3://my-bucket

How It Works

Local:                          S3:
app.db                          /app/snapshots/20240110120000.db
app.db-wal  ────────────────►   /app/wal/00000001-20240110120001234.wal
           (file watcher)       /app/wal/00000001-20240110120005678.wal
                                /app/state.json
  1. Watch - Monitor WAL files for changes (inotify/kqueue)
  2. Sync - Upload new WAL frames to S3 incrementally
  3. Snapshot - Periodic full database snapshots (configurable interval)
  4. Restore - Download snapshot + replay WAL segments

Commands

walsync watch

Watch databases and continuously sync WAL changes.

walsync watch <DATABASES>... -b <BUCKET> [OPTIONS]

Options:
  --snapshot-interval <SECS>  Snapshot interval (default: 3600)
  --endpoint <URL>            S3 endpoint (for Tigris/MinIO)

walsync snapshot

Take an immediate snapshot.

walsync snapshot <DATABASE> -b <BUCKET>

walsync restore

Restore a database from S3.

walsync restore <NAME> -o <OUTPUT> -b <BUCKET>

Options:
  --point-in-time <ISO8601>  Restore to specific time

walsync list

List backed up databases.

walsync list -b <BUCKET>

Environment Variables

  • AWS_ACCESS_KEY_ID - AWS/Tigris access key
  • AWS_SECRET_ACCESS_KEY - AWS/Tigris secret key
  • AWS_ENDPOINT_URL_S3 - S3 endpoint (for Tigris/MinIO)
  • AWS_REGION - AWS region (default: us-east-1)

S3 Layout

s3://bucket/prefix/
├── dbname/
│   ├── snapshots/
│   │   ├── 20240110120000.db
│   │   └── 20240110130000.db
│   ├── wal/
│   │   ├── 00000001-20240110120001234.wal
│   │   ├── 00000001-20240110120005678.wal
│   │   └── ...
│   └── state.json
└── otherdb/
    └── ...

Use with Tenement/Slum

Perfect for backing up tenant SQLite databases:

# In your tenement deployment
walsync watch \
  /var/lib/ourfam/romneys/app.db \
  /var/lib/ourfam/smiths/app.db \
  /var/lib/ourfam/jones/app.db \
  -b s3://backups/ourfam \
  --endpoint https://fly.storage.tigris.dev

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

walsync-0.1.1.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

walsync-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file walsync-0.1.1.tar.gz.

File metadata

  • Download URL: walsync-0.1.1.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for walsync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8e1816def3a33ae749207fdb056bf1382bef1dd4c5cfbd36239a695edffec88e
MD5 ff21ea97e068e61a427f2181fd5781da
BLAKE2b-256 85de15cf16286c4fb2d29ef4acb16f57b7e596b03d2e3763309f207f73c5c88d

See more details on using hashes here.

File details

Details for the file walsync-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for walsync-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8c6b37c7b9696d9bf1835ed32694755536acd10fab123f583761170b5b3c20a
MD5 9c59f52d4c96c7cd03d48a809c8ac91b
BLAKE2b-256 2dfa7350a269e202d4a22e145636922c2e069abc2ce9fd92c5f3d24fd6d1815f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page