TIMEWARP SKILL — deploy a generated app from its Aspire AppHost. The first deploy is one command, dev deploy --target <t>: publish, deploy, migrate when the app has a database, smoke the ingress, and open the app (--no-browser prints the URL). Targets: Docker Compose, Kubernetes/Helm, Azure (AKS or Azure Container Apps), and Azure Container Apps + Neon. dev publish, dev deploy migrate, dev open, and dev deprovision are one-step operator verbs (never CI). Also: kind, production safety, secrets and parameters, the passkey ingress host, migrations per target, ingress topology, container-runtime neutrality. Invoke before deploying, adding a publish target, or touching publish-mode wiring in the AppHost. WHEN: deploy the app, first deploy, dev deploy, dev deprovision, dev open, migrate the deployed database, tear down a deployment, kind cluster, Helm, AKS, Azure Container Apps, Neon region, passkeys on a deployed host, production secrets, Podman.

Maintained in timewarp-architecture · Canonical file: SKILL.md

Install

With TimeWarp.Skills:

dnx TimeWarp.Skills -- add tw-deploy https://timewarp.software/

Add a harness target and skills sync (see the TimeWarp.Skills page). Or copy the SKILL.md into your agent's skills directory.


Deploy (Aspire publish targets)

The AppHost (source/container-apps/aspire/projects/aspire-app-host/) is the single source of truth for deployment. Every deployment artifact — docker-compose.yaml, .env, the Helm chart, the migration script — is generated by aspire publish / aspire deploy. There are no hand-written Dockerfiles, manifests, or charts, and there is no devops/ tree. The AppHost Design regions hold the per-line reasoning (program.cs maps each concern to its file); this skill is the operator's map.

Detection — when to invoke

Signal Where
Deploying the app anywhere other than dev run any target below
Adding or changing a publish target / compute environment AppHost publish-target.cs
Adding a setting that must differ in production parameters, not literals
Touching code guarded by IsPublishMode / IsRunMode AppHost program.cs and its concern files
Adding a schema migration that must reach production migrations section

Target matrix

Target AppHost environment Publish:Target Artifact Run with
Standalone hardware AddDockerComposeEnvironment("compose") compose (default) docker-compose.yaml + .env + efmigrations/ aspire deploy, or docker compose up / podman compose up
Kubernetes (on-prem, any distribution) AddKubernetesEnvironment("k8s") + WithHelm kubernetes Helm chart directory aspire deploy, or helm upgrade --install
Azure (shared cluster, portable default) an existing AKS cluster is a Kubernetes target kubernetes Helm chart aspire deploy against the AKS kubectl context
Azure Container Apps (Azure-only) AddAzureContainerAppEnvironment("aca-env") aca Bicep (main.bicep + one module per resource) + efmigrations/ aspire deploy into the az login subscription
Azure Container Apps + Neon the same aca-env, no Flexible Server aca-neon Bicep + efmigrations/ aspire deploy; Postgres is an external Neon connection string

One target per publish. Aspire assigns every compute resource to exactly one compute environment, so Compose, Kubernetes and Azure Container Apps are alternatives selected by configuration, never both in one model. aca and aca-neon both use the ACA environment; they differ in where Postgres lives. Publish:Target is read in publish mode only; any other value throws. Run mode (dev run) always ignores it and keeps the local Postgres container.

Publishing and deploying

aspire publish only writes files — no image build, no deploy, no container runtime needed. aspire deploy builds images through the detected container runtime and applies them.

# Compose (default target)
dev publish compose                         # publish to artifacts/aspire-output/compose + safety suite
aspire publish --apphost <apphost.csproj> --output-path out/compose
aspire deploy  --apphost <apphost.csproj>   # fills .env, builds images, brings the stack up

# Kubernetes (Helm chart)
dev publish kubernetes                      # publish to artifacts/aspire-output/kubernetes + safety suite + helm lint
aspire publish --apphost <apphost.csproj> --output-path out/k8s -- --Publish:Target=kubernetes
aspire deploy  --apphost <apphost.csproj> -- --Publish:Target=kubernetes   # helm upgrade --install, current kubectl context

# Azure Container Apps (Bicep) — publishing needs no Azure credentials
dev publish aca                             # publish to artifacts/aspire-output/aca + safety suite
aspire publish --apphost <apphost.csproj> --output-path out/aca -- --Publish:Target=aca
aspire deploy  --apphost <apphost.csproj> -- --Publish:Target=aca   # provisions + pushes images, az CLI credential

# Azure Container Apps + Neon — publishing needs no Neon or Azure credentials
dev publish aca-neon                        # publish to artifacts/aspire-output/aca-neon + safety suite
aspire publish --apphost <apphost.csproj> --output-path out/aca-neon -- --Publish:Target=aca-neon

# Every target — what CI runs
dev publish all                             # all four publishes, then one safety-suite run + helm lint

Aspire CLI version

The installed aspire CLI must match <AspireVersion> in Directory.Packages.props. The AppHost SDK, the Aspire.* pins, and the CI Aspire.Cli install read it. dev run, dev publish, and dev deploy warn when the CLI is older and print dotnet tool update -g Aspire.Cli. A CLI below 13.6 is still refused. The same or a newer CLI is left alone.

Deploying

The first deploy is one command. It publishes (so the migrations bundle exists), deploys, migrates when the app has a database, smokes the ingress, and opens the app in the browser. --no-browser prints the URL and opens nothing. With no terminal, or no opener on PATH (wslview, then explorer.exe on WSL), it prints the URL and still succeeds. --yes skips the prompt only; it does not change the browser. Kubernetes with no external address does not keep a port-forward: it prints the dev open --target kubernetes hint. It stops at the first failure and names the verb to re-run. No CI job, workflow step or dev workflow mode calls it, and none may. A merge never deploys.

dev deploy                                  # compose: publish, deploy, migrate, smoke, open the app
dev deploy --target kubernetes              # same path; opens a LoadBalancer address; otherwise prints the dev open hint
dev deploy --target aca                     # same path; Azure Container Apps + Flexible Server; opens the ingress (az login first)
dev deploy --target aca-neon                # same path; ACA (min replicas 0) + Neon; opens the ingress
dev deploy --target compose --yes           # no prompt; aspire deploy --non-interactive; still opens the app
dev deploy --no-browser                     # print the URL and open nothing

Set Azure:Location and Azure:ResourceGroup (AppHost user secrets, or Azure__Location / Azure__ResourceGroup) before an Azure deploy so Aspire does not prompt and smoke can read the ingress host. Put the app and the Neon project in the same region, near the users. dev deploy --target aca-neon warns when the pooled host's AWS region is far from Azure:Location and names a nearby Azure region (ap-southeast-1 → southeastasia). A location in that AWS region's nearby set (for example us-east-1 with eastus or eastus2) stays quiet. The warning does not print the connection string and does not stop the deploy.

Smoke is GET /web-server/alive and GET /api/identity/sign-in-methods. It retries a cold start (a Neon wake-up or a scale-to-zero replica). It does not request /api/health. A target with no platform/postgres/migrations folder beside the AppHost skips migrate and says so.

Operator steps

dev publish, dev deploy migrate, dev open, and dev deprovision stay for one step. dev publish is what CI runs: the file publish plus the production-safety suite.

dev publish compose                         # files plus the safety suite (CI)
dev deploy migrate --target kubernetes      # migrate only; publishes the bundle when it is missing
dev deploy migrate --target aca-neon        # the bundle, on the direct Neon connection (no firewall rule)
dev open --target kubernetes                # port-forward the ingress controller and open the browser

dev deprovision --target kubernetes         # preflight, then aspire destroy asks before deleting
dev deprovision --target kubernetes --yes   # aspire destroy --yes --non-interactive — deletes the deployment and its data
dev deprovision --target aca                # aspire destroy, then purge the soft-deleted Key Vault
dev deprovision --target aca-neon           # aspire destroy the resource group; the Neon project stays

Local Kubernetes with kind

A kind cluster is just another kubectl context: give it a local registry the nodes can pull from, install ingress-nginx once as cluster infrastructure, then dev deploy --target kubernetes. The full pwsh and bash recipe (registry, cluster, node registry mapping, ingress, deploy, tear down) is in local-kubernetes-with-kind.md.

Production-safety rules

These never appear in published output. Each is enforced by the target's aspire-tests suite — extend the suite when you add a new publish-mode branch.

Never ships Why How it is kept out
Mock authentication (Authentication__UseMock) it signs requests in as a fake principal forwarded in run mode only; the server also fail-closes outside Development/Testing
Browser-log forwarding ships client telemetry to a dev dashboard Development-only; publish runs as Production
Dashboard Postgres REPL (WithRepl) an authenticated psql shell for anyone with dashboard access Development-only
TimeWarp.State DevTools inspector (timewarp-devtools, TIMEWARP_STATE_DEVTOOLS_ENDPOINT, its CORS origin variables) an unauthenticated UI showing every action and state snapshot of web-server and the browser AddTimeWarpStateDevTools() / WithTimeWarpStateDevTools() and the ingress CORS origins run in the AppHost's IsRunMode block only. web-server exports spans and maps /_timewarp/state-devtools only in Development with the endpoint set. The browser exporter (TimeWarp.State.DevTools.Wasm) is a Debug-only reference and a Debug-only call, so no Release build or published WASM bundle contains it. In dev run the dashboard links it as TimeWarp DevTools
SigNoz dashboard link (signoz) an operator-chosen URL; committing one would point every generated app at one host Run mode only, and only when Observability:SigNoz:Url is an absolute https URL. Unset adds nothing. Any other value fails AppHost startup and names the key. AddExternalService also excludes it from the manifest. In dev run the dashboard links it as SigNoz. This does not export telemetry
Aspire dashboard in the deployment a second, unauthenticated UI and port WithDashboard(false) on every environment — point OTEL_EXPORTER_OTLP_ENDPOINT at your own collector. ACA deploys it as a public dotNetComponents resource unless disabled
Any host port / externally reachable service besides the ingress every extra exposure is an unaudited entry point Compose: only the ingress publishes a port (ingress-port). Kubernetes: every Service is ClusterIP; the cluster Ingress is the only way in. ACA: only the ingress container app has external: true; web, api and grpc are internal
Secret literals literals end up in images, repos and logs secrets are parameters (below)
Debug/Trace logging, EF Core SQL, sensitive-data logging per-query SQL and parameter values fill disks and leak data every host's base appsettings.json is Default: Information with EF Core (and .Database.Command), HTTP client, Polly, YARP and gRPC at Warning; only appsettings.Development.json adds Debug, for the app's own namespaces. EnableSensitiveDataLogging is gated on IsDevelopment(). A guard test checks the committed files; the publish suites reject any Logging__LogLevel__* at Debug/Trace

To see EF Core SQL locally, opt in per machine instead of committing a level: dotnet user-secrets set "Logging:LogLevel:Microsoft.EntityFrameworkCore.Database.Command" "Information" in the web-server project, or set Logging__LogLevel__Microsoft.EntityFrameworkCore.Database.Command=Information in the environment. Remove it when done; dev run logs grow without bound.

Rules for new code:

dev run can show a SigNoz link on the Aspire dashboard resource list. Set Observability:SigNoz:Url to an absolute https URL in the AppHost user secrets, or set Observability__SigNoz__Url for one session. The template does not commit a URL. A missing or blank value adds no resource. A value that is not an absolute https URL fails AppHost startup and names the key. Publish and deploy never include the resource, and the link does not export telemetry.

