Enable Full ECS mode for the Braintrust API service#278
Draft
Mike Deeks (mdeeks) wants to merge 19 commits into
Draft
Enable Full ECS mode for the Braintrust API service#278Mike Deeks (mdeeks) wants to merge 19 commits into
Mike Deeks (mdeeks) wants to merge 19 commits into
Conversation
# Conflicts: # main.tf
…rust-data-plane into mdeeks/enable-full-api-ecs # Conflicts: # main.tf # modules/api-ecs/main.tf
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.
Note
This PR is primarily for internal Braintrust use in our Prod-EU environment and can be ignored for self-hosted customers. A follow up PR will be added later to full enable the transition for Lambda to ECS for self-hosted deployments.
Summary
This PR introduces a split ECS API architecture and a reversible cutover path from the legacy single
api-ecsservice to three dedicated services:braintrust-api(interactive traffic),braintrust-api-ingest(logs/OTel), andbraintrust-api-background(evals, function invoke, proxy). The legacy service is preserved inlegacy-api-ecs.tfso existing deployments can adopt the new infrastructure without changing traffic.The new root variable
enable_full_ecs_api(defaultfalse) is the cutover switch:false: New services are created and kept warm, but the ALB listener default action forwards 100% of traffic to legacyapi-ecs. CloudFront continues using API Gateway + AI Proxy Lambda. No path rules are active.true: ALB default action moves tobraintrust-api, ingest/background path rules are added, and CloudFront API/proxy origins switch to the ECS ALB via a pre-created VPC origin.This enables a two-step Prod-EU migration: adopt the release with flags unchanged (additive, no traffic change), then flip
enable_full_ecs_api = truefor an instant warm cutover. Rollback is the same flag flipped back.Key changes
API ECS module refactor
main.tfintobraintrust-api*.tf,legacy-api-ecs.tf,alb.tf, andalb-path-routes.tf/logs3,/otel/v1/traces) and background paths (evals, function invoke, proxy)EventLoopUtilizationPercentcustom metric) on all three new services, replacing memory-based scalingbraintrust_api_alb_certificate_arn+braintrust_api_alb_custom_domainapi_ecs_*) and new services (braintrust_api_*,braintrust_api_ingest_*,braintrust_api_background_*)Root module
api_ecs_version_override→braintrust_api_version_override; newbraintrust_api_*variables for service config<name>:<version>) so URL changes (e.g. HTTP → HTTPS) trigger a rolling instance refreshIngress
enable_full_ecs_apionly changes which origin receives trafficOther
EU-Migration-README.md: Migration runbook for Prod-EU with step-by-step cutover/rollback instructions and troubleshooting for partial-apply taint issuesMigration (Prod-EU)
enable_full_ecs_api = false(flags unchanged)enable_full_ecs_api = trueand applyenable_full_ecs_api = falseand applylegacy-api-ecs.tf