Rask.SQLite.Litestream
0.20.1-alpha.0.42
dotnet add package Rask.SQLite.Litestream --version 0.20.1-alpha.0.42
NuGet\Install-Package Rask.SQLite.Litestream -Version 0.20.1-alpha.0.42
<PackageReference Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.42" />
<PackageVersion Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.42" />
<PackageReference Include="Rask.SQLite.Litestream" />
paket add Rask.SQLite.Litestream --version 0.20.1-alpha.0.42
#r "nuget: Rask.SQLite.Litestream, 0.20.1-alpha.0.42"
#:package Rask.SQLite.Litestream@0.20.1-alpha.0.42
#addin nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.42&prerelease
#tool nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.42&prerelease
Rask.SQLite.Litestream
Managed Litestream backup for SQLite, supervised from inside your app. Restores the database from its replica on startup (when the local file is missing) and continuously streams the write-ahead log to S3 / GCS / Azure Blob / file storage for the life of the process — all driven by a hosted background service, so there is no separate sidecar container to orchestrate.
Pairs with Rask.SQLite, whose WAL default is exactly
what Litestream requires. Standalone otherwise: it depends only on the Microsoft.Extensions
hosting/DI abstractions and CliWrap.
The
litestreambinary is downloaded at build time and dropped next to your app (SHA-256-verified, cached, tiny package) — nothing to install. Opt out with-p:RaskLitestreamDownload=falseand set your ownExecutablePath.
Install
dotnet add package Rask.SQLite.Litestream
Use
var dbPath = "/data/app.db"; // local disk — see the notes on network filesystems
builder.Services.AddRaskSqliteLitestream(o =>
{
o.DatabasePath = dbPath;
o.ReplicaUrl = "s3://my-bucket/app"; // or gcs://, abs:// (Azure Blob), file:///backups/app
// o.ExecutablePath = "/usr/local/bin/litestream"; // if it isn't on PATH
});
builder.Services.AddDbContextFactory<AppDb>(o => o.UseRaskSqlite($"Data Source={dbPath}"));
var app = builder.Build();
// Restore from the replica BEFORE opening the DB (no-op if the file already exists locally).
await app.Services.RestoreSqliteFromLitestreamAsync();
// ... EnsureCreated / migrate / seed, then app.Run();
Continuous replication then runs automatically as a hosted service until the app stops; on shutdown
it interrupts litestream and lets it flush (see ShutdownGracePeriod).
Notes
- Single writer only. Litestream assumes one process writes the database. Run a single instance — do not scale out — or the replica diverges.
- Local disk, not a network share. SQLite WAL needs real filesystem locking; keep the database on local/ephemeral disk and let Litestream replicate to durable storage. This is the pattern Litestream was built for (ephemeral container + object-storage backup).
- Resilient by design. A backup failure is logged at
Criticalbut never crashes the app. - Checkable. A log line tells you when replication broke; nothing tells you it's healthy. Resolve the
LitestreamStatussingleton forIsReplicating,LastStartedAt/LastExitedAt,RestartCount,LastExitCodeandLastError. A clean shutdown clearsIsReplicatingwithout counting a restart, so a climbingRestartCountmeans backups are flapping. - Advanced config. Point
ConfigPathat a fulllitestream.ymlfor multiple databases or custom retention / sync intervals.
Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CliWrap (>= 3.10.4)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.1-alpha.0.42 | 0 | 8/12/2026 |
| 0.20.1-alpha.0.41 | 0 | 8/12/2026 |
| 0.20.1-alpha.0.40 | 0 | 8/12/2026 |
| 0.20.1-alpha.0.38 | 0 | 8/12/2026 |
| 0.20.1-alpha.0.36 | 46 | 8/10/2026 |
| 0.20.1-alpha.0.18 | 54 | 8/8/2026 |
| 0.20.1-alpha.0.17 | 47 | 8/8/2026 |
| 0.20.1-alpha.0.16 | 47 | 8/8/2026 |
| 0.20.1-alpha.0.15 | 47 | 8/7/2026 |
| 0.20.1-alpha.0.14 | 57 | 8/7/2026 |
| 0.20.1-alpha.0.13 | 45 | 8/7/2026 |
| 0.20.1-alpha.0.12 | 46 | 8/7/2026 |
| 0.20.1-alpha.0.11 | 55 | 8/7/2026 |
| 0.20.1-alpha.0.9 | 53 | 8/7/2026 |
| 0.20.1-alpha.0.8 | 62 | 8/7/2026 |
| 0.20.1-alpha.0.7 | 45 | 8/7/2026 |
| 0.20.1-alpha.0.5 | 51 | 8/7/2026 |
| 0.20.1-alpha.0.4 | 43 | 8/7/2026 |
| 0.20.1-alpha.0.3 | 49 | 8/7/2026 |
| 0.20.1-alpha.0.2 | 55 | 8/6/2026 |