Skip to content

Commit 504c15e

Browse files
committed
Add redis to the project
1 parent eea6b61 commit 504c15e

File tree

4 files changed

+239
-26
lines changed

4 files changed

+239
-26
lines changed

backend/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from enum import Enum
44

55
from dotenv import load_dotenv
6+
from redis.asyncio import Redis as _Redis
67

78
load_dotenv()
89

@@ -12,6 +13,8 @@
1213
MONGO_DATABASE = os.getenv("MONGO_DATABASE", "pydis_forms")
1314
SNEKBOX_URL = os.getenv("SNEKBOX_URL", "http://snekbox.default.svc.cluster.local/eval")
1415

16+
REDIS_CLIENT = _Redis.from_url(os.getenv("REDIS_URL"), encoding="utf-8")
17+
1518
PRODUCTION = os.getenv("PRODUCTION", "True").lower() != "false"
1619
PRODUCTION_URL = "https://forms.pythondiscord.com"
1720

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ services:
1515
- "127.0.0.1:8060:8060"
1616
privileged: true
1717

18+
redis:
19+
image: redis:latest
20+
ports:
21+
- "127.0.0.1:6379:6379"
22+
1823
backend:
1924
build:
2025
context: .
@@ -25,6 +30,7 @@ services:
2530
depends_on:
2631
- mongo
2732
- snekbox
33+
- redis
2834
tty: true
2935
env_file:
3036
- .env
@@ -38,3 +44,4 @@ services:
3844
- ALLOWED_URL
3945
- DEBUG=true
4046
- PRODUCTION=false
47+
- REDIS_URL=redis://redis:6379

0 commit comments

Comments
 (0)