A Flask-based fitness and gym management web application with a fully automated CI/CD pipeline using GitHub Actions and Jenkins.
- Project Overview
- Features
- Tech Stack
- Project Structure
- Local Setup & Execution
- Running Tests Manually
- Docker Usage
- CI/CD Pipeline Overview
- API Endpoints
- Version History
ACEest Fitness & Gym is a web application designed for managing gym clients, tracking workouts, generating AI-style training programs, monitoring membership status, and calculating BMI. The project demonstrates modern DevOps practices including:
- Version Control with Git/GitHub (descriptive commits, branch management)
- Unit Testing with Pytest (30+ test cases)
- Containerization with Docker (optimized, non-root image)
- CI/CD Automation with GitHub Actions & Jenkins
| Feature | Description |
|---|---|
| Client Management | Full CRUD operations for gym clients |
| Workout Tracking | Log and retrieve workout sessions per client |
| AI Program Generator | Generate workout plans based on program type and experience |
| BMI Calculator | Calculate BMI and get WHO category classification |
| Calorie Estimator | Estimate daily calorie needs based on weight and program |
| Membership Tracking | Check active/expired membership status with expiry dates |
| Health Check Endpoint | /health endpoint for container orchestration and monitoring |
| Layer | Technology |
|---|---|
| Backend | Python 3.12 + Flask |
| Database | SQLite3 |
| Testing | Pytest |
| Linting | Flake8 |
| Containerization | Docker |
| CI/CD | GitHub Actions |
| Build Server | Jenkins |
devopsAssignment1/
βββ app.py # Flask application (main source)
βββ test_app.py # Pytest test suite
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker image definition
βββ Jenkinsfile # Jenkins pipeline definition
βββ .gitignore # Git ignore rules
βββ .github/
β βββ workflows/
β βββ main.yml # GitHub Actions CI/CD workflow
βββ templates/
β βββ index.html # Landing page template
βββ README.md # This file
- Python 3.10+ installed
- pip (Python package manager)
- Git
- Docker (optional, for container testing)
# 1. Clone the repository
git clone https://github.com/saaiarjun27/devopsAssignment1.git
cd devopsAssignment1
# 2. Create a virtual environment (recommended)
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run the application
python app.pyThe application will start on http://localhost:5000
# Run the full test suite with verbose output
pytest test_app.py -v
# Run with detailed failure info
pytest test_app.py -v --tb=long
# Run a specific test class
pytest test_app.py::TestBMICalculation -v
# Run with coverage (install pytest-cov first)
pip install pytest-cov
pytest test_app.py --cov=app --cov-report=term-missingThe test suite validates:
- β Health-check endpoint
- β Home page rendering
- β BMI calculation logic + endpoint (including edge cases)
- β Calorie estimation with all program types
- β AI program generation (beginner / intermediate / advanced)
- β Client CRUD (create, read, update, delete)
- β Workout logging & retrieval
- β Membership status checking (active / expired / not found)
- β Programs listing endpoint
- β Error handling (missing fields, invalid data)
docker build -t aceest-fitness:latest .docker run -p 5000:5000 aceest-fitness:latestVisit http://localhost:5000 in your browser.
docker run --rm aceest-fitness:latest python -m pytest test_app.py -v- Base image:
python:3.12-slim(minimal footprint) - Non-root user: Runs as
aceestuser for security - Layer caching: Dependencies installed before copying source
- Health check: Built-in
HEALTHCHECKinstruction
The pipeline is defined in .github/workflows/main.yml and is triggered on every push or pull_request to the main branch.
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β Stage 1: β β Stage 2: β β Stage 3: β
β Build & Lint ββββββΆβ Docker Image ββββββΆβ Automated Testing β
β β β Assembly β β (Pytest in Container) β
β β’ Install deps β β β’ docker build β β β’ Run test_app.py β
β β’ flake8 lint β β β’ Verify image β β β’ All 30+ tests β
β β’ Verify imports β β β β β
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββββββ
| Stage | What It Does |
|---|---|
| Build & Lint | Installs dependencies, runs flake8 syntax/error checks |
| Docker Assembly | Builds the Docker image and verifies it was created |
| Automated Testing | Runs the full Pytest suite inside the Docker container |
The Jenkinsfile defines a declarative pipeline with:
- Checkout β Pulls latest code from GitHub
- Install Dependencies β
pip install -r requirements.txt - Lint β Runs flake8 for syntax validation
- Test β Executes Pytest suite
- Docker Build β Builds and tags Docker image
- Install Jenkins on your server/local machine
- Install required plugins: Git, Pipeline, Docker Pipeline
- Create a New Pipeline job
- Under Pipeline β Definition, select Pipeline script from SCM
- Set SCM to Git and enter the repository URL:
https://github.com/saaiarjun27/devopsAssignment1.git - Set Script Path to
Jenkinsfile - Save and click Build Now
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Landing page |
GET |
/health |
Health check |
GET |
/api/programs |
List available programs |
GET |
/api/clients |
List all clients |
POST |
/api/clients |
Create/update a client |
GET |
/api/clients/<name> |
Get a specific client |
DELETE |
/api/clients/<name> |
Delete a client |
GET |
/api/workouts/<client_name> |
Get workouts for a client |
POST |
/api/workouts |
Log a new workout |
POST |
/api/bmi |
Calculate BMI |
POST |
/api/generate-program |
Generate AI workout program |
GET |
/api/membership/<client_name> |
Check membership status |
| Version | Description |
|---|---|
1.0 |
Initial Tkinter GUI β basic program display |
1.1 |
Added client profile inputs, calorie estimation |
1.1.2 |
Multi-client support, CSV export, progress chart |
2.0.1 |
SQLite database integration |
2.1.2 |
Database schema with workouts and exercises tables |
2.2.1 |
Role-based login system |
2.2.4 |
Full dashboard with AI program generator and PDF reports |
3.0.1 |
Membership management and billing |
3.1.2 |
Refactored UI with modal login and analytics tab |
3.2.4 |
Streamlined codebase, workout treeview |
| 4.0 | Flask web app + Docker + CI/CD pipeline (current) |
Sai Arjun β Junior DevOps Engineer
GitHub: @saaiarjun27
This project is developed as part of a DevOps academic assignment.