Skip to content

Comments

Automated indexer deployment with API endpoint under same domain#40

Open
koenmtb1 wants to merge 10 commits intomainfrom
km/automted-deployment
Open

Automated indexer deployment with API endpoint under same domain#40
koenmtb1 wants to merge 10 commits intomainfrom
km/automted-deployment

Conversation

@koenmtb1
Copy link

Summary

  • Add automated blue-green deployment for the Ponder indexer via two GitHub Actions workflows: one deploys to the slave color and exits, a cron (every 30 min) polls the new backend's sync status and switches over once ready
  • Route /api/* requests through the frontend CloudFront distribution (stake.aztec.network/api/*) to the live indexer origin, eliminating the need for a separate API domain and frontend redeployments on indexer switchovers
  • Add /api/sync-status endpoint that compares the indexer's max indexed block against the chain head, used by the cron to detect when re-indexing is complete
  • Replace the 404 custom_error_response with a CloudFront Function for SPA routing, since custom_error_response is distribution-wide and would swallow API 404s

How it works

  • Trigger Deploy Indexer (Blue-Green) workflow → deploys to the slave color (opposite of live), writes a pending switchover to S3, exits (~5 min)
  • Check Indexer Sync cron runs every 30 min → hits /api/sync-status on the slave's CloudFront → if synced, updates the indexerOrigin on the frontend CloudFront via AWS CLI, clears the pending state, and triggers a deploy to the old live so both end up updated
  • The frontend always hits /api/* on its own domain — CloudFront routes it to whichever indexer backend is live. No frontend redeploy needed for switchovers.

Setup
Run scripts/init-deployment-state.sh <environment> <live_color> once per environment to create the S3 state file before using the blue-green workflow.

@koenmtb1 koenmtb1 requested a review from a team February 19, 2026 11:50
@koenmtb1 koenmtb1 requested a review from a team as a code owner February 19, 2026 11:50
@koenmtb1 koenmtb1 requested a review from Maddiaa0 February 19, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant