Durable SQLite directly on S3, R2, and Laravel Cloud Object Storage.
- No sidecar.
- No proxy.
- No Postgres.
An in-process SQLite VFS for Laravel for Rust. Your app keeps its sub-millisecond local reads; every commit lands in your bucket as an immutable, fenced, optionally encrypted object.
One line in main.rs.
Zero changes to your queries.
.with_litebucket() plugs a SQLite VFS into laravel-rust. Migrations, db::query!, transactions and Route Model Binding work unchanged; the database simply lives in your bucket.
- Configured from
FILESYSTEM_*,AWS_*orLITEBUCKET_* - Survives redeploys, hibernation and container stops
- Pairs with tenanted.dev for a database per tenant
use std::process::ExitCode;
use laravel_litebucket::prelude::*;
fn main() -> ExitCode {
laravel::Application::configure()
.with_litebucket()
.with_routing(|routing, _| {
routing.health("/up");
routing.routes(|route| {
route.get("/posts", list_posts);
route.post("/posts", create_post);
});
})
.run()
}use laravel_litebucket::prelude::*;
laravel::Application::configure()
.with_litebucket_using(|b| {
b.sync_mode(SyncMode::Batched)
.disk_cache_mb(64)
.write_lease(true)
.compact_every(32);
})
.with_routing(|routing, _| { /* ... */ })
.run()# Make LiteBucket the process-default SQLite VFS
LITEBUCKET_VFS=1
LITEBUCKET_PREFIX=prod/main
# Bucket credentials are discovered automatically from
# LITEBUCKET_*, S3_*, FILESYSTEM_* (Laravel Cloud) or AWS_* variables.Open a multi-GB database without downloading it. Pages arrive on demand.
If-None-Match: *Each commit is a create-only write. Two writers can't both win a transaction.
Encrypted before upload, with a derived key per tenant.
Query any recent commit. Fork production inside the bucket.
Up and running in one line.
Add the crate, call .with_litebucket(), attach a bucket. Your existing queries, transactions and migrations now run on durable object storage.
Install
cargo add laravel-litebucket
# Optional: the standalone ops CLI
cargo install litebucket
# Optional: coding-agent skill (version-matched docs + rules)
npx skills@latest add cole-robertson/litebucket --skill laravel-litebucketEnable it
Import the WithLiteBucket trait and add one line to Application::configure():
use std::process::ExitCode;
use laravel_litebucket::prelude::*;
fn main() -> ExitCode {
laravel::Application::configure()
.with_litebucket()
.with_routing(|routing, _| {
routing.health("/up");
routing.routes(|route| {
route.get("/posts", list_posts);
route.post("/posts", create_post);
});
})
.run()
}.with_litebucket() registers a service provider that:
- Always registers
litebucketas a named SQLite VFS, so explicit?vfs=litebucketURLs work next to a central Postgres or local database. - With
LITEBUCKET_VFS=1, also makes it the process-default SQLite VFS, solaravel::db::query!, transactions and migrations run against the bucket. If no default connection is configured, it adds one. - Registers the 11
sqlite:*Artisan commands. - Installs a
SIGTERMhook that flushes every open database and releases its write lease before the container exits. - Prepends
WriteForwardingMiddlewarewhenLITEBUCKET_ADVERTISE_ADDRis set.
Without LITEBUCKET_VFS, local SQLite connections get production pragmas instead (WAL, synchronous = NORMAL, busy_timeout = 5000, foreign_keys = ON). Postgres and MySQL connections are never touched.
Customize fluently
Prefer code over env vars? .with_litebucket_using hands you a LiteBucketBuilder. It starts from the environment, so anything you don't set keeps its env value or default.
use laravel_litebucket::prelude::*;
laravel::Application::configure()
.with_litebucket_using(|b| {
b.sync_mode(SyncMode::Batched)
.disk_cache_mb(64)
.write_lease(true)
.compact_every(32);
})
.with_routing(|routing, _| { /* ... */ })
.run()| Builder method | Default | What it controls |
|---|---|---|
sync_mode(SyncMode) | Batched | Batched or Strict commits. Env: LITEBUCKET_SYNC_MODE. |
write_lease(bool) | true | Fenced single-writer lease in write_lock.json. Env: LITEBUCKET_WRITE_LEASE. |
disk_cache_mb(usize) | 64 | L2 NVMe page cache budget; 0 disables. Env: LITEBUCKET_DISK_CACHE_MB. |
refresh_interval_ms(u64) | 500 | Background catch-up interval for readers. Env: LITEBUCKET_REFRESH_MS. |
compact_every(u64) | 32 | Auto-compact into snapshot chunks every N transactions; 0 disables. Env: LITEBUCKET_COMPACT_EVERY. |
shared_pool(bool) | true | Share L1/L2 caches across pooled connections in one process. |
default_vfs(bool) | env | Force the process-default VFS on or off, ignoring LITEBUCKET_VFS. |
write_forwarding(bool) | env | Force write forwarding on or off. On by default when LITEBUCKET_ADVERTISE_ADDR is set. |
write_forwarding_prefix(..) | LITEBUCKET_PREFIX | Scope write forwarding to one database prefix. |
without_shutdown_flush() | flush on | Skip the SIGTERM flush listener. |
Connect a bucket
# Make LiteBucket the process-default SQLite VFS
LITEBUCKET_VFS=1
LITEBUCKET_PREFIX=prod/main
# Bucket credentials are discovered automatically from
# LITEBUCKET_*, S3_*, FILESYSTEM_* (Laravel Cloud) or AWS_* variables.LiteBucket reads S3 settings from the first non-empty variable in each row, so Laravel Cloud Object Storage, Cloudflare R2 and AWS S3 work without renaming anything:
| Setting | Looked up in order | Fallback |
|---|---|---|
| Endpoint | LITEBUCKET_ENDPOINT, S3_ENDPOINT, LITESTREAM_ENDPOINT, FILESYSTEM_ENDPOINT, FILESYSTEM_URL, AWS_ENDPOINT, AWS_ENDPOINT_URL_S3, AWS_ENDPOINT_URL, AWS_URL | required |
| Bucket | LITEBUCKET_BUCKET, S3_BUCKET, LITESTREAM_BUCKET, FILESYSTEM_BUCKET, AWS_BUCKET | required |
| Region | LITEBUCKET_REGION, S3_REGION, FILESYSTEM_REGION, AWS_DEFAULT_REGION, AWS_REGION | auto for R2 and Laravel Cloud, else us-east-1 |
| Access key | LITEBUCKET_ACCESS_KEY_ID, S3_ACCESS_KEY_ID, LITESTREAM_ACCESS_KEY_ID, FILESYSTEM_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID | required |
| Secret key | LITEBUCKET_SECRET_ACCESS_KEY, S3_SECRET_ACCESS_KEY, LITESTREAM_SECRET_ACCESS_KEY, FILESYSTEM_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY | required |
| Path-style | LITEBUCKET_FORCE_PATH_STYLE, S3_FORCE_PATH_STYLE, FILESYSTEM_USE_PATH_STYLE_ENDPOINT, AWS_USE_PATH_STYLE_ENDPOINT | on, except for *.amazonaws.com |
Then prove your bucket supports everything LiteBucket relies on: create-only writes, compare-and-swap, and range reads.
cargo run -- sqlite:doctorLaravel Cloud auto-setup (zero Postgres, zero disk)
Deploying on Laravel Cloud takes two variables and zero manual S3 credentials:
- Attach a Laravel Cloud Object Storage (R2) bucket to your environment. Laravel Cloud injects
FILESYSTEM_ENDPOINT,FILESYSTEM_BUCKET,FILESYSTEM_ACCESS_KEY_ID,FILESYSTEM_SECRET_ACCESS_KEYandFILESYSTEM_REGIONautomatically — LiteBucket discovers all of them with zero renaming. - Set two environment variables:
Laravel Cloud Environment LITEBUCKET_VFS=1 LITEBUCKET_ENCRYPTION_KEY=pass:your-strong-secret-passphrase - Wire hybrid strict-central + batched-tenant storage so local dev and
cargo teststay on plain local SQLite while Laravel Cloud runs 100% durable on R2:Real-world Laravel Cloud setup // src/config/database.rs — strict zero-RPO commits for central users & orgs let central_url = if env.get::<String>("LITEBUCKET_VFS").as_deref() == Ok("1") { laravel_litebucket::database_url_strict("central/main") } else { "sqlite://storage/database/central.sqlite3?mode=rwc".to_owned() }; // src/app.rs — 1-line R2 tenant DBs when LITEBUCKET_VFS=1, local SQLite in dev/tests laravel::Application::configure() .with_litebucket() .with_tenancy_using(|t| { t.litebucket_from_env() .central_connection("central") .auto_create(false); })
That exact setup powers demo.litebucket.dev on Laravel Cloud — zero database service, zero persistent volume, ~1 s cold-pod hydration from R2 after container stop/start.
URL & runtime helpers
| Helper | What it returns / does |
|---|---|
database_url("app/main") | Builds a sqlx-sqlite-compatible LiteBucket URL using your configured defaults. |
database_url_strict("central/main") | Same, pinned to sync=strict so every commit is durable in the bucket before returning (ideal for auth/billing/central DBs). |
tenanted_database_url("tenants/{tenant}/main") | Per-tenant URL template with explicit prefix, write lease and tenant_key_id={tenant} (wired automatically by t.litebucket()). |
flush_db().await / flush_all_open_dbs() | Force an immediate flush of staged Batched commits to the bucket before responding or shutting down. |
with_retry(3, || async { … }) | Retries transient SQLITE_BUSY / 412 contention errors in Strict multi-writer mode. |
write_owner_addr() / write_owner_addr_for(prefix) | Returns the private URL of the replica holding the write lease, or None when local. |
SQLite, with the bucket as its disk.
LiteBucket is a SQLite VFS that runs inside your process. SQLite asks for pages; LiteBucket serves them from memory, local NVMe, or the bucket, and ships every commit as an immutable object.
Reads: lazy 4 KB pages
Opening a database doesn't download it. LiteBucket reads the manifest, then fetches only the 4 KB pages SQLite actually touches, using HTTP Range GETs and coalescing sequential runs. A multi-GB database is queryable after a couple of round trips to the bucket.
- L1 (RAM): a bounded LRU of pages (1,024 pages by default,
LITEBUCKET_CACHE_PAGES), shared across pooled connections. - L2 (NVMe): a 64 MB ring on local disk. Every slot carries
key_hash · offset · CRC32C, so after aSIGKILLmid-write a torn or stale slot is detected and refetched from the bucket, never served.
Writes: Batched or Strict
SyncMode::Batched default
COMMIT lands in an in-memory staging buffer and wakes the background flusher immediately via a Condvar. Staged pages ship as one LTX frame. Flushes also happen at 64 staged pages, on flush_db(), on connection close, and on SIGTERM.
SyncMode::Strict
Every COMMIT uploads its LTX frame with If-None-Match: * before returning. Nothing acknowledged is lost, even on SIGKILL. Set LITEBUCKET_SYNC_MODE=strict.
Batched mode survives deploys, stops and hibernation because SIGTERM drains the buffer. A hard SIGKILL or power loss can drop commits that were still staged. When a single write must be durable before you respond, flush just that one:
use laravel::db;
db::query!("INSERT INTO payments (order_id, cents) VALUES ({order_id}, {cents})")
.insert()
.await?;
// Durable in the bucket before we respond. Everything else stays sub-millisecond.
laravel_litebucket::flush_db().await?;Fencing: no split-brain
Each commit is written to ltx/{txid}.ltx with If-None-Match: *. S3 lets exactly one writer create a given key, so two containers can never both commit transaction 42. The loser gets 412 Precondition Failed and catches up. The write lease in write_lock.json moves with If-Match ETag compare-and-swap, so during a rolling deploy the old container drains, releases the lease, and the new one takes over.
sqlite:doctor checks that your bucket really enforces both conditions before you trust it with data. With several Strict writers, wrap contended writes in with_retry:
use laravel_litebucket::with_retry;
// Strict mode with several writers: on SQLITE_BUSY / 412 it catches up and retries.
with_retry(3, || async {
db::query!("UPDATE counters SET n = n + 1 WHERE id = 1").statement().await
})
.await?;Bucket layout
Every 32 transactions (compact_every) history is compacted into snapshot chunks. Untouched chunks are reused, and frames outside the retention window are garbage-collected.
One database per tenant. One bucket.
Pair LiteBucket with laravel-tenanted and every tenant gets its own SQLite database under its own prefix, with its own encryption key.
use laravel_litebucket::prelude::*;
use laravel_tenanted::WithTenancy;
laravel::Application::configure()
.with_litebucket()
.with_tenancy_using(|t| {
t.litebucket()
.subdomain("example.com");
})
.with_routing(|routing, _| { /* ... */ })
.run()t.litebucket() wires the tenant database URL, per-tenant HKDF encryption, existence check, discovery, and GDPR shred hooks for tenants/{tenant}/main in one call:
| Method | Prefix | When to use |
|---|---|---|
t.litebucket() | tenants/{tenant}/main | Default production multi-tenancy on S3 / R2. |
t.litebucket_prefix("orgs") | orgs/{tenant}/main | Custom root prefix inside your bucket. |
t.litebucket_from_env() | tenants/{tenant}/main | Activates LiteBucket when LITEBUCKET_VFS=1; falls back to local SQLite in dev & tests. |
tenanted_database_url(…) + s3_* hooks | Any template | Low-level building blocks if you need custom hook composition. |
For tenant acme, the template renders to:
sqlite://tenants/acme/main;prefix=tenants/acme/main;sync=batched;write_lease=1;refresh_ms=500;disk_cache_mb=64;compact_every=32;retain_txids=32;tenant_key_id=acme?mode=rwc&vfs=litebucketTenant IDs are validated before they reach a URL or an object key: 1–63 characters of [a-z0-9_-], starting with a letter or digit. ../evil is rejected.
Per-tenant encryption keys
Set one master key, LITEBUCKET_ENCRYPTION_KEY. Each tenant database derives its own 256-bit key with RFC 5869 HKDF-SHA256 (salt litebucket-tenant-v1, info tenant:<id>). Acme's key can't read Globex's pages, and neither can the raw master key. Rotating the master rotates every tenant, because the previous key is derived per tenant too.
To opt a deployment out of per-tenant derivation, use tenanted_database_url_with_opts(template, false).
Migrating across many tenant databases
With laravel-tenanted + LiteBucket, deploys stay fast whether you have 10 tenants or 50,000:
- Lazy on first touch (default): Dormant tenant buckets are never downloaded on deploy. The first request for a tenant acquires a per-tenant lock, runs only pending transactional migrations, and caches the tenant as migrated. Fenced write leases +
If-None-Match: *prevent two cold pods from racing. - Eager rollout: Run
cargo run -- tenant:migrate --all(powered bys3_discover_tenants) to upgrade every discovered tenant bounded byTENANT_MAX_OPEN, or fan out jobs across a queue for 10,000+ tenants.
See Running migrations across many customer databases for expand-and-contract rolling deploy guidelines.
Offboarding and erasure
# Through laravel-tenanted (calls s3_shred_tenant)
cargo run -- tenant:delete acme --force
# Or any prefix directly
cargo run -- sqlite:shred --prefix tenants/acme/main --yesThe bucket never sees plaintext.
Set one key and every SQLite page is encrypted inside your process with AES-256-GCM before it is uploaded.
Each page becomes nonce ‖ ciphertext ‖ tag, 4,124 bytes for a 4 KB page. The associated data binds the page to its transaction, page number, size and snapshot flag, so a page copied to another slot or replayed into another transaction fails authentication. Every encryption draws a fresh 96-bit nonce from the OS CSPRNG, so nonces are never reused across retries, clones or re-chunking.
Because encryption is per page, lazy Range GETs still fetch and decrypt single pages. You keep cold-boot speed and the object store only ever holds ciphertext.
Keys
# 32 random bytes as 64 hex characters (recommended)
# openssl rand -hex 32
LITEBUCKET_ENCRYPTION_KEY=hex:<64 hex characters>| Format | Example | Notes |
|---|---|---|
| 64-character hex | hex:9f3c…, 0x9f3c… or bare | Recommended. |
| 32-byte base64 | base64:n8x…= or bare | Standard or URL-safe alphabet. |
| Passphrase | pass:correct horse battery staple | Stretched with PBKDF2-HMAC-SHA256, 100,000 iterations. Fine for development; use a random key in production. |
Zero-downtime key rotation
- Deploy both keys. Put the new key in
LITEBUCKET_ENCRYPTION_KEYand the old one inLITEBUCKET_PREVIOUS_ENCRYPTION_KEY. New writes use the new key; reads fall back to the old one. - Re-encrypt. Run
litebucket rekey --prefix prod/main(orsqlite:rekey). It checksPRAGMA integrity_check, re-encrypts every chunk under the new key athead + 1, and commits atomically. Add--tenant-key-id acmefor tenant databases. - Retire the old key. Remove
LITEBUCKET_PREVIOUS_ENCRYPTION_KEY.
Every commit is a restore point.
History lives in the bucket as immutable frames. Query it, roll back to it, or fork it without downloading the database.
Time-travel queries
litebucket history --prefix prod/main --limit 20
litebucket sql --prefix prod/main --at=-10m "SELECT count(*) FROM orders"
litebucket sql --prefix prod/main --txid 41 "SELECT * FROM orders WHERE id = 7"--at accepts a relative offset (-30s, -10m, -2h, -7d), RFC 3339 (2026-12-04T09:30:00Z), a UTC datetime (2026-12-04 09:30:00), or a Unix timestamp. From your app binary, sqlite:pitr does the same:
cargo run -- sqlite:pitr --at=-10m --sql "SELECT count(*) FROM orders"Non-destructive restore
litebucket restore --prefix prod/main --at 2026-12-04T09:30:00Z
# Or take a copy to inspect locally
litebucket pull --prefix prod/main --at=-1h -o before-incident.sqlite3Restore never rewrites history. It reads the database as it was and commits that state as the next transaction, head + 1. Everything after it is still in the bucket, so a restore can itself be undone. sqlite:restore is the Artisan equivalent.
By default, 32 transactions are retained behind the latest snapshot. For a time-based window, set LITEBUCKET_RETAIN_HOURS (for example 168 for a week).
Zero-copy clones
# Server-side CopyObject: 0 bytes downloaded
litebucket clone --from prod/main --to staging/main
# Scrub PII on the way: runs your SQL against the copy before it is written
litebucket clone --from prod/main --to dev/main --redact scrub.sqlCloning the live head without redaction copies immutable chunks inside the bucket with CopyObject. Redacted clones, clones at an earlier --at/--txid, or clones between different encryption keys fall back to a full copy. Pass --force to overwrite an existing destination.
Many replicas, one writer.
Reads run locally on every replica. Writes are forwarded to whichever replica holds the lease.
Write forwarding
# This replica's private address, published in write_lock.json
LITEBUCKET_ADVERTISE_ADDR=http://10.0.1.42:8080With LITEBUCKET_ADVERTISE_ADDR set, .with_litebucket() prepends WriteForwardingMiddleware:
GET,HEADandOPTIONSalways run locally.POST,PUT,PATCHandDELETEcheck, in memory, who holds the write lease. If it's another replica, the request is proxied there over your private network.- Forwarded requests carry
X-LiteBucket-Forwarded: 1to prevent loops. The originalHostis preserved, hop-by-hop headers are stripped, and the peer's internal address never leaks to clients.
With several LiteBucket databases in one process, scope forwarding with b.write_forwarding_prefix("prod/main"). write_owner_addr() returns the current lease holder, or None when it's this replica.
Prometheus metrics
async fn metrics() -> ([(laravel::http::header::HeaderName, &'static str); 1], String) {
(
[(laravel::http::header::CONTENT_TYPE, "text/plain; version=0.0.4; charset=utf-8")],
laravel_litebucket::metrics_prometheus(),
)
}
// routing.routes(|route| { route.get("/metrics", metrics); });metrics_prometheus() renders cache hits, misses and evictions, transaction IDs and sizes for every open LiteBucket database in the process. For structured access, use all_open_dbs_stats().
Operate it from anywhere.
The same operations ship twice: as the standalone litebucket CLI for laptops and CI, and as Artisan commands inside your app binary.
The litebucket CLI
cargo install litebucket| Command | What it does |
|---|---|
litebucket doctor | Proves the bucket enforces If-None-Match: * and If-Match, serves Range reads, and reports round-trip times. |
litebucket push [--prefix p] [--force] app.sqlite3 | Uploads an existing SQLite file as a LiteBucket database. |
litebucket pull [--prefix p] [--txid N | --at ts] -o out.sqlite3 | Downloads a consistent copy, optionally from the past. |
litebucket inspect [--prefix p] | Size, chunks, PITR window, encryption and the active lease. |
litebucket history [--prefix p] [--limit N] | Restorable transactions with timestamps. |
litebucket sql [--prefix p] [--txid N | --at ts] "SQL" | Queries live or historical state. |
litebucket restore (--txid N | --at ts) [--prefix p] | Non-destructive restore at head + 1. |
litebucket clone --from a --to b [--redact f.sql] [--force] | Zero-copy or redacted clone. |
litebucket rekey [--prefix p] [--tenant-key-id t] | Re-encrypts under the new key. |
litebucket shred --prefix p --yes | Permanently deletes every object under a prefix. |
Also included: run, init, bench, verify, compact, pitr, tail, forward, sync-local, replicate, serve-metrics and watch-compact. Run litebucket help for usage.
Artisan commands
Registered automatically by .with_litebucket(). Run them with cargo run -- <command> locally, or ./your-app <command> in production.
| Command | What it does |
|---|---|
sqlite:doctor | Verifies bucket access, 412 fencing, If-Match CAS, Range reads and RTT. |
sqlite:status [--prefix] [--lease-key] | Live write-lease and LTX chain status. |
sqlite:inspect [--prefix] | Health, size, chunks, PITR window and encryption. |
sqlite:verify [--prefix] | PRAGMA integrity_check plus the full CRC64 LTX chain. |
sqlite:compact [--prefix] [--retain 32] | Compacts history into snapshot chunks and garbage-collects old frames. |
sqlite:history [--prefix] | Restorable transactions and timestamps. |
sqlite:pitr (--txid N | --at ts) [--sql "…"] | Read-only time-travel query. |
sqlite:restore (--txid N | --at ts) | Non-destructive restore at head + 1. |
sqlite:rekey [--prefix] | Zero-downtime key rotation. |
sqlite:clone --from a --to b [--redact f.sql] [--force] | Zero-copy or redacted clone. |
sqlite:shred --prefix p --yes | Permanently deletes a prefix. |
Commands that open an encrypted database (status, verify, compact, pitr, restore, rekey, clone) also accept --tenant-key-id <tenant>, defaulting to LITEBUCKET_TENANT_KEY_ID. Relative times start with a dash, so write them as --at=-10m.
Deploy anywhere you can attach a bucket.
No database server to provision. Containers stay stateless; the bucket is the source of truth.
Laravel Cloud
- Attach an Object Storage bucket to your environment. Laravel Cloud injects its credentials and LiteBucket discovers them, no
S3_*variables needed. - Set
LITEBUCKET_VFS=1. Optionally addLITEBUCKET_PREFIX=prod/mainand anLITEBUCKET_ENCRYPTION_KEY. - Deploy. On hibernation, stop or redeploy,
SIGTERMdrains staged commits and releases the lease. The next container cold-boots straight from the bucket. No Postgres.
Cloudflare R2 and AWS S3
LITEBUCKET_VFS=1
LITEBUCKET_PREFIX=prod/main
LITEBUCKET_ENDPOINT=https://<ACCOUNT_ID>.r2.cloudflarestorage.com
LITEBUCKET_BUCKET=my-app
LITEBUCKET_ACCESS_KEY_ID=<R2_ACCESS_KEY_ID>
LITEBUCKET_SECRET_ACCESS_KEY=<R2_SECRET_ACCESS_KEY>
# Region defaults to "auto" for R2LITEBUCKET_VFS=1
LITEBUCKET_PREFIX=prod/main
AWS_ENDPOINT=https://s3.us-east-1.amazonaws.com
AWS_BUCKET=my-app
AWS_DEFAULT_REGION=us-east-1
AWS_ACCESS_KEY_ID=<ACCESS_KEY_ID>
AWS_SECRET_ACCESS_KEY=<SECRET_ACCESS_KEY>
# Virtual-hosted style is used automatically for *.amazonaws.comKamal or any VPS
On a server with a persistent disk, keep the L2 cache across restarts so a deploy starts warm:
env:
clear:
LITEBUCKET_VFS: 1
LITEBUCKET_PREFIX: prod/main
LITEBUCKET_DISK_CACHE_PERSISTENT: 1
LITEBUCKET_DISK_CACHE_DIR: /storage/litebucket-cache
secret:
- LITEBUCKET_ENDPOINT
- LITEBUCKET_BUCKET
- LITEBUCKET_ACCESS_KEY_ID
- LITEBUCKET_SECRET_ACCESS_KEY
- LITEBUCKET_ENCRYPTION_KEY
volumes:
- /var/lib/my-app/storage:/storageWhatever the platform, run litebucket doctor against the bucket once before the first deploy.
Environment variables.
Everything has a production default. URL parameters override env vars, and env vars override builder defaults.
| Variable | Default | Purpose |
|---|---|---|
LITEBUCKET_VFS | off | Make litebucket the process-default SQLite VFS. |
LITEBUCKET_PREFIX | — | Database prefix inside the bucket. CLI and Artisan default to app/db. |
LITEBUCKET_SYNC_MODE | batched | batched or strict. |
LITEBUCKET_WRITE_LEASE | 1 | Fenced single-writer lease. |
LITEBUCKET_FLUSH_INTERVAL_MS | 100 | Fallback flush timer in Batched mode. |
LITEBUCKET_FLUSH_MAX_PAGES | 64 | Flush synchronously once this many pages are staged. |
LITEBUCKET_CACHE_PAGES | 1024 | L1 RAM cache size in 4 KB pages. |
LITEBUCKET_DISK_CACHE_MB | 64 | L2 NVMe cache budget; 0 disables. |
LITEBUCKET_DISK_CACHE_DIR | OS temp dir | Where the L2 cache lives. |
LITEBUCKET_DISK_CACHE_PERSISTENT | off | Keep the L2 cache across restarts. |
LITEBUCKET_REFRESH_MS | 500 | Background catch-up interval. |
LITEBUCKET_COMPACT_EVERY | 32 | Auto-compact every N transactions. |
LITEBUCKET_RETAIN_TXIDS | 32 | Transactions kept for PITR during GC. |
LITEBUCKET_RETAIN_HOURS | off | Time-based PITR window. |
LITEBUCKET_ENCRYPTION_KEY | off | AES-256-GCM key: hex, base64 or pass:. |
LITEBUCKET_PREVIOUS_ENCRYPTION_KEY | — | Old key, read-only fallback during rotation. |
LITEBUCKET_TENANT_KEY_ID | — | Default tenant for CLI and Artisan key derivation. |
LITEBUCKET_ADVERTISE_ADDR | — | This replica's private URL; enables write forwarding. |
Bucket credentials are covered in Connect a bucket. The full API is on docs.rs.