Python Basic Webserver
Summary
A minimal Python web server using Flask with a health check endpoint, Docker containerization, Kubernetes deployment manifests, and GitHub Actions CI/CD workflow. Ideal for microservices and API backends.
A minimal Flask web server. Displays "Hello World" with current time and date, and demonstrates deployment to Kubernetes via ArgoCD and GitHub Actions.
Quick Start
-
Update your terminal (tools were installed):
source ~/.bashrc -
Install dependencies and run:
pip install -r requirements.txt
python app/app.py -
Open in browser: http://localhost:6000
The server auto-reloads on file changes (Flask debug mode).
Prerequisites
Development tools are installed automatically by the devcontainer.
If you need to reinstall, run: dev-setup
Project Structure
After installation, your project contains:
├── app/
│ └── app.py # Flask server with Hello World
├── manifests/
│ ├── deployment.yaml # K8s Deployment + Service
│ └── kustomization.yaml # ArgoCD configuration
├── .github/
│ └── workflows/
│ └── urbalurba-build-and-push.yaml # CI/CD pipeline
├── Dockerfile # Container build
├── requirements.txt # Python dependencies
├── TEMPLATE_INFO # Template metadata
└── README-python-basic-webserver.md # This file
Development
- Edit
app/app.py— the main Flask application - Changes auto-reload in debug mode
- The
/endpoint returns "Hello World" with the template name and current time/date
Docker Build
docker build -t python-basic-webserver .
docker run -p 6000:6000 python-basic-webserver
Kubernetes Deployment
kubectl apply -k manifests/
The app will be accessible at http://<app-name>.localhost after ArgoCD registration.
CI/CD
The GitHub Actions workflow automatically builds and pushes the Docker image to GitHub Container Registry when changes are pushed to the main branch.