BreezRx · Runbook & plan · Read mode

Local & Cloud Deployment Plan

How to run the BreezRx investor POC on one machine with Docker Compose today, and a staged, honest plan for a future AWS production environment. Nothing has been deployed to any cloud.

1. Deployment status

EnvironmentStatusNotes
Local Docker (single host)POC contractCompose project breezrx. The web app is published on host 127.0.0.1:3100 → container 3000. The API is internal on 4000. PostgreSQL 16 is on the named volume pg-data. The parent session validates with a real docker compose up
AWS dev / stage / prodDoes not existNo AWS account, VPC, cluster, database, DNS name or BAA exists for BreezRx. Every cloud section below is Proposed
Why port 3100, not 3000

On the reference workstation, host port 3000 is already used by an unrelated service (an Open WebUI container). The Compose file therefore publishes 127.0.0.1:3100:3000. Inside the container, Next.js still listens on 3000. Leave the other service alone, and do not "fix" the conflict by stopping it.

2. Run the POC locally

Prerequisites

  • Docker Engine 24+ with the Compose v2 plugin (docker compose version). Docker Desktop works too.
  • Host port 3100 free on loopback. Check with ss -ltn 'sport = :3100' on Linux or lsof -iTCP:3100 -sTCP:LISTEN on macOS.
  • About 2 GB of free disk for images and build cache. Network access to the npm registry for the first build.
  • No .env file and no secrets are needed. Do not add any.

Start

# from the repository root (where compose.yaml lives)
docker compose up --build -d

# confirm both services are running and the API is healthy
docker compose ps

# health through the web proxy (the API itself is not published)
curl -fsS http://localhost:3100/api/health
# expected: {"status":"ok","demo":true}

# open the storefront
xdg-open http://localhost:3100   # Linux; use "open" on macOS

The project name breezrx is set in the Compose file, so -p is not needed. If your Compose version ignores the top-level name:, run docker compose -p breezrx … consistently.

Demo walkthrough (smoke test)

  1. Open http://localhost:3100. Add an over-the-counter product as Autoship, open the bag and choose Sign in to checkout. Create an account (use an @example.test address).
  2. At checkout, add a shipping address, then a card (4242 4242 4242 4242, any future expiry, any CVC) and Place order. The order and the autoship appear under Account; the address and card are saved for one-tap checkout next time.
  3. Choose an Rx product, complete the doctor evaluation, then check out. The card is authorized and the order shows Awaiting doctor review. In /ops, approve the evaluation: a prescription is issued, the payment is captured and the order is confirmed. Advance it through packed → shipped → delivered.
  4. In /ops → Autoship, use Renew now to create a renewal order charged to the saved card. Card 4000 0000 0000 0341 attaches but declines on charge, so the subscription becomes past due.
  5. Run docker compose restart, then reload. Everything is still there, served from the Postgres volume breezrx_pg-data.

API checks from the host (optional)

curl -fsS http://localhost:3100/api/catalog | head -c 400; echo
curl -fsS -X POST http://localhost:3100/api/graphql \
  -H 'content-type: application/json' \
  -d '{"query":"{ products { id name priceCents prescriptionRequired } }"}'
# Expect a connection error when trying to reach the API directly (it is not published):
curl -sS --max-time 3 http://localhost:4000/api/health || echo "API not exposed on host (expected)"

Note: another program on your machine could be listening on 4000. That would not be BreezRx. Check with docker compose port api 4000, which prints nothing when the API is not published.

3. Compose topology (expected)

