How bambeeq/opsworks-auto-deploy works
This repository is a set of OpsWorks custom cookbooks for coordinated blue/green deployment of frontend and backend applications. The documented workflow starts with an S3 upload, prepares a staging environment, and switches the application set to production; the recipes also provide rollback, load-balancer configuration, container deployment, database setup and backups, and monitoring/alarm configuration. The sampled recipes show deployment and staging actions, but not the event wiring that starts them or the full switch/rollback implementation, so those documented relationships are attributed to the README.
Main entry points: prepare_staging.rb Prepare staging · deploy.rb Application deploy · load_balance_deploy.rb Load balancing · run_tests.rb Staging tests
Components 26
Blue-green deployment
- Application deploy
blue_green_deploy/recipes/deploy.rb - Prepare staging
blue_green_deploy/recipes/prepare_staging.rb - Staging tests
blue_green_deploy/recipes/run_tests.rb - Prepare production
blue_green_deploy/recipes/prepare_stg_for_prod.rb - Switch to production
blue_green_deploy/recipes/switch_to_prod.rb - Rollback staging
blue_green_deploy/recipes/rollback_staging.rb - Instance launch
blue_green_deploy/recipes/instance_launch.rb - Container cleanup
blue_green_deploy/recipes/kill_old_containers.rb
Container deployment
- Build image
docker/recipes/build-image.rb - Deploy image
docker/recipes/docker-image-deploy.rb - Install Docker
docker/recipes/install.rb
Traffic management
- Load balancing
nginx/recipes/load_balance_deploy.rb - Proxy deployment
nginx/recipes/proxy_deploy.rb
Data and monitoring
- MongoDB setup
mongodb/recipes/install.rb - PostgreSQL setup
postgres/recipes/default.rb - MongoDB backup
blue_green_deploy/recipes/mongo_backup.rb - PostgreSQL backup
blue_green_deploy/recipes/pg_backup.rb - Status and alarms
blue_green_deploy/recipes/nodify_status.rb
Other components
- Deployment initiator
- S3 upload trigger
- S3 artifact store
- MongoDB
- PostgreSQL
- AWS OpsWorks
- CloudWatch alarms
- SNS notifications
Connections 21
- Deployment initiator → S3 upload trigger: uploads artifact
README.md - S3 upload trigger → Application deploy: triggers deployment
README.md - Application deploy → S3 artifact store: reads artifacts
blue_green_deploy/recipes/deploy.rb - Prepare staging → S3 artifact store: reads artifacts
blue_green_deploy/recipes/prepare_staging.rb - Prepare staging → MongoDB: resets staging
blue_green_deploy/recipes/prepare_staging.rb - Prepare staging → PostgreSQL: copies production data
blue_green_deploy/recipes/prepare_staging.rb - Application deploy → Prepare staging: prepares stage
- Prepare staging → Staging tests: enables testing
- Staging tests → Prepare production: approves promotion
- Prepare production → Switch to production: readies release
- Switch to production → Load balancing: switches traffic
README.md - Rollback staging → Load balancing: reverts traffic
- Build image → AWS OpsWorks: deploys application
docker/recipes/build-image.rb - Deploy image → AWS OpsWorks: deploys container
docker/recipes/docker-image-deploy.rb - Load balancing → AWS OpsWorks: reads layer instances
nginx/recipes/load_balance_deploy.rb - MongoDB setup → MongoDB: configures service
mongodb/recipes/install.rb - PostgreSQL setup → PostgreSQL: installs service
postgres/recipes/default.rb - MongoDB backup → MongoDB: backs up data
- PostgreSQL backup → PostgreSQL: backs up data
- Status and alarms → CloudWatch alarms: sets alarms
- CloudWatch alarms → SNS notifications: sends alerts