This project is production-ready at a basic level and prepared for deployment.
A fully containerized web application built with Flask and PostgreSQL.
It tracks page visits and stores the count in a database.
This project demonstrates real-world DevOps practices using Docker.
- Python Flask — Backend web framework
- PostgreSQL — Database
- Docker — Containerization
- Docker Compose — Multi-container management
Browser ↓ Flask Container (port 5000) ↓ psycopg2 PostgreSQL Container ↓ pgdata Volume (persistent storage)
- Multi-container architecture using Docker Compose
- Flask connected to PostgreSQL database
- Persistent data storage using Docker volumes
- Environment variables using
.env(no hardcoded secrets) - Health checks for monitoring app status
- Restart policy (
restart: always) for auto recovery - Clean Docker image using
.dockerignore
- Docker installed
- Docker Compose installed
- Create a
.envfile in project root:
DB_NAME=myapp DB_USER=user DB_PASSWORD=password DB_HOST=db
- Run the project:
docker compose up -d Open in browser: http://localhost:5000
Page visited X times!
Count increases on refreshing.
You can directly pull and run the app:
docker pull tj2905/flask-devops-app:v1.0 docker run -p 5000:5000 tj2905/flask-devops-app:v1.0
flask-docker-app/ ├── app.py ├── Dockerfile ├── docker-compose.yml ├── requirements.txt ├── .env (not committed) ├── .gitignore ├── .dockerignore └── README.md
- Docker image building
- Multi-container architecture
- Container networking
- Persistent volumes
- Environment variables (.env)
- Health checks
- Restart policies
- Secure configuration management
- Add CI/CD using GitHub Actions
- Use Kubernetes for orchestration
- Add Terraform for infrastructure
Built as part of DevOps learning journey 🚀
