feat(devops): implement multi-stage aws ecs express infrastructure and segregated oidc ci/cd pipelines - #14
Draft
emanuellcs wants to merge 1 commit into
Draft
feat(devops): implement multi-stage aws ecs express infrastructure and segregated oidc ci/cd pipelines#14emanuellcs wants to merge 1 commit into
emanuellcs wants to merge 1 commit into
Conversation
…d segregated oidc ci/cd pipelines - Scaffold modular Terraform architecture spanning bootstrap remote state, isolated networking, storage, database, compute, and finops budget modules. - Pivot primary cloud compute tier to AWS ECS Express Mode (Fargate) to bypass AWS App Runner onboarding restrictions for new accounts. - Provision an automated Amazon RDS PostgreSQL 17 database engine leveraging cost-effective db.t4g.micro Graviton nodes in Single-AZ mode. - Secure application attachments using a private Amazon S3 bucket hardened with public access blocks and an aggressive 1-day lifecycle expiration rule. - Orchestrate a segregated GitHub Actions workflow matrix dividing PR validation (lint, type-check, tests, and read-only terraform plan with lock-free concurrency) from production releases (ECR image push and automated terraform apply on main merge). - Build an emergency manual teardown workflow acting as a FinOps kill switch to completely obliterate application stacks and avoid trailing cloud fees. - Harden GitHub Actions runner authentication using secure AWS OIDC (OpenID Connect) trust policies, completely eliminating static IAM access keys. - Patch the C# backend to support automated production startup migrations, Forwarded Headers middleware for ALB termination, and native AWS SDK IAM Task Role credentials fallback for S3. - Update the Next.js 16 frontend build lifecycle to bake public API gateway routes at container compilation time for browser-side SignalR WebSockets. - Enrich repository documentation across root, API, and web READMEs to fully detail infrastructure layout, remote state bootstrap steps, and architectural Mermaid flows.
emanuellcs
marked this pull request as draft
May 30, 2026 13:28
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.
Overview
This Pull Request introduces the infrastructure-as-code (IaC) layer and automated continuous integration and deployment (CI/CD) pipelines for the EngiFlow platform. The cloud architecture is provisioned using modular HashiCorp Terraform targeting AWS ECS Express Mode, Amazon RDS, Amazon S3, and Amazon SES. Additionally, the deployment engine is split into segregated validation and deployment workflows within GitHub Actions, utilizing secure OpenID Connect (OIDC) authentication. This setup ensures that the application can coexist in two distinct states: 100% operational on localhost via Docker Compose, and 100% compliant with cloud-managed specifications on AWS.
Architecture & Design Decisions
bootstrap/directory. This ensures that executing the emergency infrastructure teardown destroys only the application stack, leaving the deployment permissions and state tracking mechanics intact.Key Changes
Infrastructure as Code (Terraform)
infra/terraform/modules/covering isolated Networking (VPC, subnets, and security groups), Database, Storage, Compute, and Email.db.t4g.microGraviton class configured in Single-AZ mode with automated snapshot bypass (skip_final_snapshot = true) for rapid destruction.engiflow-apiandengiflow-web, bound to lifecycle rules that retain only the single latest built image layer to reduce hosting fees.CI/CD Automation (GitHub Actions)
pr-validation.yml): Configured to execute strictly on pull requests targeting themainbranch. It runs code linting, frontend type-checking (tsc --noEmit), backend unit testing, and a read-onlyterraform planutilizing-lock=falseto avoid concurrency deadlocks on parallel PR reviews.deploy.yml): Triggers only on direct pushes or merges to themainbranch. It handles multi-stage local Docker image building, pushes the production layers to Amazon ECR via an elevated write-access OIDC role, and runs an automated, headlessterraform apply -auto-approve.teardown.yml): A manual, high-priorityworkflow_dispatchpipeline acting as a FinOps kill switch. It instantly runs an automatedterraform destroy -auto-approveto tear down all application resources on AWS, returning running cloud costs to zero.Application Cloud Readiness Patches
Program.csto integrate ASP.NET Core Forwarded Headers middleware for proper HTTPS termination behind the AWS Application Load Balancer (ALB). Added a clean/healthzhealth probe endpoint for target group status tracking.EngiFlow__Database__MigrateOnStartup=truewhen initializing in a production environment, excluding local seed data.S3StorageService.csto automatically fall back to the AWS SDK Default Credential Chain when explicit static MinIO keys are omitted, ensuring seamless operation in both local and cloud containers.NEXT_PUBLIC_API_BASE_URLas a compilation argument, baking the public API gateway domain directly into the Next.js production build artifacts for client-side WebSocket connections.api/, andweb/folders to outline the remote state initialization steps, workflow triggers, and environmental variable mapping layouts.Verification & Testing
The infrastructure layer and delivery automation have been verified locally using static checking and simulation tools prior to submission:
terraform validateandterraform fmt -checkacross both the bootstrap and core application modules with clean passes.docker compose configto guarantee zero configuration regression for local setups.Releaseconfiguration configuration cleanly.npm run buildand type-checking scripts.