Skip to content

This project is a scalable Python microservice application that demonstrates industry-standard CI/CD practices, featuring a FastAPI web service, CLI tool, automated testing, code quality checks, Docker containerization, and cloud deployment via AWS. It showcases a complete software engineering lifecycle from development to production.

Notifications You must be signed in to change notification settings

gafar8281/Microservices-Python-Project

Repository files navigation

Python application test with Github Actions

[Python application test with Github Actions

Python Microservices Project with CI/CD

Project Overview :

This project is a fully functional Python microservice application that covers the full software engineering lifecycle:

  • 🔧 CLI Tool using Python's fire library
  • 🌐 FastAPI Web Service with REST endpoints
  • 🧪 Unit testing with Pytest and coverage reports
  • 💅 Code quality enforcement with black and pylint
  • ⚙️ Automated workflow using GitHub Actions (CI)
  • ☁️ Cloud Deployment via AWS CodeBuild, ECR, and App Runner (CD)
  • 🐳 Containerized using Docker

This project demonstrates industry-level practices in Continuous Integration (CI) and Continuous Deployment (CD) for scalable and maintainable services.

Environment Setup

# Create a virtual environment
virtualenv ~/.venv
source ~/.venv/bin/activate

# Install dependencies
make install

Makefile automates all important commands like installing dependencies, formatting code, running tests, and building Docker images.

Testing

  • Written using pytest and pytest-cov for code coverage
  • Run tests:
make test

Code Quality

  • black for code formatting
  • pylint for code linting
make format
make lint

CI will fail if linting or formatting checks do not pass.

CLI Tool with Fire

  • fire is used to run Python functions from the terminal.
chmod +x cli-fire.py

# View help
./cli-fire.py --help

# Search Wikipedia
./cli-fire.py --name Barack_Obama

Docker Support

  • Built and tested Docker container locally
make build
make run

CI/CD Pipeline

GitHub Actions (CI)

  • Automated workflow using .github/workflows/devops.yml
  • Runs lint, format, test, and build on every commit

AWS CodeBuild (CI)

  • Mirroring GitHub Actions CI inside AWS
  • Managed with buildspec.yml
  • Automatically pushes Docker image to AWS ECR

Deployment on AWS

  • ECR (Elastic Container Registry)
  • Created ECR repo and pushed image via CodeBuild

App Runner (CD)

  • Connected ECR with App Runner
  • Auto-deploy on every new ECR image update

Tech Stack

  • Python
  • FastAPI
  • Fire (CLI)
  • Docker
  • Pytest
  • Black, Pylint
  • GitHub Actions
  • AWS CodeBuild, ECR, App Runner

Conclusion

🎉 Python Microservice + CI/CD + Docker + AWS project completed successfully!

About

This project is a scalable Python microservice application that demonstrates industry-standard CI/CD practices, featuring a FastAPI web service, CLI tool, automated testing, code quality checks, Docker containerization, and cloud deployment via AWS. It showcases a complete software engineering lifecycle from development to production.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors