Skip to content

Commit

Permalink
Update mysql configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
psiemens committed Dec 5, 2024
1 parent 830e380 commit 79ba0f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ gcs-local.json
pyvenv.cfg

ubyssey/settings*.py

mysql-data
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
TIME_ZONE=(str, 'Canada/Pacific'),

# SQL defaults
SQL_HOST = (str, 'db'),
SQL_HOST = (str, 'mysql'),
SQL_DATABASE = (str, 'ubyssey'),
SQL_USER = (str, 'root'),
SQL_PASSWORD = (str, 'ubyssey'),
Expand Down
25 changes: 13 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
version: "3.7"
services:

db:
mysql:
platform: linux/x86_64
image: mysql:8.0
volumes:
- database:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ubyssey
MYSQL_DATABASE: ubyssey
ports:
- "3307:3306"
MYSQL_USER: ubyssey
MYSQL_PASSWORD: ${SQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${SQL_PASSWORD}
volumes:
- ./mysql-data:/var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=root --password=ubyssey --execute \"SHOW DATABASES;\""
test: "/usr/bin/mysql --user=ubyssey --password=${SQL_PASSWORD} --execute \"SHOW DATABASES;\""
interval: 2s
timeout: 20s
retries: 20
Expand All @@ -23,16 +23,20 @@ services:
bash -c "python manage.py migrate
&& gunicorn ubyssey.wsgi:application --bind 0.0.0.0:8000"
environment:
STATIC_URL: https://storage.googleapis.com/ubyssey-staging/static/
SQL_HOST: mysql
SQL_USER: root
SQL_PASSWORD: ${SQL_PASSWORD}
SQL_DATABASE: ubyssey
GS_ACCESS_KEY_ID: ${GS_ACCESS_KEY_ID}
GS_SECRET_ACCESS_KEY: ${GS_SECRET_ACCESS_KEY}
STATIC_URL: https://storage.googleapis.com/ubyssey-staging/static/
GOOGLE_APPLICATION_CREDENTIALS: /run/secrets/GOOGLE_APPLICATION_CREDENTIALS
secrets:
- GOOGLE_APPLICATION_CREDENTIALS
expose:
- 8000
depends_on:
db:
mysql:
condition: service_healthy
restart: true

Expand All @@ -57,6 +61,3 @@ services:
secrets:
GOOGLE_APPLICATION_CREDENTIALS:
file: ./service-account.json

volumes:
database:

0 comments on commit 79ba0f1

Please sign in to comment.