# bambeeq/opsworks-auto-deploy architecture

> Architecture diagram of the GitHub repository bambeeq/opsworks-auto-deploy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bambeeq/opsworks-auto-deploy
- Repository: https://github.com/bambeeq/opsworks-auto-deploy

## Overview

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: [`blue_green_deploy/recipes/prepare_staging.rb`](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/prepare_staging.rb) (Prepare staging), [`blue_green_deploy/recipes/deploy.rb`](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/deploy.rb) (Application deploy), [`nginx/recipes/load_balance_deploy.rb`](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/nginx/recipes/load_balance_deploy.rb) (Load balancing), [`blue_green_deploy/recipes/run_tests.rb`](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/run_tests.rb) (Staging tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deploy["Blue-green deployment"]
  node_deploy_recipe["Application deploy<br/>[deploy.rb]"]
  node_staging["Prepare staging<br/>[prepare_staging.rb]"]
  node_stage_tests["Staging tests<br/>[run_tests.rb]"]
  node_production_prep["Prepare production"]
  node_promotion["Switch to production<br/>[switch_to_prod.rb]"]
  node_rollback["Rollback staging"]
  node_instance_launch["Instance launch<br/>[instance_launch.rb]"]
  node_container_cleanup["Container cleanup"]
end

subgraph group_containers["Container deployment"]
  node_docker_build["Build image<br/>[build-image.rb]"]
  node_docker_deploy["Deploy image"]
  node_docker_install["Install Docker<br/>[install.rb]"]
end

subgraph group_traffic["Traffic management"]
  node_nginx_lb["Load balancing"]
  node_nginx_proxy["Proxy deployment<br/>[proxy_deploy.rb]"]
end

subgraph group_data["Data and monitoring"]
  node_mongo_install["MongoDB setup<br/>[install.rb]"]
  node_postgres_install["PostgreSQL setup<br/>[default.rb]"]
  node_mongo_backup["MongoDB backup<br/>[mongo_backup.rb]"]
  node_postgres_backup["PostgreSQL backup<br/>[pg_backup.rb]"]
  node_monitoring["Status and alarms<br/>[nodify_status.rb]"]
end

node_operator(("Deployment initiator"))
node_s3_upload["S3 upload trigger"]
node_s3_store[("S3 artifact store")]
node_mongo_db[("MongoDB")]
node_postgres_db[("PostgreSQL")]
node_opsworks["AWS OpsWorks"]
node_cloudwatch["CloudWatch alarms"]
node_sns["SNS notifications"]

node_operator -->|"uploads artifact"| node_s3_upload
node_s3_upload -.->|"triggers deployment"| node_deploy_recipe
node_deploy_recipe -->|"reads artifacts"| node_s3_store
node_staging -->|"reads artifacts"| node_s3_store
node_staging -->|"resets staging"| node_mongo_db
node_staging -->|"copies production data"| node_postgres_db
node_deploy_recipe -.->|"prepares stage"| node_staging
node_staging -.->|"enables testing"| node_stage_tests
node_stage_tests -.->|"approves promotion"| node_production_prep
node_production_prep -.->|"readies release"| node_promotion
node_promotion -.->|"switches traffic"| node_nginx_lb
node_rollback -.->|"reverts traffic"| node_nginx_lb
node_docker_build -->|"deploys application"| node_opsworks
node_docker_deploy -->|"deploys container"| node_opsworks
node_nginx_lb -->|"reads layer instances"| node_opsworks
node_mongo_install -->|"configures service"| node_mongo_db
node_postgres_install -->|"installs service"| node_postgres_db
node_mongo_backup -.->|"backs up data"| node_mongo_db
node_postgres_backup -.->|"backs up data"| node_postgres_db
node_monitoring -.->|"sets alarms"| node_cloudwatch
node_cloudwatch -.->|"sends alerts"| node_sns

click node_deploy_recipe "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/deploy.rb"
click node_staging "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/prepare_staging.rb"
click node_stage_tests "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/run_tests.rb"
click node_production_prep "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/prepare_stg_for_prod.rb"
click node_promotion "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/switch_to_prod.rb"
click node_rollback "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/rollback_staging.rb"
click node_instance_launch "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/instance_launch.rb"
click node_container_cleanup "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/kill_old_containers.rb"
click node_docker_build "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/build-image.rb"
click node_docker_deploy "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/docker-image-deploy.rb"
click node_docker_install "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/install.rb"
click node_nginx_lb "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/nginx/recipes/load_balance_deploy.rb"
click node_nginx_proxy "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/nginx/recipes/proxy_deploy.rb"
click node_mongo_install "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/mongodb/recipes/install.rb"
click node_postgres_install "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/postgres/recipes/default.rb"
click node_mongo_backup "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/mongo_backup.rb"
click node_postgres_backup "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/pg_backup.rb"
click node_monitoring "https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/nodify_status.rb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_deploy_recipe,node_staging,node_stage_tests,node_production_prep,node_promotion,node_rollback,node_instance_launch,node_container_cleanup toneBlue
class node_docker_build,node_docker_deploy,node_docker_install,node_s3_store,node_mongo_db,node_postgres_db toneAmber
class node_nginx_lb,node_nginx_proxy toneMint
class node_mongo_install,node_postgres_install,node_mongo_backup,node_postgres_backup,node_monitoring toneRose
class node_operator,node_s3_upload,node_opsworks,node_cloudwatch,node_sns toneIndigo
```

## Components

### Blue-green deployment

- [Application deploy](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/deploy.rb): `blue_green_deploy/recipes/deploy.rb`
- [Prepare staging](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/prepare_staging.rb): `blue_green_deploy/recipes/prepare_staging.rb`
- [Staging tests](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/run_tests.rb): `blue_green_deploy/recipes/run_tests.rb`
- [Prepare production](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/prepare_stg_for_prod.rb): `blue_green_deploy/recipes/prepare_stg_for_prod.rb`
- [Switch to production](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/switch_to_prod.rb): `blue_green_deploy/recipes/switch_to_prod.rb`
- [Rollback staging](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/rollback_staging.rb): `blue_green_deploy/recipes/rollback_staging.rb`
- [Instance launch](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/instance_launch.rb): `blue_green_deploy/recipes/instance_launch.rb`
- [Container cleanup](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/kill_old_containers.rb): `blue_green_deploy/recipes/kill_old_containers.rb`

### Container deployment

- [Build image](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/build-image.rb): `docker/recipes/build-image.rb`
- [Deploy image](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/docker-image-deploy.rb): `docker/recipes/docker-image-deploy.rb`
- [Install Docker](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/docker/recipes/install.rb): `docker/recipes/install.rb`

### Traffic management

- [Load balancing](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/nginx/recipes/load_balance_deploy.rb): `nginx/recipes/load_balance_deploy.rb`
- [Proxy deployment](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/nginx/recipes/proxy_deploy.rb): `nginx/recipes/proxy_deploy.rb`

### Data and monitoring

- [MongoDB setup](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/mongodb/recipes/install.rb): `mongodb/recipes/install.rb`
- [PostgreSQL setup](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/postgres/recipes/default.rb): `postgres/recipes/default.rb`
- [MongoDB backup](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/mongo_backup.rb): `blue_green_deploy/recipes/mongo_backup.rb`
- [PostgreSQL backup](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/pg_backup.rb): `blue_green_deploy/recipes/pg_backup.rb`
- [Status and alarms](https://github.com/bambeeq/opsworks-auto-deploy/blob/master/blue_green_deploy/recipes/nodify_status.rb): `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

- Deployment initiator → S3 upload trigger: uploads artifact (evidence: `README.md`)
- S3 upload trigger → Application deploy: triggers deployment (evidence: `README.md`)
- Application deploy → S3 artifact store: reads artifacts (evidence: `blue_green_deploy/recipes/deploy.rb`)
- Prepare staging → S3 artifact store: reads artifacts (evidence: `blue_green_deploy/recipes/prepare_staging.rb`)
- Prepare staging → MongoDB: resets staging (evidence: `blue_green_deploy/recipes/prepare_staging.rb`)
- Prepare staging → PostgreSQL: copies production data (evidence: `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 (evidence: `README.md`)
- Rollback staging → Load balancing: reverts traffic
- Build image → AWS OpsWorks: deploys application (evidence: `docker/recipes/build-image.rb`)
- Deploy image → AWS OpsWorks: deploys container (evidence: `docker/recipes/docker-image-deploy.rb`)
- Load balancing → AWS OpsWorks: reads layer instances (evidence: `nginx/recipes/load_balance_deploy.rb`)
- MongoDB setup → MongoDB: configures service (evidence: `mongodb/recipes/install.rb`)
- PostgreSQL setup → PostgreSQL: installs service (evidence: `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
