Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ git clone https://github.com/igormagalhaesr/FastAPI-boilerplate
```

### 3.1 Environment Variables (.env)
And create a ".env" file:

Then create a `.env` file:
Then create a `.env` file inside `src` directory:
```sh
touch .env
```
Expand All @@ -140,8 +139,8 @@ For the database ([`if you don't have a database yet, click here`]()), create:
# ------------- database -------------
POSTGRES_USER="your_postgres_user"
POSTGRES_PASSWORD="your_password"
POSTGRES_SERVER="your_server" # default localhost
POSTGRES_PORT=5432
POSTGRES_SERVER="your_server" # default "localhost", if using docker compose you should use "db"
POSTGRES_PORT=5432 # default "5432", if using docker compose you should use "5432"
POSTGRES_DB="your_db"
```

Expand Down Expand Up @@ -170,23 +169,22 @@ ADMIN_PASSWORD="your_password"

For redis caching:
```
# ------------- redis -------------
REDIS_CACHE_HOST="your_host" # default "localhost", if using docker compose you should user "redis"
REDIS_CACHE_PORT=6379
# ------------- redis cache-------------
REDIS_CACHE_HOST="your_host" # default "localhost", if using docker compose you should use "redis"
REDIS_CACHE_PORT=6379 # default "6379", if using docker compose you should use "6379"
```

And for client-side caching:
```
# ------------- redis cache -------------
REDIS_CACHE_HOST="your_host" # default "localhost", if using docker compose you should user "redis"
REDIS_CACHE_PORT=6379
# ------------- redis client-side cache -------------
CLIENT_CACHE_MAX_AGE=30 # default "30"
```

For ARQ Job Queues:
```
# ------------- redis queue -------------
REDIS_CACHE_HOST="your_host" # default "localhost", if using docker compose you should use "db"
REDIS_CACHE_PORT=6379
REDIS_QUEUE_HOST="your_host" # default "localhost", if using docker compose you should use "redis"
REDIS_QUEUE_PORT=6379 # default "6379", if using docker compose you should use "6379"
```
> [!WARNING]
> You may use the same redis for both caching and queue while developing, but the recommendation is using two separate containers for production.
Expand All @@ -200,8 +198,8 @@ TIER_NAME="free"
For the rate limiter:
```
# ------------- redis rate limit -------------
REDIS_RATE_LIMIT_HOST="localhost" # default="localhost"
REDIS_RATE_LIMIT_PORT=6379 # default=6379
REDIS_RATE_LIMIT_HOST="localhost" # default="localhost", if using docker compose you should use "redis"
REDIS_RATE_LIMIT_PORT=6379 # default=6379, if using docker compose you should use "6379"


# ------------- default rate limit settings -------------
Expand Down
9 changes: 7 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ services:
# command: gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000
env_file:
- ./src/.env
# -------- replace with comment if you are using nginx --------
ports:
- "8000:8000"
# expose:
# - "8000"
depends_on:
- db
- redis
Expand All @@ -37,13 +40,15 @@ services:
- ./src/.env
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
expose:
- "5432"

redis:
image: redis:alpine
volumes:
- redis-data:/data
expose:
- "6379"

# #-------- uncomment to run with nginx --------
# nginx:
Expand Down