A simple and elegant todo application built with Python Flask and SQLite, designed for deployment on Kubernetes using Helm and ArgoCD.
- ✅ Clean and modern web interface
- ✅ SQLite database for data persistence
- ✅ Add, complete, and delete todos
- ✅ Real-time task statistics
- ✅ RESTful API endpoints
- ✅ Health check endpoints for Kubernetes
- ✅ Containerized with Docker
- ✅ Kubernetes-ready with Helm charts
- ✅ GitOps deployment with ArgoCD
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Access the app: Open your browser and go to
http://localhost:5000
-
Build the image:
docker build -t todo-app:latest . -
Run the container:
docker run -p 5000:5000 -v $(pwd)/data:/app/data todo-app:latest
-
Install the Helm chart:
helm install todo-app ./helm/todo-app
-
Upgrade the deployment:
helm upgrade todo-app ./helm/todo-app
-
Uninstall:
helm uninstall todo-app
-
Apply all manifests:
kubectl apply -f k8s/
-
Check deployment status:
kubectl get pods -n todo-app kubectl get svc -n todo-app
-
Apply the ArgoCD application:
kubectl apply -f argocd/application.yaml
-
Apply the ArgoCD project (optional):
kubectl apply -f argocd/appproject.yaml
-
Access ArgoCD UI and sync the application
Key configuration options in helm/todo-app/values.yaml:
replicaCount: Number of pod replicas (default: 2)image.repository: Docker image repositoryimage.tag: Docker image tagpersistence.enabled: Enable SQLite data persistence (default: true)persistence.size: Storage size for SQLite database (default: 1Gi)ingress.enabled: Enable ingress (default: true)ingress.hosts[0].host: Hostname for the application (default: todo-app.local)
PORT: Application port (default: 5000)
GET /- Main todo application interfacePOST /add- Add a new todoGET /toggle/<id>- Toggle todo completion statusGET /delete/<id>- Delete a todoGET /api/todos- Get all todos as JSONGET /health- Health check endpoint
The application uses SQLite for data storage with the following schema:
CREATE TABLE todos (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
description TEXT,
completed BOOLEAN NOT NULL DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ ArgoCD │───▶│ Kubernetes │───▶│ Todo App │
│ (GitOps) │ │ Cluster │ │ (Flask) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Helm │ │ SQLite │
│ (Charts) │ │ (Database) │
└─────────────────┘ └─────────────────┘
.
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── Dockerfile # Container image definition
├── .dockerignore # Docker ignore patterns
├── templates/ # HTML templates
│ ├── base.html # Base template
│ └── index.html # Main page template
├── k8s/ # Raw Kubernetes manifests
│ ├── namespace.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ └── pvc.yaml
├── helm/ # Helm chart
│ └── todo-app/
│ ├── Chart.yaml
│ ├── values.yaml
│ └── templates/
└── argocd/ # ArgoCD manifests
├── application.yaml
└── appproject.yaml
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally and with Docker
- Submit a pull request
- Application runs as non-root user in container
- Resource limits configured for pods
- Health checks implemented for reliability
- SQLite database stored in persistent volume
The application provides a health check endpoint at /health that returns:
{
"status": "healthy",
"timestamp": "2024-01-01T12:00:00.000000"
}This project is licensed under the MIT License.