A declarative deployment CLI tool that generates Nginx and Docker Compose configurations from a single manifest.yaml file.
- Docker Desktop
- Python 3.x
- pip packages:
pip install pyyaml jinja2
swiftdeploy/ ├── manifest.yaml # Single source of truth ├── swiftdeploy # CLI tool ├── Dockerfile # API service image ├── app/ │ ├── main.py # Flask API service │ └── requirements.txt ├── templates/ │ ├── nginx.conf.j2 # Nginx template │ └── docker-compose.yml.j2 # Compose template └── README.md
- Clone the repo:
git clone https://github.com/Wonderfullymade01/swiftdeploy
cd swiftdeploy- Build the Docker image:
docker build -t wonderfullymade-api:latest .- Install Python dependencies:
pip install pyyaml jinja2Parses manifest.yaml and generates nginx.conf and docker-compose.yml:
python swiftdeploy initRuns 5 pre-flight checks before deployment:
python swiftdeploy validateChecks:
- manifest.yaml exists and is valid YAML
- All required fields are present
- Docker image exists locally
- Nginx port is free
- nginx.conf is syntactically valid
Runs init, starts the stack, and waits for health checks:
python swiftdeploy deploySwitches between canary and stable modes with a rolling restart:
python swiftdeploy promote canary
python swiftdeploy promote stableStops and removes all containers, networks, and volumes:
python swiftdeploy teardownAdd --clean to also delete generated config files:
python swiftdeploy teardown --clean| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Welcome message with mode, version, timestamp |
/healthz |
GET | Health check with uptime |
/chaos |
POST | Simulate degraded behaviour (canary mode only) |
# Slow responses
curl -X POST http://localhost:8080/chaos \
-H "Content-Type: application/json" \
-d '{"mode":"slow","duration":3}'
# Error rate
curl -X POST http://localhost:8080/chaos \
-H "Content-Type: application/json" \
-d '{"mode":"error","rate":0.5}'
# Recover
curl -X POST http://localhost:8080/chaos \
-H "Content-Type: application/json" \
-d '{"mode":"recover"}'All required screenshots (validate, deploy, promote, generated configs, nginx logs) are available here: Google Drive Screenshots
Full technical deep dive: SwiftDeploy: How I Built a Tool That Writes Its Own Infrastructure Files