Skip to content

feat: run PR previews on ECS - #647

Merged
daithihearn merged 2 commits into
mainfrom
feat/preview-per-pr-stack
Aug 27, 2026
Merged

feat: run PR previews on ECS#647
daithihearn merged 2 commits into
mainfrom
feat/preview-per-pr-stack

Conversation

@daithihearn

Copy link
Copy Markdown
Member

Second of two PRs for phase 3, on top of #645. terraform/frontend-preview creates one target group, one host-header rule and one ECS service per PR in workspace pr-N; priority is 2000 + pr_number, so there is no allocator and no scan for a free slot. Previews reuse dev's indexer bypass token, since they share its NAT IP.

deploy-preview.yml now promotes the multi-arch GHCR PR image into ECR instead of rebuilding amd64, so previews run the same arm64 image dev does. It waits for that image rather than racing it — the unit tests have to pass first. preview-reconcile.yml sweeps pr-* workspaces every six hours and reaps the ones whose PR is closed or unlabelled, skipping on any failed query rather than risking a live preview.

modules/ecs-webservice gains terraform_owns_task_definition: previews need ignore_changes off, which only a second copy of the resource can express. A moved block keeps the applied dev service in place.

Concurrent previews cap at 100 — the target-group-per-ALB quota AWS does not raise.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

PR bloat check passed - nothing left to fix.

@daithihearn daithihearn added the increment:minor PR adds functionality in a backwards compatible manner label Aug 27, 2026
@daithihearn
daithihearn force-pushed the feat/preview-per-pr-stack branch 2 times, most recently from 3984a66 to f31f0d0 Compare August 27, 2026 11:59
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

PR Docker Image Published

docker pull ghcr.io/vechain/block-explorer:pr.647.59d5634
Run locally
docker run --rm -p 3000:3000 ghcr.io/vechain/block-explorer:pr.647.59d5634

Base automatically changed from feat/preview-alb-stack to main August 27, 2026 12:01
@daithihearn
daithihearn force-pushed the feat/preview-per-pr-stack branch from f31f0d0 to 5c8b6da Compare August 27, 2026 12:01
@daithihearn
daithihearn requested a balanced review from Copilot August 27, 2026 12:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates PR previews from App Runner to per-PR ECS services behind the shared preview ALB.

Changes:

  • Adds the frontend-preview Terraform stack.
  • Promotes tested multi-architecture images from GHCR to ECR.
  • Adds ECS preview deployment, teardown, and reconciliation workflows.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
terraform/README.md Documents ECS previews.
terraform/modules/ecs-webservice/variables.tf Adds task-definition ownership mode.
terraform/modules/ecs-webservice/outputs.tf Supports either ECS service resource.
terraform/modules/ecs-webservice/main.tf Adds Terraform-managed rolling services.
terraform/frontend-preview/variables.tf Defines preview inputs.
terraform/frontend-preview/terraform.tf Configures isolated workspace state.
terraform/frontend-preview/providers.tf Configures preview resource tags.
terraform/frontend-preview/outputs.tf Exposes deployment metadata.
terraform/frontend-preview/main.tf Provisions per-PR ECS resources.
terraform/frontend-preview/locals.tf Derives names, URL, and priority.
terraform/environments/preview/preview.yaml.example Removes obsolete App Runner template.
terraform/environments/preview/preview.yaml Defines ECS preview sizing.
.github/workflows/README.md Documents the new lifecycle.
.github/workflows/preview-reconcile.yml Reaps orphaned previews.
.github/workflows/destroy-preview.yml Destroys ECS preview workspaces.
.github/workflows/deploy-preview.yml Promotes and deploys preview images.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/deploy-preview.yml
Comment thread .github/workflows/preview-reconcile.yml Outdated
Comment thread terraform/frontend-preview/locals.tf
Comment thread .github/workflows/README.md
@daithihearn
daithihearn force-pushed the feat/preview-per-pr-stack branch from 5c8b6da to 987d88e Compare August 27, 2026 12:11
daithihearn and others added 2 commits August 27, 2026 14:27
Second half of phase 3. frontend-preview creates one target group, one
host-header rule and one ECS service per PR in workspace pr-N; the workflows
promote the multi-arch GHCR PR image into ECR rather than rebuilding, so
previews run the same arm64 image as dev. preview-reconcile sweeps every six
hours for workspaces whose PR is closed or unlabelled.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Preview images now expire by age rather than a global count of ten, which any
mix of PRs could spend and leave a live preview unable to replace a task. The
reconcile sweep fails loudly on a backend it cannot reach, instead of reading it
as an empty workspace list. Preview instructions in DEPLOYMENT.md and the
App Runner README pointed at a deleted template and the wrong stack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@daithihearn
daithihearn force-pushed the feat/preview-per-pr-stack branch from 15d6645 to 59d5634 Compare August 27, 2026 12:28
@daithihearn
daithihearn merged commit ff3e371 into main Aug 27, 2026
13 checks passed
@daithihearn
daithihearn deleted the feat/preview-per-pr-stack branch August 27, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

increment:minor PR adds functionality in a backwards compatible manner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants