Deployment Checklist

Quick reference for deploying Prefect flows via CircleCI to your self-hosted Prefect server.

Pre-Deployment Checklist

Infrastructure

  • Platform infrastructure healthy (Terraform applied from this repo: infra/platform/infra/envs/prod)
  • Prefect server accessible at https://pipelines.rocketclub.online
  • ECR repository blog-data exists
  • ECS cluster rocket-club-prod-ecs running
  • VPC and networking configured

Prefect Server

  • Can access Prefect UI at https://pipelines.rocketclub.online
  • Have admin credentials (username:password)
  • Work pool blog-data-pool created
  • Work pool type is ECS
  • Work queue default exists

CircleCI Setup

  • GitHub repository connected to CircleCI
  • Project visible in CircleCI dashboard
  • All environment variables configured (see below)

Deployment Steps

1. Verify Configuration Files

  • .circleci/config.yml exists and is up to date
  • data/platform/prefect.yaml exists with correct work pool name
  • Dockerfile exists and builds successfully
  • pyproject.toml has all dependencies

2. Test Locally (Optional)

# Build Docker image locally
docker build -t blog-data:test .

3. Trigger the deploy-data-platform Pipeline

The pipeline is param-gated — it does not run on push. Trigger it via the CircleCI UI's "Trigger Pipeline" with the parameter set, or the API:

curl -X POST https://circleci.com/api/v2/project/gh/rlhatcher/rocket-club/pipeline \
  -H "Circle-Token: $CIRCLECI_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"branch":"main","parameters":{"deploy-data-platform":true}}'

4. Monitor Deployment

CircleCI

  • Go to CircleCI dashboard
  • Find your deploy-data-platform workflow run
  • Monitor build-data-platform-image job (~3-5 min)
  • Monitor terraform-prod-plan → approval → terraform-prod-apply
  • Monitor deploy-to-prefect job (~2-3 min)
  • Monitor deploy-flight-lambdas / deploy-ork-lambdas
  • Verify all jobs complete successfully

ECR

# Verify image was pushed
aws ecr describe-images \
  --repository-name blog-data \
  --region eu-west-2 \
  --query 'imageDetails[0].[imageTags[0],imagePushedAt]' \
  --output table

Prefect Deployments

  • Go to https://pipelines.rocketclub.online
  • Navigate to Deployments
  • Verify data-pipeline-daily exists
  • Check version matches git commit hash
  • Verify schedule matches data/platform/prefect.yaml (currently 0 2 */7 * * in America/New_York)

5. Test Flow Run

# Trigger a test run via CLI from within the VPC or a machine that can reach the internal Prefect API
export PREFECT_API_URL="https://pipelines.rocketclub.online/api"

prefect deployment run data-pipeline-daily

Or via Prefect UI:

  • Go to Deploymentsdata-pipeline-daily
  • Click "Run"
  • Monitor flow run in Flow Runs page
  • Verify flow completes successfully

Post-Deployment Verification

Flow Execution

  • Flow runs appear in Prefect UI
  • ECS tasks are created for flow runs
  • Logs are visible in Prefect UI
  • Flow completes successfully
  • Data is written to expected locations (S3, Neo4j)

Monitoring

  • Set up Prefect notifications for failures
  • Configure CloudWatch alarms for ECS tasks
  • Set up log aggregation (optional)

Troubleshooting

Build Fails

Check:

  • Dockerfile syntax is correct
  • All dependencies in pyproject.toml are valid
  • Base image is accessible

Fix:

# Test build locally
docker build -t blog-data:test .

Deployment Fails

Check:

  • PREFECT_API_URL is correct (ends with /api) if you are running Prefect CLI locally or from CI
  • Work pool blog-data-pool exists
  • Network connectivity to Prefect server from where you are running the CLI

Fix:

# Test Prefect connection (from inside the VPC or from a machine that can reach the Prefect API)
export PREFECT_API_URL="https://pipelines.rocketclub.online/api"
prefect work-pool ls

Flow Run Fails

Check:

  • ECS task has correct IAM permissions
  • Environment variables are set in ECS task
  • Docker image contains all required code
  • S3 buckets are accessible
  • Neo4j database is accessible

Fix:

# Check ECS task details
aws ecs describe-tasks \
  --cluster rocket-club-prod-ecs \
  --tasks <task-id> \
  --region eu-west-2

# Check Prefect worker logs
aws logs tail /ecs/prod/prefect-worker --follow --region eu-west-2

Quick Commands Reference

AWS

# List ECR images
aws ecr describe-images --repository-name blog-data --region eu-west-2
# List ECS tasks
aws ecs list-tasks --cluster rocket-club-prod-ecs --region eu-west-2

Prefect

# Configure Prefect CLI (optional; typically only used from within the VPC or an admin machine)
export PREFECT_API_URL="https://pipelines.rocketclub.online/api"

# List deployments
prefect deployment ls

# List work pools
prefect work-pool ls

# Trigger deployment
prefect deployment run data-pipeline-daily

# View flow runs
prefect flow-run ls --limit 10

CircleCI CLI

# Install CircleCI CLI (optional)
brew install circleci

# Validate config
circleci config validate

# View recent workflows
circleci workflow list <project-slug>

Rollback Procedure

If a deployment causes issues:

1. Identify Last Good Commit

# View recent commits
git log --oneline -10

# Find last working commit hash

2. Revert or Redeploy

Option A: Revert commit

git revert <bad-commit-hash>
git push origin main

Option B: Redeploy old version

# Update deployment to use old image
export OLD_IMAGE="<account-id>.dkr.ecr.eu-west-2.amazonaws.com/blog-data:<old-commit-hash>"

# Update deployment manually via Prefect UI or CLI

3. Verify Rollback

  • Check CircleCI build completes
  • Verify deployment in Prefect UI
  • Test flow run
  • Monitor for errors

Maintenance

Regular Tasks

  • Review flow run history weekly
  • Check ECS task resource usage
  • Monitor ECR storage usage
  • Update dependencies monthly
  • Review and rotate credentials quarterly

Updates

When updating flows:

  1. Make changes in a feature branch
  2. Test locally
  3. Merge to main
  4. Trigger the deploy-data-platform pipeline to deploy
  5. Verify in Prefect UI

Support Resources

Summary

Yes Ready to Deploy when all items in "Pre-Deployment Checklist" are checked.

🚀 Deploy by triggering the param-gated deploy-data-platform pipeline (not by pushing).

Verify deployment in CircleCI, ECR, and Prefect UI.

🔍 Monitor flow runs and ECS tasks.

🔄 Rollback if needed using git revert or manual deployment update.