Phase 10 is an infrastructure phase, not a domain one. There are no new registration slices, UI workflows, or aggregate changes. The goal is to make the app behave like something you could actually deploy: real PostgreSQL habits, observability, health probes, and a publishable Aspire manifest.
From the ROADMAP, it sits after Phase 9 (exception scenarios) and before the optional Phase 11 (extended municipality features).
What Phase 10 delivers
Work item
Intent
PostgreSQL under Aspire
Confirm dev/prod-like runs use PG with a persistent volume and migrations applied reliably on startup
Full PG test coverage
Run the integration suite against Testcontainers PostgreSQL, not just migration smoke tests
Snake case naming
PostgreSQL-idiomatic table/column names via EF conventions
Structured logging (OpenTelemetry)
Logs/metrics/traces through ServiceDefaults, exportable via OTLP
Database health check
AddDbContextCheck<MunicipalDbContext>() on the existing /health pipeline
Production health endpoints
Expose /health and /alive outside Development, with caching and access restrictions
aspire publish manifest
Generate deploy artifacts for Azure Container Apps or Docker
OpenAPI published
API document available beyond local dev
What you already have (partial credit)
Several Phase 10 items were started in Phase 0 and never finished:
Already in place
AppHost + PostgreSQL — persistent volume, Web waits for DB:
3:9:src/SchaerbeekMunicipality.AppHost/AppHost.cs
var postgres = builder.AddPostgres("postgres")
.WithDataVolume()
.AddDatabase("schaerbeek");
builder.AddProject<Projects.SchaerbeekMunicipality_Web>("web")
.WithReference(postgres)
.WaitFor(postgres);
Snake case — applied for Npgsql in DependencyInjection and the migration test factory
Migrations on startup — but only for PostgreSQL in Development:
OpenAPI — registered, but MapOpenApi() is dev-only today
Testcontainers PG job — separate CI workflow, but only one migration test (PostgreSqlMigrationTests)
Still missing / incomplete
Production migration strategy (non-Development PG)
Full integration suite on PostgreSQL (ADR-0002 explicitly calls this out for Phase 10)
AddDbContextCheck — health today is just a "self" liveness check
Health/OpenAPI exposed outside Development with proper security
aspire publish manifest and deployment docs
Possibly richer structured logging configuration (OTLP export is wired but optional)
Architecture picture
mermaid
flowchart TB
subgraph dev ["Local dev (today)"]
AH[AppHost] --> PG[(PostgreSQL volume)]
AH --> Web[Web + Blazor]
Web --> PG
end
subgraph test ["Testing (today)"]
PR[PR CI] --> SQLite[SQLite fast suite]
Main[main CI] --> TC[Testcontainers PG]
TC --> MigOnly[Migration test only]
end
subgraph phase10 ["Phase 10 target"]
Web2[Web] --> PG2[(PostgreSQL)]
Web2 --> Health["/health + DbContext check"]
Web2 --> OTel[OpenTelemetry logs/traces]
Publish["aspire publish"] --> ACA[Azure Container Apps / Docker]
TC2[Testcontainers PG] --> FullSuite[Full integration suite]
end
Workstreams (suggested implementation order)
1. Database hardening
Run MigrateAsync() in non-Development when connected to PostgreSQL (or document a separate migration job if you prefer that for production)
Verify all migrations apply cleanly on a fresh PG instance
Confirm snake_case is consistent across migrations and the model snapshot
2. Health & observability
Add AddDbContextCheck<MunicipalDbContext>() in ServiceDefaults or Infrastructure DI
Extend MapDefaultEndpoints() per ADR-0003: enable /health and /alive outside Development with response caching and access restrictions (IP allowlist, auth header, or similar)
Verify structured logs flow through OpenTelemetry when OTEL_EXPORTER_OTLP_ENDPOINT is set
3. Test strategy expansion
Today: ~90 tests on SQLite via MunicipalAppFactory; 1 PG test for migrations
Phase 10: duplicate or parameterize the factory so the full integration suite can run against Testcontainers PostgreSQL (Category=PostgreSQL)
Decide CI placement: keep off PR critical path (current ADR) or promote to PR gate if fast enough
Update CI.md — it references “Phase 10 PostgreSQL options” but doesn’t spell them out yet
4. Deployment & API surface
Run aspire publish and commit or document the generated manifest (Azure Container Apps or Docker Compose)
Publish OpenAPI outside Development (e.g. /openapi/v1.json with appropriate access control)
Add a phase-10-*.md delivery doc when done
What Phase 10 is not
No registration features — exception scenarios (Phase 9), certificates (Phase 8), etc. stay separate
No real authentication — design system notes mention a login page “Phase 10+”, but the roadmap checklist doesn’t include Identity/OIDC; that would be a stretch or Phase 11 item
No Playwright E2E — design system mentions E2E as a natural CI slot, but it’s not on the Phase 10 checklist
No AppHost in CI — orchestration stays local; CI uses Testcontainers instead
How you’d demo it when done
dotnet run --project src/SchaerbeekMunicipality.AppHost — PG volume persists data across restarts; migrations apply
GET /health returns healthy including database check
aspire publish produces a manifest you can deploy to Docker or Azure
dotnet test --filter Category=PostgreSQL runs the full integration suite against real PostgreSQL
OTLP endpoint receives structured logs/traces when configured
Risks / decisions to make upfront
Decision
Options
PG test scope
Duplicate all integration tests on PG vs. shared fixture with provider switch
CI gate
Keep PG job on main only vs. require it on every PR
Prod migrations
Auto-migrate on startup vs. separate init container/job
Health exposure
Network restriction vs. shared secret header vs. both
Deploy target
Docker Compose (simpler) vs. Azure Container Apps (more “cloud native”)
Suggested scope for a first PR
A tight, reviewable Phase 10 PR might be:
AddDbContextCheck + production health endpoint mapping
MigrateAsync for non-dev PostgreSQL
Parameterized MunicipalAppFactory + port a representative subset of integration tests to PG
aspire publish manifest + short phase doc
OpenAPI in production and full PG duplication of every test could follow in a second PR.
Want me to start with a specific workstream (health checks, PG test expansion, or aspire publish), or draft a phase-10-postgresql-aspire-deployment.md plan doc first?
User
would there be somewhere where I can deploy this for free ?
Assistant
Checking deployment targets and stack constraints so recommendations match this project.
Yes — but with this stack there is no single “click deploy, free forever” option that matches Phase 10’s Aspire target perfectly. You need always-on compute (Blazor Server + SignalR) and PostgreSQL, plus persistent disk for uploaded documents (LocalFileDocumentStorage).
Here is a realistic map.
What makes this harder than a typical API
Requirement
Why it matters
Blazor Interactive Server
Needs stable WebSockets; serverless / scale-to-zero hosts often break circuits
PostgreSQL
SQLite-in-memory won’t work in production
File uploads
Many free PaaS disks are ephemeral — uploads disappear on restart
Single Web assembly
Fine — one container/service is enough
Phase 10’s aspire publish path (Azure Container Apps / Docker) is aimed at production-like deploy, not necessarily $0.
Best truly-free options
1. Oracle Cloud “Always Free” VM (most realistic $0 long-term)
Run Docker Compose on a small always-free VM (Ampere or AMD):
Web container (your published app)
PostgreSQL container with a volume
Optional volume for document uploads
Pros: Actually free long-term, full control, Blazor Server works, matches “Docker from aspire publish” mentally Cons: You manage the VM (updates, firewall, HTTPS via Caddy/Traefik), Oracle signup can be fiddly
For this project, Azure Container Apps is only part of the bill. You’d typically run:
Web (Blazor Server + API) → Container Apps
PostgreSQL → Azure Database for PostgreSQL Flexible Server (separate)
Uploads → local uploads/ folder today → needs Azure Files or Blob Storage on ACA (ephemeral disk otherwise)
Prices below are USD, pay-as-you-go, Consumption plan, roughly West/North Europe-ish. Use the Azure pricing calculator for your exact region and currency.
1. Container Apps (your Web app)
How ACA charges
On the Consumption plan you pay for:
Meter
Free grant / month
After free grant
vCPU-seconds
180,000 (~50 vCPU-hours)
~$0.000024 / vCPU-second (active)
GiB-seconds
360,000 (~100 GiB-hours)
~$0.000003 / GiB-second (active)
HTTP requests
2 million
~$0.40 / million
If minReplicas > 0 (which you almost certainly need for Blazor Server + SignalR), warm replicas also bill at lower idle rates (~0.000008/vC0.000001/GiB-s). Health probes are not billed.
User
Is there a way to host that on fly.io and when it's not used turn it off (and we accept the cold start)
Assistant
Checking Fly.io's current auto-stop and cold-start behavior for apps like this one.
[tool: web_search — Tool use: web_search]
[tool: web_search — Tool use: web_search]
[tool: web_search — Tool use: web_search]
[tool: web_search — Tool use: web_search]
Yes — Fly.io is a good fit for “turn it off when idle, accept cold starts,” and it’s usually cheaper than Azure Container Apps for that pattern. There are a few Blazor Server–specific caveats for your repo.
How “turn off when unused” works on Fly
Fly can autostop machines when there’s no traffic, and autostart on the next request. While stopped/suspended you pay no CPU/RAM — only small storage charges.
Typical fly.toml pattern:
toml
[http_service]
internal_port = 8080
auto_stop_machines = "suspend" # faster wake than "stop"
auto_start_machines = true
min_machines_running = 0
suspend — memory snapshot; wake often in hundreds of ms to a few seconds (not instant, but faster than full cold boot).
stop — full cold start; for .NET that’s more like 10–30+ seconds (runtime, app, EF, DB).
You can also fly machine stop / scale to 0 manually when you know you’re done.
Local file uploads (uploads/ via LocalFileDocumentStorage)
Concern
On Fly with autostop
Cold start
First visit after idle: wait for machine + app + DB. Fine if you accept that.
User
if the minReplicas is 0 for azure, the cost will be down and have the same inconvenients than idle of fly.io right?
Assistant
Checking how Azure Container Apps scale-to-zero behaves with WebSockets and cold starts versus Fly.
[tool: web_search — Tool use: web_search]
Yes — minReplicas = 0 on Azure Container Apps gives you the same kind of tradeoff as Fly autostop: much lower Web compute cost when idle, and the same class of inconveniences (cold start, dead Blazor sessions). But it’s not identical, and the total bill often stays higher than Fly because of PostgreSQL.
What’s the same
ACA minReplicas = 0
Fly autostop / suspend
Web CPU/RAM while idle
~$0 (scaled to zero)
~$0 (stopped/suspended)
Cold start on next visit
Yes
Yes
Blazor Server circuit
Lost when replica is gone
Lost when machine sleeps
User fix
Refresh, wait, start again
Same
Fine for occasional demo
Yes
Yes
Fine for always-on desk app
No
No
So your intuition is right: same inconveniences for the UI — first load after idle is slow, and any in-progress Blazor session is gone.
What’s different (important)
1. Cold start is usually worse on Azure
ACA scale-from-zero is a full cold start: pull image, provision, start .NET, EF, connect to DB. Microsoft’s own docs and issues cite ~10–30+ seconds for simple apps; a .NET + Blazor + EF app will often be slower than that.
Fly suspend can resume in seconds or sub-second in many cases; even Fly stop is comparable to ACA, not worse.
So: same inconvenience type, often worse duration on ACA.
2. PostgreSQL still costs money on Azure
minReplicas = 0 only scales down the Web app.
Azure PostgreSQL Flexible Server (B1ms + 32 GiB) still runs unless you stop it manually → roughly ~$16–17/month floor.
User
would it be possible to have two deployment scenarios? one with postgres and one with sqlite ?
Assistant
Checking how the codebase already switches between PostgreSQL and SQLite — that's the key to whether two deployment paths are realistic.
if (IsSqlite(connectionString ?? "Data Source=:memory:"))
{
await dbContext.Database.EnsureCreatedAsync();
}
else if (environment.IsDevelopment())
{
await dbContext.Database.MigrateAsync();
}
Mode
Connection string
Schema
Tests
Data Source=:memory:
EnsureCreated
User
could we azure deploy with sqlite? cost will be what?
Assistant
Checking Azure Container Apps persistent storage options and whether SQLite on them is viable.
[tool: web_search — Tool use: web_search]
[tool: web_search — Tool use: web_search]
Yes — you can deploy to Azure with SQLite, and it drops the ~$16–17/month PostgreSQL bill. But on Azure Container Apps it’s more awkward than on Fly, because persistence usually means Azure Files (SMB), and SQLite + SMB is a known pain.
Can you do ACA + SQLite?
Technically yes, with constraints:
Requirement
Why
maxReplicas = 1
SQLite = one writer; multiple ACA replicas will break
Persistent volume
Container disk is ephemeral; you need the .db to survive restarts
Azure Files mount
ACA’s usual persistent option — not ideal for SQLite
Blazor Server
Still minReplicas = 0 or 1 — same cold-start/session tradeoffs as before
Free for public images; private repos have generous free limits for personal use
Common pattern: GitHub Actions builds the image on push → pushes to GHCR → Azure/Fly pulls from there
So you can deploy to Azure without paying for ACR by hosting the image on GitHub instead.
Quick comparison
ACR
GHCR
Who runs it
Microsoft Azure
GitHub
Typical cost (hobby)
~$5/mo (Basic)
$0 for public images
Fits well with
Azure-only deploy, aspire publish
GitHub Actions, open-source demos
Auth
Azure credentials / managed identity
GitHub token / GITHUB_TOKEN in Actions
Do you need one?
Yes, for ACA — Container Apps needs an image URL from some registry (ACR, GHCR, Docker Hub, etc.).
Not always for Fly — you can fly deploy and Fly builds and stores the image for you (their registry, included in normal Fly usage).
For your project
For a cheap Azure ephemeral-SQLite demo:
GHCR → avoid the ~$5/mo ACR line item
ACR → nicer if Phase 10 is fully Azure-native and you want everything in one subscription
Both are just where the container image lives — not part of your app logic, and unrelated to SQLite vs PostgreSQL.
User
Ok, so for phase 10 - could we have a deployment scenario with SQLite for Azure - In fact production will run on azure with sqlite but local will run with PostgreSQL.
It would be nice to have also the script to run it on azure with PostgreSQL also if we decide it too.
Let's use the GHCR instead of ACR if possible, if anything need to be configured let me know.
Make sure also to update the documentation
Assistant
Exploring the repo's Phase 10 baseline and deployment-related files so we can plan Azure SQLite (primary) and optional PostgreSQL.
I have enough context. Creating a Phase 10 plan focused on Azure deployment (SQLite primary, PostgreSQL optional) via GHCR.
[tool: ask_question — Tool use: ask_question]
[tool: create_plan — Tool use: create_plan]
User
Implement the plan as specified, it is attached for your reference. Do NOT edit the plan file itself.
To-do's from the plan have already been created. Do not create them again. Mark them as in_progress as you work, starting with the first one. Don't stop until you have completed all the to-dos.
Assistant
Implementing Phase 10 per the plan, starting with application hardening.
[tool: run_terminal_command_v2 — Tool use: run_terminal_command_v2 • Run command: cd /Users/[user]/Projects/Private/dotnet/SchaerbeekMunicipality/deploy/azure/sqlite && bash -c ' PARAMETERS_FILE=parameters.json read_paramet]
That was a script bug: deploy.sh only looked at the CONTAINER_IMAGE environment variable and ignored parameters.json, even though it passed that file to az deployment.
Fixed. The script now:
Reads containerImage from parameters.json when CONTAINER_IMAGE is not set
Uses CONTAINER_IMAGE as an override when you do set it
Prints the resolved image before deploying
With your current parameters.json (ghcr.io/jobijoba/schaerbeek-municipality-web:latest), you can run:
bash
cd deploy/azure/sqlite
./deploy.sh
No export CONTAINER_IMAGE=... needed unless you want to override the file for one run.
Pros: No DB ops on a VM; connection string only Cons: Free app tiers often sleep when idle (bad for Blazor Server demos), upload storage still ephemeral unless you add blob storage
Works for occasional demos, not a reliable always-on desk app.
3. Don’t deploy — tunnel your local AppHost (best for showing someone quickly)
You already run:
bash
dotnet run --project src/SchaerbeekMunicipality.AppHost
Pros: $0, zero Phase 10 work, full Aspire + PG + volumes Cons: Only works while your laptop is on; not real hosting
Great for interviews / class demos.
Options that are “free-ish” but not really $0
Platform
Verdict
Azure Container Apps (Phase 10 target)
Consumption-based; not free. Fine if you have Azure for Students / trial credits
Azure App Service F1
Exists but very limited; still need external Postgres; poor fit for a real Blazor app
Google Cloud Run
Generous free tier, but serverless + WebSockets = painful for Blazor Server
Render / Railway free
Render free web sleeps; Railway is basically paid now
Fly.io
Small free allowance; may need a card; can work with tuning
GitHub Pages / Netlify / Vercel
Static only — won’t host Blazor Server
What I’d recommend for this project
If you want $0 and don’t mind ops:
Oracle Always Free VM + Docker Compose (Web + Postgres + upload volume). After Phase 10, aspire publish can still generate the Docker/manifest pieces you compose by hand.
If you want least ops and only occasional demos:
Neon (Postgres) + Fly.io or Koyeb, accept cold starts and ephemeral uploads (or switch document storage to something like Cloudflare R2 free tier later).
If you just want to show it working:
Keep AppHost local + Cloudflare Tunnel — zero hosting cost, no Phase 10 required.
If you want to learn the “Microsoft path”:
Use Azure credits (student/trial) + Container Apps + Azure Database for PostgreSQL Flexible Server — educational, but not permanently free.
Practical caveats before you deploy
Migrations — today PG migrations only run in Development; Phase 10 should fix startup migrate for deployed environments.
Health endpoints — /health is dev-only today; orchestrators need Phase 10’s production mapping.
OpenAPI — also dev-only today.
HTTPS — you’ll need a reverse proxy or platform TLS.
Document storage — LocalFileDocumentStorage needs a persistent volume or blob store on any host.
Bottom line: Yes, you can host this for free, but the sweet spot is either a free VM + Docker (best long-term $0) or tunnel local AppHost (best zero-effort demo). Pure “free PaaS + Blazor Server + Postgres” without compromises is hard.
If you say which you care about most — always-on portfolio URL, learning Azure, or 5-minute demo — I can narrow it to one concrete path and the exact services to wire up (still in Ask mode; switch to Agent mode if you want Phase 10 + deploy config implemented).
P
U
−
s,
There is no fixed monthly fee for a basic Consumption environment (no VNet/private endpoint). Avoid private endpoints/VNet unless you need them — they can add ongoing cost even when the app is stopped.
Using GitHub Container Registry instead of ACR can drop the registry cost.
Total monthly estimates
A) Always-on portfolio demo (realistic ACA path)
Component
Cost
ACA Web (0.5 vCPU, 1 GiB, min 1 replica)
~$10
PostgreSQL B1ms + 32 GiB
~$17
Files + misc
~$2–5
Total
~$25–35/month
In EUR, think ~€25–35/month (region-dependent).
B) Dev / occasional use (stop DB when idle)
Component
Cost
ACA Web (always on)
~$10
PostgreSQL (stopped most of the time)
~$4 storage only + compute when running
Total
~$15–20/month average if DB is off a lot
C) “Proper” small production
Component
Cost
ACA (1 vCPU, 2 GiB, min 1)
~$20
PostgreSQL General Purpose (e.g. D2s)
~$80–120+
Monitoring, registry, files
~$10–20
Total
~$110–160+/month
Overkill for this educational app unless you want production-grade DB.
D) Scale-to-zero ACA (not recommended)
Theoretically ~$0–5/month for compute if minReplicas = 0, but Blazor Server will be unreliable (cold starts, dropped SignalR). Fine for a stateless API, not for your UI.
What aspire publish likely adds
Phase 10’s Aspire path typically provisions something like:
Container Apps environment + Web container
Connection to managed PostgreSQL (or you wire it manually)
Possibly Log Analytics workspace
Ingress, secrets, health probes
It does not magically make hosting free — it generates the wiring, not a free tier.
Use Azure for Students ($100 credit) or new-account trial credits for a few months.
Set a budget alert in Azure Cost Management (e.g. €30/month).
Don’t run Dedicated ACA workload profiles unless you need them — those have base management fees.
Bottom line
For Azure Container Apps + managed PostgreSQL as a small always-on demo of this repo:
Expect about 25–35/month(€25–35)∗∗foraworkablesetup.∗∗Floorwithaggressivecostcontrol∗∗(tinyACA+DBstoppedwhenidle):∗∗15–20/month. Not realistically $0 on Azure without credits.
The database is usually half or more of the bill; Container Apps itself is often ~$10–15/month for a single warm Blazor replica.
If you want, I can sketch a minimal Azure architecture (which SKUs to pick in the pricing calculator, and what to avoid for Blazor Server) — still in Ask mode, so guidance only unless you switch to Agent mode for Phase 10 implementation.
Active session when machine stops
Circuit dies. User must refresh and start over. Expected with scale-to-zero.
Multiple replicas
Avoid for Blazor Server unless you implement sticky routing (Fly-Replay). Use min_machines_running = 0 and max 1 machine in one region.
WebSockets
Supported on Fly; Blazor Server can work with a single instance.
Uploads
Container disk is ephemeral → mount a Fly volume at uploads/ or switch to object storage later.
Migrations
Run on startup (Phase 10 item); adds a bit to cold start.
So: yes for a personal demo / portfolio where you’re okay with “first load is slow” and “idle = session lost.” Not great for “always-on municipal desk” UX.
Database: you need it to sleep too
If only the Web app stops but something keeps a DB connection open, Postgres never idles and you keep paying for it.
Option A — Fly Postgres (Development, scale-to-zero)
Single-node dev cluster can FLY_SCALE_TO_ZERO = "1h" — shuts down after 1 hour with zero open connections.
App must release connections when it stops (normal if the Web machine is also stopped).
On wake: app must tolerate DB starting (retry connection / longer health check).
Option B — Neon (often easier for this pattern)
Free tier Postgres that scales to zero on its own.
Fly Web app connects via connection string; both can sleep independently.
Good pairing: Fly (app) + Neon (DB) for minimum cost.
For “I only use it sometimes,” Neon + Fly autostop is often simpler than coordinating two Fly apps.
Rough cost when mostly off
When machines are stopped/suspended:
What
Cost while idle
Web machine CPU/RAM
$0
Web rootfs (~300MB–1GB image)
~$0.05–0.15/month
Postgres volume (Fly PG)
~0.15/GB/month∗∗(e.g.1–3GB→∗∗0.15–0.45)
Neon free tier
$0 within limits
Bandwidth
negligible for personal use
When you do use it (e.g. 10 hours/month):
Resource
Ballpark
shared-cpu-1x + 512MB–1GB RAM
~$0.50–1.50 for those hours
Fly Postgres dev (while running)
small on top of volume
Total hobby pattern
often ~1–5/month∗∗vs∗∗25–35 on Azure
Use the Fly calculator for your region (e.g. ams for Belgium).
What cold start feels like in practice
You open the URL after a day away.
Fly starts the machine (suspend: few seconds; stop: longer).
.NET starts, EF runs migrations (if configured), connects to DB.
If DB was also asleep (Neon / Fly PG scale-to-zero), another few seconds.
Blazor loads; you log in via role switcher and use the app normally.
If the machine stops while you’re on a case, the UI will hang or error — refresh and you’re back (case data is in Postgres, not the circuit).
Practical Fly setup for this project
Dockerfile for SchaerbeekMunicipality.Web (Phase 10 Docker manifest fits here).
fly.toml with auto_stop_machines = "suspend", min_machines_running = 0, one region (e.g. ams).
512MB–1GB RAM — 256MB is tight for .NET 10 + Blazor.
Postgres: Neon connection string or Fly PG dev with scale-to-zero.
Volume mounted at uploads/ so document previews survive restarts.
Connection string + MigrateAsync() on non-SQLite startup (Phase 10).
fly scale count 1 max — don’t autoscale to multiple Blazor instances without sticky sessions.
Compared to Azure Container Apps for your goal
Fly.io (autostop)
Azure ACA
Idle cost
Very low
~$10+/mo if minReplicas = 1
Cold start
Yes, acceptable
Scale-to-zero breaks Blazor badly
Blazor Server
OK with 1 machine
OK with minReplicas = 1 (always billing)
Your use case
Better fit
Better for always-on prod
Bottom line
Yes — Fly.io with auto_stop_machines = "suspend" and min_machines_running = 0, plus a DB that also sleeps (Neon or Fly PG dev scale-to-zero), is a realistic way to host this project for a few dollars a month and accept cold starts.
The main things to plan for:
Single machine (Blazor Server)
Persistent volume for uploads
DB wake-up retries on first request
Users refresh after idle — sessions don’t survive sleep
If you want, I can outline a concrete fly.toml + Dockerfile layout for this repo (Ask mode — guidance only; switch to Agent mode to implement Phase 10 + Fly deploy files).
On Fly you can pair with Neon or Fly PG dev (scale-to-zero) so both app and DB sleep. That’s why Fly can land at ~1–5/month∗∗idlevsAzure∗∗16+ even with minReplicas = 0.
3. “Idle” may not happen while a tab is open
Blazor Server keeps a WebSocket open. While that circuit is alive, the platform may treat the app as “active” and not scale to zero.
So:
Close the tab → can scale down after cooldown (ACA has scale-down stabilization, often minutes).
Leave the tab open overnight → replica may stay up → you’re billed (ACA idle rates, or Fly machine running).
Same pattern on both platforms.
4. Small storage charges when “off”
Both still bill a little for images/volumes when stopped (ACA registry storage, Fly rootfs/volumes). Usually cents to a few dollars — not the main line item.
Cost comparison (your use case)
Occasional demo, accept cold starts:
ACA minReplicas = 0
Fly + sleeping DB
Web when idle
~$0
~$0
Database when idle
~$16–17/mo (unless stopped)
~$0–1/mo (Neon / Fly PG scale-to-zero)
When you use it
Pay per second for Web
Pay per second for Web
Typical total
~$17–25/mo
~$1–5/mo
So: minReplicas = 0 cuts ACA Web cost a lot, but doesn’t make Azure “as cheap as Fly” unless you also stop Postgres when not demoing.
Bottom line
minReplicas = 0 ≈ same user-facing downsides as Fly idle (cold start, session loss). Not the same total cost — Azure DB keeps billing. Cold starts on ACA are often slower than Fly suspend.
If you went Azure with scale-to-zero, a workable pattern would be:
minReplicas = 0, maxReplicas = 1 (Blazor Server)
Stop PostgreSQL when not using it (biggest saver)
Longer startup/liveness probes for .NET cold start
Accept 10–30s first load after idle
For “turn it off when I’m not using it and I don’t care about cold start,” Fly (+ Neon) matches that goal better than ACA minReplicas = 0 with managed Azure Postgres.
Aspire dev
Npgsql from AppHost
MigrateAsync (Development only)
SQLite deploy
Data Source=/data/schaerbeek.db
EnsureCreated (already)
Postgres deploy
Npgsql URL
MigrateAsync (needs Phase 10 fix for non-Dev)
So one Docker image, two configs is realistic — mainly connection string + volume layout.
Two deployment scenarios
Scenario A — SQLite (“cheap demo”)
Best for: Fly.io autostop, single container, no DB bill.
code
┌─────────────────────────────┐
│ Web container │
│ ├── app │
│ ├── /data/schaerbeek.db │ ← Fly volume
│ └── /app/uploads/ │ ← same volume or second
└─────────────────────────────┘
Connection string: Data Source=/data/schaerbeek.db
Schema: EnsureCreatedAsync() (no migrations on SQLite — ADR-0002)
Cost: no separate database service
Caveats: single-writer, file backup = copy the .db, not “real prod” Postgres
Scenario B — PostgreSQL (“production-like”)
Best for: Aspire publish, Azure ACA, learning real ops.
Schema: MigrateAsync() on startup (or migration job)
Cost: ~$16+/mo on Azure unless DB is stopped
Matches Phase 10 and migration CI
Same image, different deploy config
You wouldn’t need two codebases — only different env/config:
Setting
SQLite demo
PostgreSQL
ConnectionStrings__schaerbeek
Data Source=/data/schaerbeek.db
Host=...;Database=schaerbeek;...
Volume
Required (DB + uploads)
Uploads only (DB external)
Second service
None
Postgres (Fly PG / Neon / Azure)
Phase 10 focus
Dockerfile + volume
Migrations, health check, aspire publish
Example Fly layouts:
fly.sqlite.toml — one app, one volume, SQLite connection string
fly.postgres.toml — Web app + Neon/Fly PG connection string
Or one fly.toml and set secrets per environment.
Important caveats (SQLite in production)
1. Migrations don’t apply to SQLite
Migrations are PostgreSQL-specific (uuid, Npgsql types, etc.). SQLite uses EnsureCreated from the EF model — same as integration tests.
That’s fine for a demo, but:
Schema changes must work in both the model (SQLite) and migrations (PG)
SQLite prod won’t catch migration bugs — PG CI job still matters
ADR-0002 already documents this split
2. Provider differences can slip through
Collation, case sensitivity, some SQL edge cases may differ. The fast SQLite suite won’t catch everything PG would.
3. SQLite limits
One writer at a time (OK for a solo demo, weak for multi-officer)
No separate DB to scale or stop independently
Backup = snapshot the file while app is quiet
4. Small code gap for PG production
Today MigrateAsync runs only when IsDevelopment(). For PostgreSQL deploy you’d want migrations in Production too. SQLite path doesn’t need that change.
5. Table naming is already fine
ToTable("registration_cases") etc. is explicit — works on both providers.
Does this fit your hosting goals?
Goal
Better scenario
Fly autostop, ~$1–5/mo
SQLite + volume
Phase 10 / Azure / “real” deploy
PostgreSQL
Local dev
Aspire + Postgres (unchanged)
Fast CI
SQLite (unchanged)
SQLite-on-Fly is a strong “portfolio / occasional demo” path; PostgreSQL is the “production habits” path. They complement each other well.
Suggested documentation shape (Phase 10)
You could document two profiles without over-engineering:
So: yes, Azure deploy with SQLite is possible and much cheaper than Azure + Postgres, but it’s a demo-tier setup on ACA, not something I’d document as equal to the PostgreSQL path.
What you’d configure (conceptually)
Same Docker image as Postgres deploy; only config changes:
Phase 10 would add MigrateAsync for PostgreSQL only; SQLite keeps EnsureCreated.
Bottom line: Azure + SQLite can land around ~1–8/month∗∗(scale−to−zero)vs∗∗25–35 with managed Postgres — but Fly + SQLite is simpler for the same idea. Azure + SQLite is a reasonable budget demo profile if you accept SMB workarounds and a single replica.
If you want both profiles in Phase 10, a clean split would be:
deploy/azure-postgres/ — production-like
deploy/azure-sqlite/ — cheap demo (with the caveats above)
This is about as cheap as Azure gets for this app — comparable to Fly autostop + SQLite, without the Files headache.
ACA config that fits
minReplicas: 0 — save money, accept cold start
maxReplicas: 1 — Blazor Server + SQLite (one writer)
Connection string: SQLite on local path
No DB volume
Optional: slightly longer startup probe so .NET + EnsureCreated + seeding don’t get killed mid-boot
No code changes strictly required beyond deploy config and maybe a documented connection string for the “ephemeral demo” profile.
One thing to be aware of
Uploads disappear on the same schedule as the DB — LocalFileDocumentStorage writes under uploads/ on container disk. For a demo where you open a case, attach a PDF, and show the flow in one session, that’s usually fine. If the machine sleeps mid-demo, you lose cases and files.
If you ever wanted only uploads to persist, you could add a small Azure Files mount for uploads/ only — but you don’t need that if a full reset is OK.
How this fits your three profiles
Profile
DB
Persist?
Best for
Azure ephemeral SQLite
SQLite
No
Cheapest Azure demo
Fly SQLite
SQLite
Optional (volume)
Cheapest + simplest SQLite hosting
Azure / Aspire PostgreSQL
Postgres
Yes
Phase 10 “production-like”
Bottom line: Ephemeral SQLite on ACA is totally viable with your current code, avoids the Azure Files + SQLite problems, and should cost roughly $0–5/month if you scale to zero and skip paid extras. You trade away all state on every cold start — which sounds exactly like what you want.
Worth documenting in Phase 10 as a third deploy profile: azure-sqlite-ephemeral (or similar). Switch to Agent mode if you want that written into the repo.