Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-wedensday committed Mar 18, 2024
1 parent 6b768ab commit 563f509
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ OPENAI_API_KEY_WEDNESDAY=
SECRET_KEY=
REDIS_URL=
SENTRY_DSN=
SLACK_WEBHOOK_URL=
SLACK_WEBHOOK_URL=
DB_ROOT_PASSWORD= //this is applicable for .env.local file only
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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

Expand All @@ -85,4 +95,25 @@ async def external_service_endpoint():
return {"message": result}
except CircuitBreakerError:
raise HTTPException(status_code=503, detail="Service temporarily unavailable")
```
```

### 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
```
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 563f509

Please sign in to comment.