sample
This is a web-service built with Python 3.13, created using the Backstage GitHub Repository Generator template.
- Application Type: web-service
- Runtime: Python 3.13
- Port: 3000
- Containerized: Docker support included
- Kubernetes Ready: Helm charts included
- Auto-scaling: Horizontal Pod Autoscaler configured (2-10 replicas)
- Health Checks: Liveness and readiness probes configured
- CI/CD Pipeline: Trunk-based deployment with GitHub Actions (auto-deploy to dev, manual promote to staging/prod)
- Python 3.13+
- pip
- Docker (for containerization)
- Kubernetes cluster (for deployment)
- Helm 3+ (for chart deployment)
-
Clone the repository:
git clone https://github.com/radaisystems/sample-application-01.git cd sample-application-01 -
Navigate to the app directory:
cd app/python -
Install dependencies:
pip install -r requirements.txt
Adding Extra Packages: Edit
app/python/requirements.txtto uncomment and add any additional Python packages you need. Common packages are already listed as examples. -
Start the application:
python main.py
The application will be available at http://localhost:3000
cd app/python
pytest- Health:
GET /health- Application health status - Readiness:
GET /ready- Application readiness status
docker build -t radaisystems/sample-application-01:latest .docker run -p 3000:3000 radaisystems/sample-application-01:latest-
Install the Helm chart:
helm install sample-application-01 ./infrastructure/helm
-
Upgrade the deployment:
helm upgrade sample-application-01 ./infrastructure/helm
-
Uninstall:
helm uninstall sample-application-01
The Helm chart supports the following key configurations:
- Replicas: 2 (initial)
- Auto-scaling: 2-10 replicas
- CPU Threshold: 70%
- Memory Threshold: 80%
- Resources:
- CPU: 100m (request), 500m (limit)
- Memory: 128Mi (request), 512Mi (limit)
- Service Type: ClusterIP
Edit infrastructure/helm/values.yaml to customize the deployment according to your needs.
This project uses trunk-based deployment for continuous delivery:
- Development: Auto-deployed on every push to
mainbranch - Testing: All PRs are automatically tested before merge
- Staging: Manual trigger via GitHub Actions
- Production: Manual trigger via GitHub Actions (requires approval)
-
To Development (Automatic):
git push origin main # Automatically deploys to development environment -
To Staging (Manual):
- Go to GitHub Actions → CI/CD Pipeline → Run workflow
- Select "staging" environment
- Click "Run workflow"
-
To Production (Manual):
- Go to GitHub Actions → CI/CD Pipeline → Run workflow
- Select "production" environment
- Click "Run workflow"
- Requires production environment approval
# Emergency rollback (if needed)
kubectl rollout undo deployment/sample-application-01 -n <environment>
# Or re-run workflow with previous stable versionsample-application-01/
├── README.md
├── catalog-info.yaml # Backstage catalog definition
├── Dockerfile # Container definition
├── .github/ # CI/CD workflows
│ └── workflows/
│ └── ci-cd.yml # GitHub Actions pipeline
├── app/ # Application code
│ └── python/
│ ├── main.py # Python Flask application
│ ├── requirements.txt # Python dependencies
│ ├── __init__.py
│ └── tests/ # Test files
│ ├── __init__.py
│ └── test_main.py
└── infrastructure/
└── helm/ # Helm chart
├── Chart.yaml
├── values.yaml
└── templates/
├── deployment.yaml
├── service.yaml
├── hpa.yaml # Horizontal Pod Autoscaler
└── ...
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request