Minimal Python Flask application used for deployment validation across any environment (local, Docker, Kubernetes, ECS, etc.).
This is the Python counterpart to the node-express-probe and validates deployment across different stacks.
- Validate Docker builds and images
- Test Kubernetes / ECS deployments
- Verify CI/CD smoke tests
- Experiment with runtime behavior across different platforms
- Backstage integration testing
| Endpoint | Method | Purpose |
|---|---|---|
/ |
GET | Root - basic service info |
/health |
GET | Health check (returns JSON) |
/healthz |
GET | Kubernetes-style health check |
/ready |
GET | Readiness probe |
/live |
GET | Liveness probe |
/api/v1/info |
GET | Detailed app info (time, hostname, version) |
/api/v1/version |
GET | Version and commit info |
# Install dependencies
pip install -r requirements.txt
# Run the app
python src/app.pyThe app will start on http://localhost:8080
# Set custom version and commit
APP_VERSION=2.0.0 APP_COMMIT_SHA=abc123 python src/app.py# Build image
docker build -t python-probe:latest .
# Run container
docker run -p 8080:8080 python-probe:latest
# With environment variables
docker run -p 8080:8080 \
-e APP_VERSION=2.0.0 \
-e APP_COMMIT_SHA=abc123 \
python-probe:latestThe app includes proper probe endpoints for Kubernetes:
livenessProbe:
httpGet:
path: /live
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5See k8s/deploy.yaml for full deployment example.
The app works on any environment. Set environment variables via:
- EC2: User data script or SSM Parameter Store
- ECS: Task definition environment variables
- Docker:
-eflag or.envfile
# Example EC2 user data
#!/bin/bash
export APP_VERSION=1.0.0
export APP_COMMIT_SHA=${GIT_COMMIT}
python /app/src/app.py| Variable | Default | Purpose |
|---|---|---|
PORT |
8080 |
Port to listen on |
APP_VERSION |
1.0.0 |
Application version |
APP_COMMIT_SHA |
unknown |
Git commit SHA (for tracking) |
For production, the Docker image uses Gunicorn (4 workers) instead of Flask's development server:
# Manual production run
gunicorn --bind 0.0.0.0:8080 --workers 4 --access-logfile - app:appsrc/
app.py # Flask application
requirements.txt # Python dependencies
Dockerfile # Docker image definition
k8s/ # Kubernetes manifests
chart/ # Helm chart (optional)
# Health checks
curl http://localhost:8080/health
curl http://localhost:8080/live
curl http://localhost:8080/ready
# App info
curl http://localhost:8080/api/v1/info
curl http://localhost:8080/api/v1/versionMIT