Skip to content

radaisystems/sample-application-01

Repository files navigation

sample-application-01

sample

Overview

This is a web-service built with Python 3.13, created using the Backstage GitHub Repository Generator template.

Features

  • 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)

Getting Started

Prerequisites

  • Python 3.13+
  • pip
  • Docker (for containerization)
  • Kubernetes cluster (for deployment)
  • Helm 3+ (for chart deployment)

Local Development

  1. Clone the repository:

    git clone https://github.com/radaisystems/sample-application-01.git
    cd sample-application-01
  2. Navigate to the app directory:

    cd app/python
  3. Install dependencies:

    pip install -r requirements.txt

    Adding Extra Packages: Edit app/python/requirements.txt to uncomment and add any additional Python packages you need. Common packages are already listed as examples.

  4. Start the application:

    python main.py

The application will be available at http://localhost:3000

Running Tests

cd app/python
pytest

Health Checks

  • Health: GET /health - Application health status
  • Readiness: GET /ready - Application readiness status

Docker

Build the Docker image:

docker build -t radaisystems/sample-application-01:latest .

Run the container:

docker run -p 3000:3000 radaisystems/sample-application-01:latest

Kubernetes Deployment

Using Helm

  1. Install the Helm chart:

    helm install sample-application-01 ./infrastructure/helm
  2. Upgrade the deployment:

    helm upgrade sample-application-01 ./infrastructure/helm
  3. Uninstall:

    helm uninstall sample-application-01

Configuration

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

Customize Values

Edit infrastructure/helm/values.yaml to customize the deployment according to your needs.

Deployment Strategy (Trunk-Based)

This project uses trunk-based deployment for continuous delivery:

Automatic Deployments

  • Development: Auto-deployed on every push to main branch
  • Testing: All PRs are automatically tested before merge

Manual Deployments (Promotion)

  • Staging: Manual trigger via GitHub Actions
  • Production: Manual trigger via GitHub Actions (requires approval)

How to Deploy

  1. To Development (Automatic):

    git push origin main
    # Automatically deploys to development environment
  2. To Staging (Manual):

    • Go to GitHub Actions → CI/CD Pipeline → Run workflow
    • Select "staging" environment
    • Click "Run workflow"
  3. To Production (Manual):

    • Go to GitHub Actions → CI/CD Pipeline → Run workflow
    • Select "production" environment
    • Click "Run workflow"
    • Requires production environment approval

Rollback Strategy

# Emergency rollback (if needed)
kubectl rollout undo deployment/sample-application-01 -n <environment>

# Or re-run workflow with previous stable version

Project Structure

sample-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
            └── ...

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published