PR-A: CI safety + bootable ECS monolith + Odoo state on RDS#81
Merged
tushabe merged 3 commits intoJul 13, 2026
Merged
Conversation
Strangler-fig plan superseding the MVP-shaped draft: PR-A (CI safety + working monolith task + Odoo state to RDS, edge container removed from AWS), then InfluxDB extraction, ALB/wss ingress, service split, and hardening. Backend pinned to 2026.1.0 per upstream guidance; edges track latest. Includes per-PR cost deltas, exit tests, and open questions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Guru <guru@coefficient.io>
…C2 is the only live env Read-only recon of account 470298448112: no TF state bucket, no openems-deployment VPC/log group/ALB. Live: openems-dev-stack EC2 (iac/dev + setup.sh) and a b2b-proxy Lambda. PR-A gains a one-time bootstrap prerequisite (state bucket, lock table, secret, CI creds). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Guru <guru@coefficient.io>
A1 — CI safety: - destroy-pipeline: workflow_dispatch only with typed confirmation (was: terraform destroy on every push to main), destroy job only - deploy-pipeline: drop always-true needs.*.output guards, fix render chain (final deploy now uses the last render output; odoo-db/edge steps removed), edge image no longer built/pushed - push-to-ecr.sh: explicit image list (was: grep over compose, which would try to push influxdb:1.8) A2 — the monolith task can actually boot: - openems-backend.sh renders Metadata/Odoo + Timedata/InfluxDB configs from env vars at startup (defaults = compose values); ECS injects RDS endpoint + Secrets Manager credentials through the same contract - ecs.tf task def rewritten: ui/backend/odoo/influxdb containers, localhost inter-container addressing (awsvpc shared netns), correct essential flags + healthchecks, 2 vCPU / 6 GB, edge container removed (edges run in the field, not AWS) - service deploys stop-then-start (min 0 / max 100): backend singleton - td JSON regenerated to mirror ecs.tf (CI only stamps image URIs) A3 — Odoo state on RDS: - app credentials generated by Terraform into Secrets Manager; injected via ECS secrets; execution role scoped to that one ARN; hardcoded passwords removed from tfvars/task-def - RDS: deletion protection, 14d backups, final snapshot, encrypted storage; DB SG drops the ssh-from-anywhere rule - openems SG trimmed to served ports only (8069/8075/8081/8082/8089); InfluxDB (no auth) no longer internet-reachable - Postgres pinned to 15 across local image, data dir, and RDS (image had drifted to 18 and refused the PG15 data directory) Verified locally: setup.sh green; ECS-style env override renders correct configs (incl. special-char passwords); edge connects (Edge.Websocket Connections: 1); UI 200; telemetry persisted in InfluxDB. terraform validate + fmt clean; actionlint clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Guru <guru@coefficient.io>
ramaguruprakash
force-pushed
the
feature/aws-arch-v2
branch
from
July 12, 2026 18:48
3fb9ec0 to
456607b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR-A of the piecewise production plan (
docs/aws-arch-v2-plan.md, included here): make the AWS ECS stack safe, bootable, and durable — the base every later PR builds on. Read-only recon (documented in the plan) showed the ECS stack described byiac/has never actually been deployed to account470298448112, so this is a first-time bootstrap, not a migration.Three parts, one PR, so the result is independently testable:
A1 — CI safety
destroy-pipeline.ymlno longer runs on push to main. It previously ranterraform destroy -auto-approveon every push to main, racing the deploy pipeline. Nowworkflow_dispatchonly, gated on typing the cluster name.if: needs.deploy_aws_infrastructure.output.terraform_action != 'destroy'guards — that path doesn't exist (no job outputs are defined), so the conditions were always true; the destroy pipeline was also building and deploying images.push-to-ecr.shnow pushes an explicit image list instead of grepping compose (which would have tried to pushinfluxdb:1.8).A2 — the monolith task can actually boot
edgecontainer from the AWS stack. Edges run in the field (or locally) and connect in overws://<task>:8081; they are not cloud containers.openems-backend.shrenders the Felix configs (Metadata/Odoo,Timedata/InfluxDB) from env vars at startup. Defaults equal the docker-compose values, so local behavior is unchanged; ECS injects the RDS endpoint and Secrets Manager credentials through the same variables.iac/ecs.tfis the source of truth; the CI JSON mirrors it and only gets image URIs stamped):ui(:8089) +backend(:8075/:8079/:8081/:8082) +odoo(:8069) +influxdb, localhost inter-container addressing (containers in one awsvpc task share a network namespace — the previous compose-style hostnamesdb/odoo16could never resolve), correctessentialflags, container healthchecks, 2 vCPU / 6 GB (was 4/12).min 0 / max 100): the backend is a singleton (one websocket per edge, one telemetry writer) — two live copies must never coexist.A3 — Odoo state on RDS (durable base)
secrets; the execution role is scoped to that single ARN. Hardcoded/mismatched passwords removed from tfvars and the task-def JSON.postgres:18, which refuses the PG-15 data directory and exceeds Odoo 16's support matrix; tfvars had18.1. Local image, local data, and RDS now agree.How it was tested (local — the compose stack mirrors the ECS task)
./setup.sh --edges 1full bootstrappgHost="db",odooHost="odoo16"in the running container" & | \)Edge.Websocket … Connections: 1; Metadata.Odoo registerededge0edge0_sum/ProductionActivePower = 5000 Wfrom measurementdatahttp://localhost:4200→ 200terraform validate+terraform fmt -check(1.14, containerized)actionlinton both workflowsdocker compose configecs.tfconsistency (containers, cpu/mem)Not testable locally (needs the account bootstrap below):
terraform plan/apply, the actual Fargate boot, and the one-time Odoo DB init on AWS (odoo -d openems -i openems --stop-after-initviaaws ecs run-task— runbook in the plan doc).One-time bootstrap prerequisites (before first deploy)
eiot-openems-tf-state-file(periac/backend.tf; uses S3-native locking) — does not exist yet.AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/ECR_REGISTRYrepo secrets with ECS/ECR/RDS/EC2/IAM/SecretsManager permissions (or move the pipeline to OIDC).workflow_dispatchon this branch.Follow-ups (tracked in
docs/aws-arch-v2-plan.md)wss://) · PR-D: split UI/Odoo into their own services · PR-E: observability, SES, mTLS.