feat: add redis and redis settings

This commit is contained in:
Vladislav Syrochkin 2025-03-20 12:32:16 +05:00
parent 2dc50465ce
commit a6c7819e36
3 changed files with 23 additions and 3 deletions

View File

@ -38,6 +38,11 @@ class DefaultSettings(BaseSettings):
BROKER_PASSWORD: str = environ.get("BROKER_PASSWORD", "guest")
BROKER_RABBITMQ_VHOST: str = environ.get("BROKER_RABBITMQ_VHOST", "")
REDIS_HOST: str = environ.get("REDIS_HOST", "localhost")
REDIS_PORT: int = int(environ.get("REDIS_PORT", "6379"))
REDIS_DB: int = int(environ.get("REDIS_DB", "0"))
REDIS_PASSWORD: str = environ.get("REDIS_PASSWORD", "hackme")
class Config:
# env_file = "../.env"
env_file_encoding = "utf-8"

View File

@ -16,8 +16,19 @@ services:
MYSQL_USER: connect
MYSQL_PASSWORD: hackme
volumes:
- data:/var/lib/mysql
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
redis:
image: redis:7-alpine
container_name: redis
command: redis-server --requirepass password
environment:
REDIS_PASSWORD: hackme
ports:
- "6379:6379"
volumes:
- redis_data:/data
volumes:
data:
mysql_data:
redis_data:

View File

@ -16,7 +16,11 @@ environment=
BROKER_USER=guest,
BROKER_PORT=5672,
BROKER_PASSWORD=guest,
BROKER_RABBITMQ_VHOST=/
BROKER_RABBITMQ_VHOST=/,
REDIS_HOST=localhsot,
REDIS_PORT=6379,
REDIS_PASSWORD=hackme,
REDIS_DB=0
command=bash -c 'cd api; poetry run python3 -m api'
numprocs=1
process_name=uvicorn-%(process_num)d