/FastAPI_EKS_Kubernetes

FastAPI & Kubernetes Tutorial with PyCharm

Primary LanguagePython

FastAPI Tutorial Series

stack_logo

Welcome to the FastAPI & Kubernetes Tutorial Series with PyCharm & AWS EKS.

Prerequisites

Before starting up this project, make sure you have an AWS account and PyCharm installed in your machine.

Software Installation

  • AWS Command Line Interface - The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services.

  • eksctl - The official CLI for Amazon EKS

  • Docker - Docker helps developers bring their ideas to life by conquering the complexity of app development.

  • Kubernetes - also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.

  • Helm - The package manager for Kubernetes. Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.

  • PostgreSQL - The World's Most Advanced Open Source Relational Database

  • Redis - open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker

  • NICE DCV (Optional) - Deliver high-performance remote desktop and application streaming. If you are interested to run your workload directly in AWS.

System Dependencies

  • Make sure your system is up-to-date.
  • Run the below command to install python system dependencies along-with postgres driver.
$ sudo apt-get install libpq-dev python-dev libssl-dev

Python Dependencies

  • Installing Python Packages
$ pip install -r requirements.txt

requirements-install

  • Running Uvicorn Server
$ uvicorn main:app --reload

Environment

Make sure to update the environment variables in ecommerce/config.py, before starting up the project.

config-file

Celery

Make sure before starting up Celery, redis is up and running.

Command to start celery worker :

$ celery -A main.celery worker -l info

or with execution pool

$ celery -A main.celery worker -l info --pool=prefork

Reference Materials:

celery-task

Testing

Before proceeding make sure you have created a test database in Postgres.

python-testing

DockerHub

References

If you are interested to know more about AWS with Python, then you can follow the below links.