Bundle: redb-tsak / templates/templates (templates.templates.txt), 7 files Snapshot: development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Index: https://redbase.app/src/dev-2026-12-06/redb-tsak/_index.txt ==== Path: redb-tsak/templates/templates/tsak-worker/.dockerignore Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/.dockerignore ---- **/bin **/obj **/Logs **/.vs **/.idea **/*.user Path: redb-tsak/templates/templates/tsak-worker/.template.config/template.json Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/.template.config/template.json ---- { "$schema": "http://json.schemastore.org/template", "author": "RedBase", "classifications": [ "Worker", "Service", "redb.Tsak", "RedBase" ], "identity": "RedBase.Tsak.Worker.Template", "name": "redb.Tsak Worker Host", "description": "A Tsak worker host: runs redb.Route modules from its module folder with hot reload, a management API and a scheduler, its state in redb or in memory.", "shortName": "tsak-worker", "tags": { "language": "C#", "type": "project" }, "sourceName": "TsakHost", "preferNameDirectory": true, "symbols": { "db": { "type": "parameter", "datatype": "choice", "defaultValue": "sqlite", "displayName": "Database", "description": "Database provider (used when storage = redb)", "choices": [ { "choice": "sqlite", "description": "SQLite (a file next to the host, nothing to install)" }, { "choice": "postgres", "description": "PostgreSQL (via Npgsql)" }, { "choice": "mssql", "description": "Microsoft SQL Server" } ] }, "storage": { "type": "parameter", "datatype": "choice", "defaultValue": "redb", "displayName": "State store", "description": "State store backing", "choices": [ { "choice": "redb", "description": "Persistent state in REDB (recommended)" }, { "choice": "inmemory", "description": "In-memory only (state lost on restart)" } ] }, "pro": { "type": "parameter", "datatype": "bool", "defaultValue": "true", "displayName": "Pro", "description": "RedBase Pro tier and Pro features (cluster, redb-backed key store, audit). The 4.x Pro tier is free; --pro false switches the redb provider to the Free one and the save strategy to DeleteInsert" }, "UsePostgres": { "type": "computed", "value": "(db == \"postgres\")" }, "UseMsSql": { "type": "computed", "value": "(db == \"mssql\")" }, "UseSqlite": { "type": "computed", "value": "(db == \"sqlite\")" }, "UseRedbStorage": { "type": "computed", "value": "(storage == \"redb\")" } }, "sources": [ { "modifiers": [ { "condition": "(!pro)", "exclude": [ "**/*.pro.cs" ] } ] } ] } Path: redb-tsak/templates/templates/tsak-worker/Dockerfile Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/Dockerfile ---- FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base WORKDIR /app EXPOSE 9090 FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src COPY ["TsakHost.csproj", "./"] RUN dotnet restore "TsakHost.csproj" COPY . . RUN dotnet publish "TsakHost.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=build /app/publish . RUN mkdir -p /app/Libs /app/Logs ENTRYPOINT ["dotnet", "TsakHost.dll"] Path: redb-tsak/templates/templates/tsak-worker/Program.cs Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/Program.cs ---- using Serilog; using redb.Tsak.Core.Extensions; //#if (pro) using redb.Tsak.Core.Pro.Extensions; //#endif var builder = Host.CreateDefaultBuilder(args) .UseSerilog((context, services, configuration) => configuration .ReadFrom.Configuration(context.Configuration)) .ConfigureServices((context, services) => { // Registers everything required by the Tsak runtime: // storage, hot-reload, REST management API, // scheduler, monitoring, security. services.AddTsak(context.Configuration); //#if (pro) // Pro: cluster bootstrap (no-op when Tsak:Cluster:Enabled = false). services.AddTsakCluster(context.Configuration); //#endif }); await builder.Build().RunAsync(); Path: redb-tsak/templates/templates/tsak-worker/README.md Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/README.md ---- # TsakHost Generated from `dotnet new tsak-worker`. A minimal host process for running [redb.Route](https://www.nuget.org/packages/redb.Route.Core/) integration contexts inside a [redb.Tsak](https://www.nuget.org/packages/redb.Tsak.Core/) runtime container. ## What you get - Hot-reload module loading from `Libs/` - REST management API on `http://127.0.0.1:9090` (loopback: it is unauthenticated until `Tsak:Auth:Enabled`) - Quartz scheduler (RAM or AdoJobStore depending on storage choice) - OpenTelemetry / Prometheus metrics endpoint (off by default) - Structured Serilog logging to console + rolling file in `Logs/` ## Run ```bash dotnet run ``` The default provider is SQLite, so the host starts on a machine with nothing installed: it creates `tsak.db` next to itself on the first run. `--db postgres|mssql` switches the provider (the connection string sits in `ConnectionStrings`), and `--pro false` runs the Free redb tier: the host then uses the `DeleteInsert` save strategy, because batch `ChangeTracking` is not implemented there. The API key store, REDB connection and cluster settings live in [`appsettings.json`](./appsettings.json). Override via environment variables, user-secrets or a mounted `appsettings.Production.json`. ## Database and storage `Tsak:Redb:Provider` is always configured, and the modules hosted on Tsak read their data through it: a database is required even with `--storage inmemory`. InMemory only means that Tsak's own state store and the Quartz job store live in RAM, so that state is lost on restart. To run without any database, remove the whole `Tsak:Redb` section: the host then starts with no RedBase at all and a module that asks for `IRedbService` fails to load. ## Add a module Drop a `.tpkg` (or a folder with module DLLs) into the `Libs/` directory. The hot-reload service picks it up within `Tsak:HotReload:ScanIntervalSeconds`. A module is loaded into its own assembly load context, and its dependencies are resolved from the worker's own assembly set and from `Libs/shared` **next to the application** (`AppContext.BaseDirectory/Libs/shared`, not the current directory - the template copies `Libs/**` to the output at build, so a file in this project's `Libs/shared` ends up where the loader looks). The packages produced by the redb.Templates module templates already carry every dependency the worker does not ship (`redb.Route.File`, `redb.Route.GenericFile`, ...): fill `Libs/shared` only if a module still fails with `FileNotFoundException`. The redb-tsak repository ships the tools for exactly that: ```powershell # scripts/ of the redb-tsak checkout; point -SharedDir at the host you are running scripts/refresh-shared.ps1 -Lib redb.Route.File -SharedDir C:\apps\worker\Libs\shared scripts/build-shared.ps1 -Clean # the whole connector layer at once ``` ## Management API The API is bound to `127.0.0.1:9090` and has no authentication by default. Before exposing it, set `Tsak:Api:Host` and turn `Tsak:Auth` on with a long random `Secret`. ## Docker ```bash docker build -t my-tsak-host . docker run --rm -p 9090:9090 -v $(pwd)/Libs:/app/Libs my-tsak-host ``` ## Documentation - redb.Tsak: - redb.Route: - REDB: Path: redb-tsak/templates/templates/tsak-worker/TsakHost.csproj Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/TsakHost.csproj ---- net10.0 enable enable Linux tsak-host-$(MSBuildProjectName) 4.8.0 false PreserveNewest PreserveNewest Path: redb-tsak/templates/templates/tsak-worker/appsettings.json Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/templates/templates/tsak-worker/appsettings.json ---- { "ConnectionStrings": { //#if (UsePostgres) "Postgres": "Host=localhost;Port=5432;Username=postgres;Password=postgres;Database=tsak;Pooling=true", //#endif //#if (UseMsSql) "MSSql": "Server=localhost;Database=tsak;User Id=sa;Password=Pass@word1;TrustServerCertificate=true", //#endif //#if (UseSqlite) "Sqlite": "Data Source=tsak.db" //#endif }, "Tsak": { "Storage": { //#if (UseRedbStorage) "Type": "Redb" //#else "Type": "InMemory" //#endif }, "Redb": { //#if (UsePostgres) "Provider": "postgres", //#endif //#if (UseMsSql) "Provider": "mssql", //#endif //#if (UseSqlite) "Provider": "sqlite", //#endif // The Pro redb tier is free, and it is what the worker image runs on. Only the Free // tier needs DeleteInsert: batch ChangeTracking is not implemented there, so a module that saves // inside Transacted() - the usual pattern - fails on the first object. //#if (pro) "UsePro": true, "PropsSaveStrategy": "ChangeTracking" //#else "UsePro": false, "PropsSaveStrategy": "DeleteInsert" //#endif }, "Modules": { "AssemblyPaths": [ "Libs" ] }, "Contexts": { "default": { "AutoStart": true } }, //#if (pro) "Cluster": { "Enabled": false, "ClusterName": "default", "GroupName": "default", "NodeId": "", "ApiEndpoint": "http://localhost:9090", "HeartbeatIntervalSeconds": 15, "DeadNodeTimeoutSeconds": 60, "LeaderLockTtlSeconds": 30, "Strategy": "round-robin" }, //#endif "HotReload": { "Enabled": true, "ScanIntervalSeconds": 10, "KeepVersions": 2, "StartupTimeoutSeconds": 60, // Not implemented by the runtime yet: nodes reload modules on their own scan schedule, so an // update is staged by deploying the package to the nodes one by one (the worker logs a warning). "RollingUpdate": false, "Collectible": false }, "Metrics": { "CollectionIntervalSeconds": 10, "HistoryHours": 12, "Prometheus": { "_comment": "AdditionalMeters / AdditionalSources let modules hosted on top of Tsak expose their own OTel Meters / ActivitySources without taking a runtime dependency on Tsak. Example for redb.Identity: \"AdditionalMeters\": [\"RedbIdentity\"].", "Enabled": false, "Port": 9464 } }, "Api": { "Enabled": true, // Loopback by default: the management API has no authentication while Tsak:Auth:Enabled is false. // Bind 0.0.0.0 only behind your own gateway, or turn Auth on with a Secret first. "Host": "127.0.0.1", "Port": 9090 }, "Logs": { "BufferSize": 2000 }, "Watchdog": { "Enabled": true, "CheckIntervalSeconds": 10, "SuspectedThresholdMinutes": 0.5, "HungThresholdMinutes": 1.5, "AutoRestartHungRoutes": false }, "Auth": { "Enabled": false, // Required - a long random value - as soon as Enabled is true; an empty secret leaves the // management API open to anyone who can reach the port. "Secret": "", "Keys": [] } }, "Quartz": { "quartz.threadPool.type": "Quartz.Simpl.SimpleThreadPool, Quartz", "quartz.threadPool.threadCount": "10", //#if (UseRedbStorage) "quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz", "quartz.jobStore.clustered": "false", //#else "quartz.jobStore.type": "Quartz.Simpl.RAMJobStore, Quartz", //#endif "quartz.scheduler.instanceId": "NODE", "quartz.scheduler.instanceName": "TsakScheduler" }, "Serilog": { "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Warning", "Quartz": "Warning" } }, "WriteTo": [ { "Name": "Console" }, { "Name": "File", "Args": { "path": "Logs/tsak-.log", "rollingInterval": "Day", "retainedFileCountLimit": 7 } } ] } }