Rask.SQLite.Litestream 0.20.1-alpha.0.212

This is a prerelease version of Rask.SQLite.Litestream.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.SQLite.Litestream --version 0.20.1-alpha.0.212
                    
NuGet\Install-Package Rask.SQLite.Litestream -Version 0.20.1-alpha.0.212
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.212" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.SQLite.Litestream" Version="0.20.1-alpha.0.212" />
                    
Directory.Packages.props
<PackageReference Include="Rask.SQLite.Litestream" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rask.SQLite.Litestream --version 0.20.1-alpha.0.212
                    
#r "nuget: Rask.SQLite.Litestream, 0.20.1-alpha.0.212"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rask.SQLite.Litestream@0.20.1-alpha.0.212
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.212&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rask.SQLite.Litestream&version=0.20.1-alpha.0.212&prerelease
                    
Install as a Cake Tool

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.

It also verifies that what has been replicated is restorable — on an opt-in schedule, by restoring the replica back out to a throwaway path and checking a sentinel survived the round trip. "The replicator is running" and "the backup can be restored" are different facts, and only one of them is usually discovered at the moment you need it.

Builds on Rask.SQLite, whose WAL default is exactly what Litestream requires and whose non-blocking busy-retry writes the verification sentinel, plus CliWrap to drive the binary.

The litestream binary 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=false and set your own ExecutablePath.

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 Critical but never crashes the app.

  • Checkable. A log line tells you when replication broke; nothing tells you it's healthy. Resolve the LitestreamStatus singleton for IsReplicating, LastStartedAt/LastExitedAt, RestartCount, LastExitCode and LastError. A clean shutdown clears IsReplicating without counting a restart, so a climbing RestartCount means backups are flapping.

  • Restorable, not just running. Every one of those fields describes the local child process. A replica writing to the wrong prefix, or a bucket whose credentials were rotated to read-only, keeps IsReplicating true right up until the restore. Turn on Verification to prove the round trip:

    o.Verification.Enabled = true;              // off by default — see the cost note below
    o.Verification.Interval = TimeSpan.FromHours(24);
    

    Each pass writes a sentinel row, waits for replication to carry it, restores to a temp path and checks it came back, then publishes LitestreamStatus.Verification: Outcome, LastVerifiedAt, ReplicationLag and LastError. Alert on a LastVerifiedAt that stops moving — an Inconclusive pass just means the sentinel had not shipped yet, which is lag, not a broken backup.

    This costs money. A verification pass is a real restore and a real download, so it is off by default, defaults to daily when on, and belongs nowhere near a health-check endpoint that anything can poll. ISqliteBackupVerifier is registered either way if you want to trigger one by hand.

  • Advanced config. Point ConfigPath at a full litestream.yml for multiple databases or custom retention / sync intervals.

Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/sqlite.md

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rask.SQLite.Litestream:

Package Downloads
Rask

The one reference a Rask application needs, server or browser. On net10.0 it brings the ASP.NET host plus every battery — database, mediator, background jobs, transactional email, cache, outbox, operator dashboard, durable logs, Web Push, and SQLite snapshots and continuous backup — with RaskApp.Create(args) as the entry point. On net10.0-browser it brings the WebAssembly host, the source-generated mediator, the query cache and remote dispatch. Everything referenced is wired and on; app.Configure(c => c.Jobs.Off()) is how an app does without one. Reference Rask.Server for a lean host with no database.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.20.1-alpha.0.228 34 9/4/2026
0.20.1-alpha.0.227 29 9/4/2026
0.20.1-alpha.0.226 35 9/4/2026
0.20.1-alpha.0.225 36 9/4/2026
0.20.1-alpha.0.224 35 9/4/2026
0.20.1-alpha.0.223 37 9/4/2026
0.20.1-alpha.0.221 36 9/4/2026
0.20.1-alpha.0.220 36 9/4/2026
0.20.1-alpha.0.217 34 9/4/2026
0.20.1-alpha.0.216 39 9/4/2026
0.20.1-alpha.0.215 40 9/3/2026
0.20.1-alpha.0.213 38 9/3/2026
0.20.1-alpha.0.212 36 9/3/2026
0.20.1-alpha.0.211 41 9/3/2026
0.20.1-alpha.0.210 37 9/3/2026
0.20.1-alpha.0.209 40 9/2/2026
0.20.1-alpha.0.208 34 9/2/2026
0.20.1-alpha.0.207 44 9/2/2026
0.20.1-alpha.0.206 43 9/2/2026
0.20.0 108 8/6/2026
Loading failed