From 563f50979aa1cd69e4f596204d2204111193c839 Mon Sep 17 00:00:00 2001 From: HIMANSHU Date: Mon, 18 Mar 2024 11:41:51 +0530 Subject: [PATCH] updated readme --- .env.example | 3 ++- README.md | 39 +++++++++++++++++++++++++++++++++++---- requirements.txt | 1 + 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 24b7f53..6c2b988 100644 --- a/.env.example +++ b/.env.example @@ -8,4 +8,5 @@ OPENAI_API_KEY_WEDNESDAY= SECRET_KEY= REDIS_URL= SENTRY_DSN= -SLACK_WEBHOOK_URL= \ No newline at end of file +SLACK_WEBHOOK_URL= +DB_ROOT_PASSWORD= //this is applicable for .env.local file only diff --git a/README.md b/README.md index 4816f71..f7da966 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,26 @@ This repository provides a template for creating and deploying a FastAPI project ## Getting Started +### Requirements: +- Python 3.11 +- Docker +- redis +- mysql + ### 1. Initialize Local Environment -To set up your local environment, run the following script: +- To set up your local environment, run the following script: ``` ./scripts/initialize-env.sh ``` This script installs the necessary dependencies and prepares the environment for running the FastAPI application on your local machine. - +- Create a .env.local file with reference of .env.example + Run following command to inject env file + ```shell + set -a source .env.local set +a + ``` ### 2. Run the Project Start the project locally with the following command: @@ -59,7 +69,7 @@ If you are new to AWS Copilot or you want to learn more about AWS Copilot, pleas ``` docker run --name recorder-redis -p 6379:6379 -d redis:alpine ``` -or add the REDIS_URL in .env file +or add the REDIS_URL in .env.local file ### 6. Circuit breakers @@ -85,4 +95,25 @@ async def external_service_endpoint(): return {"message": result} except CircuitBreakerError: raise HTTPException(status_code=503, detail="Service temporarily unavailable") -``` \ No newline at end of file +``` + +### Celery Dependencies +- Run following command to initiallize the celery worker +```shell +celery -A app.app.celery worker -l info +``` +- Turn Up Celery Flower with + ```shell + flower --broker=${REDIS_URL}/6 --port=5555 + ``` + +### Running Application into Docker Container + +- Create a file .env.docker with reference of .env.example +- Inject Docker environment using + ```shell + set -a source .env.docker set +a +- use following command to turn on the application + ```shell + docker compose --env-file .env.docker up + ``` diff --git a/requirements.txt b/requirements.txt index a8ce72e..8d24e21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,6 +27,7 @@ fastapi==0.95.2 fastapi-pagination flake8 flatbuffers==23.5.26 +flower==2.0.1 freezegun==1.4.0 frozenlist==1.3.3 ftfy==6.1.1