dotnet user-secrets set "Observability:SigNoz:Url" "https://observability.example" --project source/container-apps/aspire/projects/aspire-app-host/aspire-app-host.csproj
Observability__SigNoz__Url=https://observability.example dev run

Secrets and parameters

Every value that differs per deployment is an AddParameter, never a literal in code; a non-secret default every machine shares (the app's identity) is committed in the AppHost appsettings.json Parameters section, not in the AddParameter call. Secrets are AddParameter(name, secret: true) (or a generated secret such as Postgres' password).

Target Where parameter values live
Compose .env beside docker-compose.yaml; aspire deploy / aspire do prepare-compose fill it
Kubernetes values.yaml: secrets under secrets.<resource> (rendered into <resource>-secrets Secret objects, empty defaults), never ConfigMaps
Azure Container Apps @secure() Bicep parameters (no defaults) that become container-app secrets read through secretRef. The Postgres connection string lives in a Key Vault Aspire provisions, which web-server reads with its managed identity; the Postgres password is also on web-server as the container-app secrets postgres-db-password and postgres-db-uri, built from the @secure() parameter
Azure Container Apps + Neon two @secure() parameters, neon-pooled-connection-string and neon-direct-connection-string, with no defaults. web-server reads the pooled string as ConnectionStrings__postgres-db. The migration bundle uses the direct string. dev deploy does not put either value on the command line or in the plan. Production does not load user secrets, so a user-secret value is copied into the aspire process environment. Set them in AppHost user secrets or Parameters__ environment variables, never in appsettings

Postgres and migrations per target

Migrations are explicit in every deployed environment: the AppHost never auto-migrates a deployment. web-server does not migrate at startup and tolerates a not-yet-migrated database. The published idempotent SQL script (efmigrations/web-migrations.sql) is safe to re-run.