POC local runtime topologyBrowser on host loopback port 3100 reaches the web container on port 3000, which proxies /api to the internal API on port 4000, which reads and writes PostgreSQL 16 (service db) on the named volume pg-data.Host (loopback only)Docker Compose project “breezrx” · private networkBrowserlocalhost:3100web · Next.js 16container :3000React 19 · standaloneapi · Express 5Node 22 · :4000internal onlydb (Postgres 16)volume pg-data:5432 internal127.0.0.1:3100→ :3000/api/* rewritepg poolSQL migrationsAPI_INTERNAL_URL=http://api:4000no host port · DEMO_MODE=true
Figure 1. Local topology. Only the web container is reachable from the host, and only through loopback port 3100.
ServiceBuildPortsEnvironmentStorage
webapps/web/Dockerfile (Next.js standalone, runs apps/web/server.js as user node)127.0.0.1:${WEB_PORT:-3100}:3000 (host loopback only; depends_on: api service_healthy)Compose: API_INTERNAL_URL=http://api:4000. Image: HOSTNAME=0.0.0.0, PORT=3000none
apiapps/api/Dockerfile (multi-stage, runs as node user)expose: 4000 only, no ports:NODE_ENV=production, DEMO_MODE=true (required; the API refuses to start without it), HOST=0.0.0.0, PORT=4000, DATABASE_URL=postgres://…@db:5432/breezrx, SCHEDULER_INTERVAL_MS=30000Named volume demo-data mounted at /data
Shape of the root compose file (abridged; compose.yaml is canonical)
name: breezrx
services:
  db:
    image: postgres:16-alpine
    environment: { POSTGRES_USER: breezrx, POSTGRES_DB: breezrx, POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-breezrx_local_dev} }
    volumes: [pg-data:/var/lib/postgresql/data]
    ports: ["127.0.0.1:${PG_PORT:-5544}:5432"]     # loopback only, for psql inspection
    healthcheck: pg_isready
  api:
    build: { context: ., dockerfile: apps/api/Dockerfile }
    environment:
      NODE_ENV: production
      DEMO_MODE: "true"
      DATABASE_URL: postgres://breezrx:…@db:5432/breezrx
      SCHEDULER_INTERVAL_MS: "30000"
    depends_on: { db: { condition: service_healthy } }
    expose: ["4000"]                 # internal network only
  web:
    build: { context: ., dockerfile: apps/web/Dockerfile }
    environment: { API_INTERNAL_URL: http://api:4000 }
    ports: ["127.0.0.1:${WEB_PORT:-3100}:3000"]
    depends_on: { api: { condition: service_healthy } }
volumes:
  pg-data: {}

The API image ships a HEALTHCHECK that calls /api/health inside the container. That lets depends_on: service_healthy hold the web app back until migrations have run and the catalog is seeded. The db row: postgres:16-alpine, loopback 5544, volume pg-data.

4. Local operations

TaskCommand
Follow logsdocker compose logs -f api web
Stop (keep data)docker compose stop or docker compose down
Restartdocker compose restart
Rebuild after code or lockfile changedocker compose up --build -d
Find the data volumedocker volume ls --filter name=breezrx (normally breezrx_pg-data)
Reset demo data (deletes all demo orders)docker compose down -v && docker compose up --build -d. Migrations re-run and only the catalog is re-seeded. To remove just e2e accounts: docker compose exec -T db psql -U breezrx -d breezrx < scripts/purge-test-accounts.sql
Back up the databasedocker compose exec -T db pg_dump -U breezrx -Fc breezrx > breezrx.dump. Do not commit the dump
Restore the databasedocker compose exec -T db pg_restore -U breezrx -d breezrx --clean --if-exists < breezrx.dump
Inspect with psqldocker compose exec db psql -U breezrx -d breezrx
Remove everythingdocker compose down -v --rmi local
Keep it on loopback

Customer accounts are real, but the /ops console is open to any signed-in user and the payment gateway is a mock. Do not change the publish address to 0.0.0.0, put it behind a public tunnel, or deploy the image to a shared host. Never enter real names, health information, documents or payment details.

5. Troubleshooting

SymptomLikely causeFix
Bind for 127.0.0.1:3100 failed: port is already allocatedAnother process uses 3100Find it (ss -ltnp 'sport = :3100'). Stop that process if it is yours, or pick another loopback port: WEB_PORT=3200 docker compose up -d. Do not touch port 3000's owner
API container restarts with "Refusing to start … DEMO_MODE=true"Environment missingMake sure the Compose file sets DEMO_MODE: "true"
Web returns 500 or 502 on /api/*API unhealthy or wrong API_INTERNAL_URLdocker compose ps; docker compose logs api; the URL must be http://api:4000
API logs ECONNREFUSED db:5432Postgres still starting or unhealthydocker compose ps db; docker compose logs db. The API waits for service_healthy and retries
password authentication failedPOSTGRES_PASSWORD changed after the volume was initializedUse the original password, or reset with down -v (deletes data)
npm ci fails during buildLockfile out of syncRun npm install at the root on the host, then rebuild
Old UI after changesCached imagedocker compose build --no-cache web

6. Cloud prerequisites Proposed

None of these exist yet. They are ordered by dependency and must be finished before any real PHI exists.

#PrerequisiteOwnerEvidence
P1Legal entity, licensed pharmacy/operator model and launch states chosenCEO + counselDecision record (TD risk R-02)
P2AWS Organization with separate accounts: management, security/audit, log-archive, shared-services (ECR, CI), dev, stage, prodPlatformAccount list; SCPs applied
P3AWS BAA accepted (AWS Artifact) for every account that may hold PHI. Each service used for PHI checked against the current HIPAA-eligible listComplianceArtifact acceptance record; eligibility memo
P4IAM Identity Center + corporate IdP SSO; no IAM users; phishing-resistant MFA; break-glass procedureSecurityAccess review export
P5Baseline guardrails: CloudTrail (org trail to log-archive with Object Lock), AWS Config, GuardDuty, Security Hub, IAM Access Analyzer, budgets and alertsSecuritySecurity Hub score; trail integrity validation on
P6Region choice: primary US region plus a DR region (for example us-east-1 / us-west-2). Open decisionArchitectureADR
P7Domain, Route 53 hosted zone, ACM certificatesPlatformDNS delegation verified
P8IaC state backend (S3 + locking) per account; CI role with GitHub OIDC federation (no static keys)Platformplan runs in CI
P9Vendor BAAs for observability, email and other services that touch PHI (see the integration register)ComplianceRegister status
P10HIPAA security risk analysis and contingency plan draftedCompliance + SecuritySigned documents

7. Target AWS architecture Proposed

Proposed production context on AWSClients reach CloudFront and WAF or zero-trust access, then an ALB in a private VPC routing to web and API pods, domain services, async workers, Aurora, Redis, S3 vaults and KMS, with undecided external partners.AWS VPC · 3 AZs · private subnets (proposed)Customerbrowser / appOps staffclinician · RPhCloudFront+ WAFZero-trustaccess + SSOALBLB controllerwebNext.js podsapi / BFFREST · GraphQL/apiIdentityCatalogOrdersClinicalPharmacyPaymentsoutbox → SQSTemporal (TBD)workerssagas · webhooksAuroraPostgreSQL · CMKElastiCacheRedis · sessionsS3 PHI vaultSSE-KMS · AV firstS3 audit WORMObject LockKMS · Secretsper data classOIDC IdP*BAA + eligibilityeRx · FHIR*telehealth partnersPharmacy*carriers · cold chainPayments PSP*no PHI metadata* undecided partners
Figure 2. Proposed production context, shared with the technical design. Not deployed.
LayerServiceConfiguration intent
EdgeCloudFront + AWS WAF + Shield StandardManaged rule groups, rate rules, bot control on auth routes, TLS 1.2+ policy; no caching of authenticated responses
IngressALB via AWS Load Balancer ControllerPrivate origin (CloudFront-only access with a header or VPC origin); separate internal ALB for ops, behind zero-trust access
ComputeAmazon EKS (managed control plane)Managed node groups or Karpenter across 3 AZs; Bottlerocket or AL2023 nodes; IRSA/Pod Identity; namespaces per context; Pod Security "restricted"
DatabaseAurora PostgreSQLMulti-AZ, encrypted with a CMK, IAM auth or Secrets Manager rotation, PITR, Performance Insights, deletion protection; RDS Proxy for connection pooling
Cache / sessionsElastiCache (Redis OSS or Valkey engine)In-transit and at-rest encryption, AUTH/RBAC, Multi-AZ; holds sessions, rate limits and idempotency locks. Treated as disposable
ObjectsS3Buckets: quarantine, phi-vault (SSE-KMS, versioning, Block Public Access), audit-worm (Object Lock compliance mode), artifacts
AsyncSQS (+ DLQ) and Temporal or Step FunctionsOutbox relay → SQS; saga engine choice open (INT-PL-06)
Keys / secretsKMS, Secrets ManagerCMK per data class; rotation enabled; External Secrets Operator
ObservabilityCloudWatch / OpenTelemetry collectorRedaction processors; no PHI; SLO dashboards and alerting

8. EKS complexity & staged extraction

Honest assessment

EKS is the selected production target. It brings real operational load: cluster upgrades about three times a year, add-on lifecycle, node patching, network policy, admission control and GitOps tooling. For a small team, the first production stage should run few, coarse workloads. Split them only when ownership, scaling or compliance isolation justifies it. Amazon ECS on Fargate stays a documented fallback (ADR) if the team cannot staff Kubernetes operations.

StageWorkloadsExit criteria
A. Lift the POC shapeweb Deployment, api Deployment (modular monolith on PostgreSQL), migration JobStaging runs with synthetic data; SLO dashboards; restore drill passes; pentest scheduled
B. Async backbone+ outbox-relay, workers (SQS consumers), saga engineChaos test: no lost or duplicate side effects; DLQ alarms
C. Extract by needpayments → pharmacy → clinical as separate services with their own DB schemas and rolesEach extraction ships behind a feature flag with a dual-run comparison and its own SLO
D. Multi-region DRAurora Global Database or cross-region snapshots; warm standby clusterRegional failover game day meets RTO

Cluster baseline add-ons

  • AWS Load Balancer Controller, ExternalDNS, External Secrets Operator, metrics-server, cluster autoscaling (Karpenter)
  • Argo CD (GitOps) + Argo Rollouts (canary) Open decision: or Flux
  • Policy: Kyverno or Gatekeeper rules for signed images only, no privileged pods, required resource limits, no latest tags
  • NetworkPolicies, default-deny per namespace (VPC CNI network policy support)
  • OpenTelemetry collector DaemonSet with PHI redaction

9. Infrastructure as code & CI/CD Proposed

  • Tool: Terraform or OpenTofu Open decision (CDK is acceptable if the team prefers TypeScript). Planned layout under infra/ (not created yet): modules/ (network, eks, aurora, redis, s3-vault, kms, observability) and envs/{dev,stage,prod}.
  • State: S3 backend per account, KMS-encrypted, with locking. No local state.
  • Pipeline: PR → fmt/validate → policy scan (Checkov or tfsec) → plan posted to the PR → manual approval → apply through an OIDC-assumed role. Prod applies need two approvers.
  • Images: build once; generate an SBOM; vulnerability scan (block on critical); sign with cosign; push to ECR with immutable tags (git SHA); promote the same digest dev→stage→prod.
  • Drift: a nightly plan alerts on drift. Console changes in prod are blocked by SCP except through break-glass.

10. Network & security Proposed

Subnet tierContentsIngress allowed from
Public (3 AZ)ALB, NAT gatewaysCloudFront (managed prefix list) on 443
Private app (3 AZ)EKS nodes and podsALB security group on app ports only
Isolated data (3 AZ)Aurora, ElastiCacheApp pod security groups (SG-for-pods) on 5432 / 6379 only; no route to the internet
  • VPC endpoints for S3, ECR, KMS, Secrets Manager, STS, SQS and CloudWatch Logs, so PHI-adjacent traffic stays off the public internet. Endpoint policies restrict access to our own accounts.
  • Egress to partners goes through NAT with an allow-list (DNS firewall or a proxy). Partner webhooks arrive on a dedicated ingress path with WAF rules.
  • VPC Flow Logs go to the log-archive account. GuardDuty EKS and runtime protection are on.
  • Admin access is through SSM Session Manager or EKS access entries with SSO. No bastion with SSH keys.

11. Secrets management Proposed

  • Path scheme aws-sm://breezrx/{env}/{domain}/{name}. These are placeholders, matching the integration register.
  • External Secrets Operator syncs secrets to namespaced Kubernetes Secrets. EKS secrets are envelope-encrypted with KMS. Pods read only their own secrets (IRSA policy scoped by path).
  • Database credentials rotate automatically (Secrets Manager rotation), or the app uses IAM database auth.
  • No secrets in images, Helm values, git or CI logs. Secret scanning blocks pushes.
  • The POC needs no secrets; DEMO_MODE is configuration, not a secret.

12. Data & schema migrations

Local PostgreSQL → Aurora PostgreSQL

  • Same engine, same migrations. apps/api/migrations/*.sql run unchanged against Aurora. Demo rows are tagged provider='mock_gateway' / livemode=false, so they can be excluded or purged, and the mock_gateway schema can be dropped at go-live.
  • The schema already uses CHECK constraints, timestamptz, uuid keys and integer cents (TD §0.2). Splitting it into per-context schemas (TD §6.2) and choosing a production migration runner (for example node-pg-migrate or Flyway) are still open. Open decision
  • Seed scripts run only in dev and stage. Production catalog data comes from the catalog admin process.

Production migration policy

  1. Expand/contract: add nullable columns and tables first; backfill in batches; switch reads; enforce constraints (NOT VALID then VALIDATE); drop old columns in a later release.
  2. Migrations run as a pre-deploy Kubernetes Job with a lock. The application never migrates on boot in production.
  3. Indexes are created CONCURRENTLY. Long locks are not allowed: CI checks lock_timeout and statement_timeout.
  4. Every release keeps code N and N-1 compatible with the schema, so rollback needs no down-migration.
  5. A manual snapshot is taken before high-risk migrations, and the restore procedure is rehearsed in stage.

13. Backups & restore Proposed

DataMechanismRetention (target)Restore test
AuroraAutomated backups + PITR; AWS Backup plan with Vault Lock; cross-region and cross-account copiesPITR 35 days; monthly snapshots per records-retention decisionQuarterly restore to an isolated account; checksum row counts; app smoke test
S3 PHI vaultVersioning, cross-region replication, Object Lock where policy requiresPer the records-retention schedule (legal)Quarterly object restore sample
Audit WORMObject Lock compliance mode in the log-archive account≥ 6 years (confirm with counsel and state rules)Annual integrity verification (hash chain)
RedisNone needed (cache, sessions, locks)—Failover test: users may need to sign in again
IaC / configGit + state versioningIndefiniteRebuild stage from scratch once per year

Targets for RPO, RTO and SLOs are defined in the technical design §19. They are labeled targets, not achieved results.

14. Incidents & rollback Proposed

Severity

  • SEV1: checkout or clinical/pharmacy work down; suspected PHI exposure
  • SEV2: degraded SLO; one partner down
  • SEV3: minor or cosmetic

Application rollback

  • Argo Rollouts: canary 5% → 25% → 100% with metric analysis; automatic abort on SLO burn
  • Manual: revert the GitOps commit to the previous image digest
  • Kill switches via feature flags (catalog SKU, checkout, refills)

Data rollback

  • Prefer a forward fix. Down-migrations are not used
  • Corruption: PITR to a new cluster, then a controlled cutover
  • Never roll back over dispensed or captured records without pharmacist and finance reconciliation

Security / privacy incident path

  1. Contain: revoke credentials and isolate workloads. Preserve evidence in the log-archive account.
  2. Bring in the privacy officer and counsel immediately to run a HIPAA breach risk assessment (four-factor). Notification duties and deadlines are decided by counsel; the HIPAA outer limit for individual notice is 60 days from discovery, and state laws may be stricter.
  3. Notify partners under the BAA terms. Record the timeline in the incident system.
  4. Hold a blameless post-incident review within 5 business days and track corrective actions.

POC rollback

Check out the previous commit and run docker compose up --build -d. If the schema changed incompatibly, reset with docker compose down -v. The data is synthetic.

15. Future-session checklist

Every local session

  • docker compose up --build -d, then docker compose ps shows both services healthy
  • curl -fsS http://localhost:3100/api/health returns {"status":"ok","demo":true}
  • The API is not reachable from the host on 4000 (docker compose port api 4000 is empty)
  • Smoke test from §2 passes, including the 409 on advancing an order that is awaiting review
  • Data persists across docker compose restart
  • Run npm test (workspaces) before demoing changes
  • After editing a report in docs/, copy it again: cp docs/{technical-design,production-integrations,cloud-deployment}.html apps/web/public/reports/

Before starting cloud work

  • P1–P10 in §6 have recorded decisions and owners
  • The integration register has no PHI-handling vendor without a BAA
  • ADRs exist for the IaC tool, saga engine, region pair, migration tool and GitOps tool
  • infra/ skeleton with remote state; plan runs in CI with OIDC
  • Stage A in dev with synthetic data only. No real PHI until the MVP gate in TD §21 passes
  • Update this document's status table. Never mark an environment as deployed without a URL, an owner and a passing health check

Shopping assistant inference

The inline concierge uses a configurable private OpenAI-compatible endpoint, separate from the commerce API. Existing vLLM Docker recipes are managed by the sibling GPU Workload Manager; BreezRx has no Docker socket and never changes GPU workloads automatically.

Set ASSISTANT_BASE_URL (including /v1) and the exact ASSISTANT_MODEL served by /v1/models. Model-specific JSON mode, output limits and chat-template kwargs are configurable. See the repository README for the complete environment contract.

For a future VPC, keep GPU inference in a private GPU service/container pool reachable only from the API security group. Use internal DNS, authenticated TLS, managed secrets, pinned images/weights, reviewed licenses and a separate scaling policy. Do not expose the GPU manager or inference API publicly. Host-gateway is only a local-development technique, not a cloud topology.

Implemented per API replica: four simultaneous inference requests by default, a six-second total deadline, 64 KiB response ceiling, and a circuit breaker with a 30-second cooldown after two failures. Timeout, overload, invalid response and connection failure preserve the deterministic shopping wizard. These are local safeguards, not a global traffic limit: add shared admission controls, inference queue/latency metrics, alerts and load tests before cloud launch. No cloud deployment or capacity SLO is claimed.

Packs persist in PostgreSQL; their items use the existing independently claimed renewal scheduler and individual prescription checks. Chat transcripts are intentionally ephemeral. Before real-data use, complete privacy/retention design and review the configured inference provider's logging.