Live Demo: http://localhost:8080
SwiftDeploy is a CLI tool that builds, deploys, and manages a containerized application stack from a single declarative manifest.yaml. Instead of manually configuring infrastructure, SwiftDeploy generates all required configurations and controls the lifecycle of the system.
⸻
This project implements: • Declarative infrastructure using YAML • Automatic generation of: ◦ nginx.conf ◦ docker-compose.yml • Container lifecycle management • Canary and stable deployment modes • Health checks and validation
manifest.yaml
↓
swiftdeploy CLI
↓
nginx.conf + docker-compose.yml
↓
Docker Compose
↓
Nginx → API ServiceArchitecture
⸻
swiftdeploy-project/
│
├── manifest.yaml
├── swiftdeploy.py
├── nginx.conf
├── docker-compose.yml
│
├── app/
│ ├── main.py
│ └── Dockerfile
│
├── templates/
│ ├── nginx.conf.tpl
│ └── docker-compose.yml.tpl
│
└── README.md
⸻
Requirements
Python Docker & Docker Compose
⸻
pip install pyyaml jinja2 requests
⸻
- Generate configuration files python swiftdeploy.py init
⸻
Runs 5 pre-flight checks:
manifest validity required fields docker image existence nginx port availability nginx configuration validity
python swiftdeploy.py validate
⸻
• Generates configs • Starts containers • Waits for /healthz (max 60s)
python swiftdeploy.py deploy
⸻
Switch to canary mode python swiftdeploy.py promote canary
Switch back to stable python swiftdeploy.py promote stable
⸻
Stops and removes all resources: python swiftdeploy.py teardown Remove generated files as well:
python swiftdeploy.py teardown --clean
⸻
GET / Returns: • message • mode (stable/canary) • version • timestamp
GET /healthz Returns: • status • uptime (seconds)
POST /chaos (canary only)
⸻
{ "mode": "slow", "duration": 3 }
{ "mode": "error", "rate": 0.5 }
{ "mode": "recover" }
⸻
• Stable → normal operation • Canary → adds X-Mode: canary header and enables chaos testing
⸻
• manifest.yaml is the single source of truth • Generated files must not be edited manually • All infrastructure is derived from the manifest
• init regenerates configs • validate passes all checks • deploy succeeds • promote canary/stable works • teardown --clean works
⸻
Include: • Validation output • Deployment output • Promotion confirmation • Generated configs • Nginx access logs
⸻
Built as part of the HNG DevOps Stage 4A task.