Skip to content

DevOps-Boot/fastapi-k8s

Repository files navigation

Contributors Forks Stargazers Issues


Traefik/FastAPI/PostgreSQL Microservices on Kubernetes

DevUniversity DevOps Engineer Bootcamp 202309, Diploma Project
Explore the docs »

Report Bug · Request Feature

About The Project

This project is part of the assessment for the French DevOps Administrator Diploma (RNCP36061) It aims to demonstrate candidates' skills in architecting, building, deploying, and monitoring microservices applications on cloud infrastructure, adhering to DevOps culture, and using automation tools and techniques extensively. The application stack includes Traefik, FastAPI, PostgreSQL, Kubernetes, and various DevOps tools for infrastructure automation, continuous integration and deployment, as well as monitoring and observability.

(back to top)

Audience

This project is mainly intended for the examination jury to assess candidates' skills and knowledge.

Nevertheless, authors are publishing it openly to give back to the community and hoping this may help other students or professionals.

(back to top)

Key Components

  • FastAPI: A modern, fast web framework for building APIs with Python.
  • PostgreSQL: Robust and scalable database for data persistence.
  • Traefik: As a reverse proxy and load balancer to route traffic.
  • Kubernetes (EKS): Container orchestration for managing and scaling the application infrastructure.
  • Terraform, Ansible, Helm: Infrastructure provisioning, configuration management, and cloud-native application packaging
  • GitHub Actions, Amazon ECR: CI/CD platform and artifact registry
  • Prometheus, and ELK Stack: Monitoring, logs and events management
  • Various DevOps processes and tools.

(back to top)

Getting Started

(back to top)

Prerequisites

Before using the project, ensure you have:

  • Docker
  • Kubectl
  • AWS CLI (configured with necessary access)
  • Terraform
  • Helm
  • Ansible

(back to top)

Configuration

  • Edit the .env file to customize environment-specific parameters.
  • Configure Terraform manifests as needed for infrastructure provisioning.
  • Configure Ansible playbooks as needed for server configuration.
  • Configure Helm charts variables as needed for application deployment.

(back to top)

Installation & Deployment

  1. Clone the Repository:

    git clone https://github.com/devops-boot/fastapi-k8s.git
  2. Set Up Infrastructure:

    • Use Terraform to provision the cloud infrastructure on AWS.
    • Configure Kubernetes cluster (EKS) using the provided scripts.
  3. Deploy the Application:

    • Deploy the FastAPI application and PostgreSQL database using Helm charts.
    • Configure Traefik as the Ingress controller.
  4. Continuous Integration/Continuous Deployment:

    • Set up GitHub Actions for CI/CD pipelines.
    • Automate the build, test, and deployment processes.

TODO: Automate all the previous steps in a single bootstrap.sh script.

(back to top)

Usage

(back to top)

For users

  • Access the FastAPI application through the Traefik load balancer URL.
  • Utilize the APIs as per the API documentation.

(back to top)

For developers

TODO: Developers use cases

  • Access CI/CD dashboard
  • Run CI/CD tasks or pipelines in 'dev' environment

(back to top)

For DevOps and SRE

  • Access 'production' environment through bastion host via {bastion_protocol} at {bastion_address}
  • Access dashboards (AWS, Kubernetes?, Prometheus, Grafana, Kibana, etc)

(back to top)

Contributing

Contributions are welcome. Please fork the repository and submit pull requests with any suggested changes.

(back to top)

Terms of use

The project is licensed under {link to license file}.

(back to top)