Skip to content

Commit cf5eb46

Browse files
committed
Fixed mysql error on docker compose
1 parent f529340 commit cf5eb46

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

backend/PyMatcha/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def expired_token_callback(expired_token):
122122

123123
logging.debug("Setting database config from environment variables")
124124
database_config = {
125-
"host": os.getenv("DB_HOST") if not os.getenv("IS_DOCKER_COMPOSE") else "mysql",
125+
"host": os.getenv("DB_HOST"),
126126
"port": int(os.getenv("DB_PORT")),
127127
"user": os.getenv("DB_USER"),
128128
"password": database_password,

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.3'
22

33
services:
44
mysql:
5-
image: mysql:8.0.18
5+
image: mysql
66
restart: always
77
environment:
88
MYSQL_ROOT_PASSWORD:
@@ -43,6 +43,8 @@ services:
4343
- PYTHONUNBUFFERED=1
4444
- CELERY_BROKER_URL=redis://redis:6379/0
4545
- CELERY_RESULT_BACKEND=redis://redis:6379/0
46+
- DB_PORT=3306
47+
- DB_HOST=mysql
4648
env_file:
4749
- .env
4850
entrypoint: celery worker --workdir . -A PyMatcha.celery -B --loglevel=info
@@ -68,6 +70,8 @@ services:
6870
environment:
6971
- PYTHONUNBUFFERED=1
7072
- FLASK_DEBUG=true
73+
- DB_PORT=3306
74+
- DB_HOST=mysql
7175
ports:
7276
- "8080:5000"
7377
volumes:

0 commit comments

Comments
 (0)