Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Python FastAPI - Mini DevOps CI/CD Assessment

Technology Stack

  • Python 3.11+
  • FastAPI
  • Uvicorn
  • Docker
  • Jenkins
  • Kubernetes

Objective

Automate the build, Docker image creation, Docker image push, and Kubernetes deployment of a FastAPI Inventory REST API.


REST Endpoints

Method| Endpoint| Description GET| "/health"| Health check GET| "/products"| Retrieve all products POST| "/products"| Add a product

Use an in-memory list. No database is required.


Module 1 - Run the Application

Install dependencies

pip install -r requirements.txt

Run

uvicorn main:app --host 0.0.0.0 --port 8000

Application URL

http://localhost:8000

Swagger

http://localhost:8000/docs

Verify

GET /health GET /products


Module 2 - Dockerize the Application

Create a "Dockerfile".

Verify:

  • Docker image builds successfully.
  • Container starts successfully.
  • Health endpoint is reachable.

Module 3 - Jenkins Pipeline

Create a Declarative "Jenkinsfile" containing:

  1. Checkout
  2. Install Dependencies
  3. Docker Build
  4. Docker Push

Docker image format:

/python-inventory-api:${BUILD_NUMBER}


Module 4 - Kubernetes Deployment

Create:

  • "deployment.yaml"
  • "service.yaml"

Requirements:

  • Replicas = 2
  • NodePort Service

Deploy

kubectl apply -f deployment.yaml kubectl apply -f service.yaml

Verify

kubectl get pods kubectl get svc


Deliverables

  • FastAPI Source Code
  • Dockerfile
  • Jenkinsfile
  • deployment.yaml
  • service.yaml
  • Jenkins Pipeline Screenshot
  • Docker Hub Screenshot
  • Kubernetes Pods Screenshot
  • Browser/Postman Output Screenshot

Author

RaviKumar K

License

This project is provided for learning, training, and demonstration purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages