A cloud-native task management application built with Flask and designed for Kubernetes/OpenShift deployment.
TaskFlow is a RESTful API service for managing tasks. It supports both in-memory storage (development) and PostgreSQL database (production), making it suitable for learning container orchestration and cloud deployment patterns.
- Backend: Flask (Python) REST API
 - Container Runtime: Docker
 - Orchestration: Kubernetes/OpenShift
 - Database: PostgreSQL (optional, enabled with 
USE_DATABASE=true) - Storage: In-memory (default) or PostgreSQL
 
taskflow-app/
├── app/
│   ├── backend/
│   │   ├── app.py              # Flask application
│   │   ├── Dockerfile          # Container image definition
│   │   └── requirements.txt    # Python dependencies
│   └── database/
│       └── init.sql            # Database schema initialization
├── k8s/
│   ├── week1-kubernetes/       # Basic Kubernetes deployment
│   ├── week2-s2i/              # Source-to-Image build configs
│   └── week3-database/         # PostgreSQL StatefulSet & integration
│       ├── postgres-statefulset.yaml
│       ├── database-secret.yaml
│       ├── configmap-with-db.yaml
│       └── deployment-with-db.yaml
├── ansible/                    # Week 4: Ansible automation
│   ├── ansible.cfg
│   ├── env.sh                  # Environment configuration
│   ├── inventory/
│   │   └── openshift.yml
│   ├── roles/
│   │   ├── taskflow-backend/
│   │   └── taskflow-database/
│   └── playbooks/
│       ├── 01-simple-namespace.yml
│       ├── deploy-full-stack.yml
│       └── day2-operations.yml
├── docs/
│   ├── week3-precheck.sh       # Week 3 prerequisites check
│   ├── verify-week3.sh         # Week 3 verification script
│   └── week4-precheck.sh       # Week 4 prerequisites check
├── get-db-pod.sh               # Database pod helper script
└── README.md
GET /- Application infoGET /api- API information with database statusGET /health- Health check endpointGET /api/tasks- List all tasksPOST /api/tasks- Create a new taskPUT /api/tasks/<id>- Update a taskDELETE /api/tasks/<id>- Delete a task
- Python 3.13+
 - Docker (for containerization)
 - Kubernetes/OpenShift cluster (for deployment)
 
cd app/backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.pyThe API will be available at http://localhost:8080
# Get all tasks
curl http://localhost:8080/api/tasks
# Create a task
curl -X POST http://localhost:8080/api/tasks \
  -H "Content-Type: application/json" \
  -d '{"title":"New Task"}'
# Update a task
curl -X PUT http://localhost:8080/api/tasks/1 \
  -H "Content-Type: application/json" \
  -d '{"completed":true}'
# Delete a task
curl -X DELETE http://localhost:8080/api/tasks/1cd app/backend
docker build -t taskflow-backend:v1.0 .
docker run -p 8080:8080 taskflow-backend:v1.0# Prerequisites check
./docs/week4-precheck.sh
# Setup Ansible environment
cd ansible
source env.sh
# Deploy full stack (database + backend)
ansible-playbook playbooks/deploy-full-stack.yml
# Check health and status
ansible-playbook playbooks/day2-operations.yml
# Verify deployment
BACKEND=$(oc get route taskflow-backend -n happyotter-dev -o jsonpath='{.spec.host}')
curl https://$BACKEND/health# Prerequisites check
./docs/week3-precheck.sh
# Deploy PostgreSQL StatefulSet
oc apply -f k8s/week3-database/postgres-statefulset.yaml
# Create database secret
oc apply -f k8s/week3-database/database-secret.yaml
# Update ConfigMap and Deployment with database integration
oc apply -f k8s/week3-database/configmap-with-db.yaml
oc apply -f k8s/week3-database/deployment-with-db.yaml
# Initialize database
DB_POD=$(./get-db-pod.sh happyotter-dev)
oc cp app/database/init.sql $DB_POD:/tmp/init.sql -n happyotter-dev
oc exec -it $DB_POD -n happyotter-dev -- psql -U taskflowuser -d taskflowdb -f /tmp/init.sql
# Verify deployment
./docs/verify-week3.sh# Apply all manifests
kubectl apply -f k8s/week1-kubernetes/
# Check deployment status
kubectl get all -n happyotter-dev
# View logs
kubectl logs -n happyotter-dev deployment/taskflow-backend# OpenShift Route (automatic)
ROUTE=$(oc get route taskflow-backend -n happyotter-dev -o jsonpath='{.spec.host}')
curl https://$ROUTE/health
# Kubernetes Port Forward
kubectl port-forward -n happyotter-dev service/taskflow-backend 8080:8080The application uses environment variables configured via ConfigMap:
APP_VERSION- Application version (default: "1.0")ENVIRONMENT- Environment name (default: "development")USE_DATABASE- Enable PostgreSQL (default: "false")DB_HOST- Database host (when USE_DATABASE=true)DB_NAME- Database nameDB_USER- Database userDB_PASSWORD- Database password (use Secrets in production)DB_PORT- Database port (default: "5432")
- Containerized Flask application
 - Kubernetes manifests (Namespace, ConfigMap, Deployment, Service)
 - RESTful API with CRUD operations
 - Health check endpoint
 - Resource limits and requests
 - Liveness and readiness probes
 - Security context configuration
 
- OpenShift deployment
 - Source-to-Image (S2I) builds
 - BuildConfig and ImageStream
 - OpenShift Routes for external access
 - GitHub webhook integration
 - Automated CI/CD pipeline
 
- PostgreSQL StatefulSet deployment
 - Persistent Volume Claims (PVC)
 - Database secrets management
 - Application-database connectivity
 - Database initialization scripts
 - Connection pooling
 - Health checks with database status
 
- Ansible environment setup
 - Ansible roles (backend, database)
 - Full stack deployment playbook
 - Day 2 operations (health checks)
 - Idempotent resource management
 - OpenShift security context compliance
 - Automated route creation with TLS
 
- Frontend application
 - Monitoring and logging
 - Advanced security features
 - GitOps with ArgoCD
 
- Namespace: 
happyotter-dev - Backend Replicas: 2
 - Image: 
quay.io/happyotter/taskflow-backend(built via S2I) - Port: 8080
 - Resource Requests: 100m CPU, 128Mi memory
 - Resource Limits: 500m CPU, 512Mi memory
 
- Type: PostgreSQL 15 (Alpine)
 - Deployment: StatefulSet (1 replica)
 - Storage: 1Gi Persistent Volume (gp3 storage class)
 - Service: Headless service (ClusterIP: None)
 - Port: 5432
 - Resource Requests: 100m CPU, 256Mi memory
 - Resource Limits: 500m CPU, 512Mi memory
 
- API: https://taskflow-backend-happyotter-dev.apps.rm3.7wse.p1.openshiftapps.com
 - Health: https://taskflow-backend-happyotter-dev.apps.rm3.7wse.p1.openshiftapps.com/health
 - Tasks API: https://taskflow-backend-happyotter-dev.apps.rm3.7wse.p1.openshiftapps.com/api/tasks
 
This project is for educational purposes.