Skip to content

The hosting cloud and the Postgres host: move to AWS early, or stay on Azure for the credits #358

Closed

Description

@allisonmahmood

Part of #294.

Question

Which cloud hosts Patchy through the tier 2 build, and where does company Postgres live? The Neon research (#354 (comment)) made this a decision: Neon is AWS-only now, no cloud credit pays for it, and it fits ADR-0009 unchanged, so choosing it while the containers stay on Azure buys a cross-cloud hop on every callback for the whole Azure period. Azure's remaining argument is its credit balance, and its subscription refuses managed Postgres in eastus and eastus2 (provisioning).

Product context. Nothing is in production. The execution-service spike (#311) is about to run on Azure Container Apps and its ADR (#298) will name the containment unit and the wake path; those are shaped by the cloud they run on.

Inputs Allison brings: the remaining Azure credit and its expiry, the Neon grant's balance and expiry, and the AWS credit.

What lifts to AWS and what does not (the session's audit of the code and the map, 2026-09-23):

  • Code: only the Azure Blob layer in packages/content-store is Azure-specific, behind the store interface beside a filesystem layer; an S3 layer is one file plus an IAM role. No Container Apps env vars, Key Vault or Azure headers anywhere else. Postgres, Clerk and PostHog are neutral.
  • Plan: one workerd process per company in a scale-to-zero container is Container Apps shaped. Fargate has no request-driven wake: keep a task warm per company, build a wake path in the broker with a 30 to 60 s cold start, or pool companies and give up the company as the containment unit. This is the one real flag.
  • Plan: the seven-document HTTP/2 check and fetch-streamed SSE were proven on Container Apps ingress; an ALB needs its idle timeout raised from 60 s and the check re-run, not a redesign.
  • Easier on AWS: egress lockdown is a security group with no outbound rule (Azure needed a workload-profiles VNet environment that never finished provisioning); the isolation escalation is one Fargate task per company, AWS's documented kernel boundary; Neon becomes intra-region.
  • Cost of moving: whatever Azure credit is forfeited; the Azure Terraform outside the repo is rewritten; the spike group is disposable at about $20 a month.
  • The Postgres refusal itself is a subscription limit lifted by a support request; it is evidence Azure is awkward, not that it cannot host us.

Consequences. Move now: the spike runs on ECS Fargate against Neon us-east-1, the ADR names Fargate's wake path, and the database never migrates. Stay: the spike runs as planned on Container Apps, Postgres is Flexible Server in centralus (28 ms away, one dump/restore at the later move) or Neon cross-cloud after a measured latency test, and the ADR must name Fargate's wake path anyway so the later move is not a redesign.

Recommendation. If the remaining Azure credit is modest, move now, before the spike bakes Container Apps shapes into the ADR; put Neon in us-east-1 at 1 CU always-on on direct connections, pre-warmed when a tier 2 document opens, with RDS as the fallback if the Neon runway is short. If the Azure credit is large, stay, take Flexible Server in centralus for now, and write the Fargate wake path into the ADR as the portable shape.

Output: the decision recorded here, the map's hosting note rewritten, and #311's target cloud fixed before it starts.

Activity

  1. added
    wayfinder:grilling
    on Sep 23, 2026
  2. allisonmahmood commented on Sep 25, 2026

    @allisonmahmood
    OwnerAuthor

    Resolution

    One round with Allison on 2026-09-25, pressure-tested by astra beforehand (brief and reply kept off the tracker; the useful parts are folded in below). Allison had reviewed the credit balances herself: there is plenty on Azure, AWS and Neon, so the balances did not decide this. She chose AWS and Neon outright; the Azure credit goes to other things.

    Decided

    1. Patchy hosts on AWS from here. The execution-service spike runs on ECS Fargate in us-east-1, and its ADR names Fargate's shapes as the model. Nothing from this repo has ever been deployed, so nothing migrates. The Azure group rg-patchy-prod belongs to an earlier, separate Patchy codebase (a kernel and web pair with Daytona sandboxes, created 2026-07-01 before this repo existed); it is not this project's production and this map says nothing about it. PatchPage stays on Azure and keeps spending that credit.
    2. Company Postgres is Neon, in us-east-1, one project, one database per company, exactly ADR-0009 on direct connections. The production compute runs with suspend disabled so the five-second held transaction never meets a cold start; the compute is pre-warmed when a tier 2 document opens as a free win on top. Neon's own grant pays for it; Allison also expects to use Neon for other things. RDS stays named as the plain-Postgres fallback and is not provisioned.
    3. The wake path is a pool of pre-started, unbound execution tasks, bound to a company on first open. This is the portable answer to Fargate having no request-driven scale-to-zero. The company stays the containment unit: a task is one company's for its lifetime, released to be replaced (not reused) when the company goes idle. First open after dormancy feels like a page load, a few seconds to first result, and dormant companies cost nothing; idle cost is the handful of pooled tasks. The runtime owns a small controller: company to task binding, wake races (two documents opening at once bind once), failed starts, release on idle, rollouts. A mutation's transaction never opens while a task is binding; the client sees the loading state from the lifecycle stream. The execution-service ADR (The execution service: engine, containment unit, invocation capability and the callback path #298) records this shape and the spike (Prototype: the execution-service spike on ECS Fargate, a handler bundle in a credential-free task against Neon #311) measures bind time.

    What astra pushed on and where it landed

    • "The wake path is a product constraint, not plumbing": accepted, and it became the pool shape above rather than a warm task per company (roughly $9 a month each, a fixed cost for every dormant company) or a 30 to 60 second first open.
    • "Approve the Fargate spike, defer the cloud call until it measures": Allison made the call directly; the spike's target is the decision in practice, and a Fargate spike with the pool either proves the shape or sends us back with numbers.
    • Real AWS costs beyond the wake path, carried to the provisioning task and the spike: the task's bootstrap needs a path to the registry, secrets and logs while patch code needs none, so the no-outbound security group applies to the workerd task's patch-facing side and private endpoints or NAT are a fixed cost to note; the ALB's idle timeout must be raised for SSE and reconnects tested through a deployment drain, not only seven stationary documents; ECS task and execution roles, quotas and observability are operator work that the spike's awkward list must record.
    • "Neon provisionally, suspend disabled, and measure held-transaction contention": accepted as written; the four measurements from the Neon research move into the spike, now from an AWS host only. The 500-databases-per-branch cap is the second placement server, already ADR-0009's shape.

    What this changes on the map

    • The hosting note is rewritten: AWS, not "Azure now, AWS later"; the portability rule is "one container image and a portable wake path", not "no managed services".
    • The execution-service spike is retargeted to ECS Fargate against Neon; the execution-service ADR ticket drops "Container Apps now, AWS later" and gains the pool wake path as an input.
    • A new task ticket provisions the AWS side (account, IAM, an ECS cluster and registry in us-east-1, the Neon project, keys under ~/.config/patchy-cloud/) and retires the Azure spike group; it blocks the spike the way the Azure provisioning did.
    • Code: an S3 content-store layer beside the Azure Blob one is build work, not a decision; it lands with the AWS deployment, not on this map.

    Recorded by Claude Fable 5.1 via Claude Code, 2026-09-25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

wayfinder:grilling

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions