DevOps · learning projectIn progress
DevOpsHub.
A small Flask app I used to learn CI/CD, Docker and deploying to AWS.
Every push to main is tested, built into a Docker image and deployed to an EC2 instance. If the new version fails its health check, the old one is restored.
- Flask
- PostgreSQL
- Docker Compose
- GitHub Actions
- AWS EC2 + SSM
fig. 02
- PUSH
- TEST
- BUILD
- DEPLOY
- HEALTH
$ git push origin main
main · github actionsrollback armed
What I built
- GitHub Actions workflow: pytest, frontend build and a container smoke test.
- Images tagged with the commit SHA and pushed to GitHub Container Registry.
- Deploys through AWS Systems Manager, so no SSH keys are stored in GitHub.
- A deploy script on the server that pulls the new image, checks /api/health and /api/db-health, and rolls back to the previous SHA if they fail.
Hard parts
CHALLENGE // 01
Shell quoting broke inside SSM commands
- Problem
- Multi-line scripts passed through YAML, JSON and bash kept breaking on nested quotes.
- Fix
- Put deploy.sh on the server. The workflow now runs one short command and passes the SHA.
- Learned
- CI should trigger scripts, not contain them.
CHALLENGE // 02
A failed deploy left the site down
- Problem
- The first version stopped the old container before the new one was ready.
- Fix
- Pull the image first, swap containers, health-check, and restore the previous tag on failure.
Limits and next steps
- – Next: Prometheus metrics, CloudWatch logs, Terraform. None of these are built yet.