Apply them with dev deploy migrate --target <target> (Deploying above). The last column is what it runs — run it yourself in a generated app without the dev CLI (<runtime> is docker or podman; dev deploy migrate passes the running project's --project-name and --file from <runtime> compose ls):

Target Storage Apply migrations (what dev deploy migrate runs)
Compose named volume postgres-data; POSTGRES_DB creates the database on first start <runtime> compose exec -T postgres sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" psql -U postgres -d postgres-db -v ON_ERROR_STOP=1' < efmigrations/web-migrations.sql
Kubernetes postgres-data PersistentVolumeClaim (postgres-storage-capacity, default 10Gi), single-replica StatefulSet kubectl exec -i -n <namespace> statefulset/postgres-statefulset -- sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" psql -U postgres -d postgres-db -v ON_ERROR_STOP=1' < efmigrations/web-migrations.sql
Azure Container Apps Azure Database for PostgreSQL Flexible Server (managed storage and backups); the Bicep creates postgres-db the published bundle from the operator's machine, through a temporary firewall rule — see Azure Container Apps below
Azure Container Apps + Neon Neon Postgres (external). The app uses the pooled host; migrations use the direct host the published bundle with the direct connection string — see Azure Container Apps + Neon below

The script is piped on stdin (< efmigrations/web-migrations.sql in bash; in pwsh Get-Content -Raw efmigrations/web-migrations.sql | <command>). dev deploy migrate adds -q and PGOPTIONS='-c client_min_messages=warning' unless --verbose, and reads psql -At -c 'SELECT "MigrationId" FROM "__EFMigrationsHistory" ORDER BY "MigrationId"' before and after for its report.

Data Protection key ring

ASP.NET Core Data Protection encrypts auth cookies and other protected payloads. Every replica of one app must share one key ring, and the ring must outlive a container.

Agent access tokens (IAgentTokenStore) are in memory on every host, even when postgres is on: a restart or a second instance invalidates live tokens, and the reviewer reissues with its key.

postgres Where the ring lives
on, and a connection string is set Postgres table data_protection.keys, via PersistKeysToDbContext on PostgresDbContext. The application name is the template source name (TimeWarp.Architecture here; dotnet new rewrites it to the generated app's name), so every replica of that app shares keys and two apps do not. dev deploy migrate creates the table with the other migrations.
off, or no connection string The ASP.NET default file-system ring, inside the container. No volume is mounted. A new container, a second replica, or a scale-to-zero cold start gets an empty ring. Cookies and other protected payloads from the previous process stop validating. Turn postgres on when sign-in must survive a restart.

The ring is not wrapped with a certificate or Azure Key Vault. Compose has nowhere to put that protector. aca provisions a Key Vault for the Postgres connection string, not for this ring. aca-neon provisions no Key Vault. The database's own encryption is the at-rest protection for the key XML. A certificate or Key Vault protector is a possible follow-up.

Targets with postgres (compose, kubernetes, aca, aca-neon) all use the same table. aca-neon sets min replicas to 0, so the container disk is empty after idle; the Postgres ring is what keeps a signed-in cookie valid across that cold start.

Ask uses XAI:ApiKey when that value is set (environment variable XAI__ApiKey, a container-app secret, or a Development user secret). The host value wins, and Admin → AI is read-only. When postgres is on and a connection string is set, an administrator can set the key on Admin → AI instead. The plaintext is protected with this ring (purpose TimeWarp.Architecture.XaiApiKey, rewritten with the generated app's name) and stored in secrets.protected_secrets. The browser receives a status, never the key. Ask reads it on each turn. Without postgres, or with no connection string, Admin → AI only shows how to set the host value. When the host key is unset, Ask uses the signed-in user's key or the site key according to the site BYOK policy (Required, Allow, or Off on Admin → AI). That select is read-only when the host key is set.

Ingress topology

All public traffic enters through the YARP ingress, which owns the routing table (generated web /api prefixes, the api catch-all, /grpc prefix strip, and the public-host forwarding for web routes). Run mode loads that table from the yarp project. Publish mode (Compose, Kubernetes, Azure Container Apps) loads the same table from the AppHost onto the AddYarp image.

Azure

An existing AKS cluster is a Kubernetes target: point the kubectl context at it, use the cluster's registry (for example an Azure Container Registry) as registry-endpoint, choose the controller's class as ingress-class, and run the Kubernetes commands above. The Kubernetes target uses nothing Azure-specific, so the same chart runs on any cluster.

Azure Container Apps (Publish:Target=aca)

Choose ACA for a small or mostly idle app with no cluster to share; choose AKS (the Kubernetes target) when a cluster exists, is shared, or the deployment must stay portable. The publish-only AppHost provisions a Container Apps environment (no dashboard), ingress/web/api/grpc container apps (only the ingress external) and an Azure Database for PostgreSQL Flexible Server whose firewall rule is AllowAllAzureIps (the admin password is the barrier; aca-publish-tests pins the rule). The first deploy is dev deploy --target aca (publish, deploy, migrate, smoke, open the app; --no-browser prints the URL). dev deploy migrate --target aca --resource-group <rg> and dev open --target aca --resource-group <rg> are the one-step verbs. Remove it with dev deprovision --target aca.

Cost model, what the AppHost provisions, the deploy commands, the migration bundle by hand (firewall rule, connection string), where the Postgres credentials live, expected deploy problems (slow first deploy, "Server is busy", soft-deleted Key Vault names, web hop host) and deprovision detail: azure-container-apps.md.

Azure Container Apps + Neon (Publish:Target=aca-neon)

Same ACA publisher as aca, without Flexible Server and without the postgres Key Vault. Postgres is Neon. The operator guide (create the project, set the two secrets, one-command deploy, region, tear down, and the ACR Basic cost exception) is azure-container-apps-neon.md.

dev deprovision --target aca-neon deletes the Azure resource group only. It does not delete the Neon project.

Container-runtime neutrality