Skip to content

Commit

Permalink
docker env update
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 6, 2024
1 parent 5d96575 commit 9c0a66f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
9 changes: 3 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ services:
#- .:/usr/src/app/
- static_volume:/home/app/web/staticfiles
- media_volume:/home/app/web/mediafiles
#ports:
# - 8000:8000
expose:
- 8000
ports:
- 8000:8000
env_file:
- ./.env
network_mode: host
depends_on:
- db

Expand All @@ -25,7 +22,7 @@ services:
MYSQL_USER: ${DATABASE_USER-mysqluser}
MYSQL_PASSWORD: ${DATABASE_PASSWORD-unsecure}
MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD-unsecure}
expose:
ports:
- ${DATABASE_PORT-3306}
volumes:
- mariadb_data:/var/lib/mysql
Expand Down
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Wait for MariaDB to be ready
DB_HOST=${DATABASE_HOST:-0.0.0.0}
DB_HOST=${DATABASE_HOST:-db}
DB_PORT=${DATABASE_PORT:-3306}
until nc -z -v -w30 $DB_HOST $DB_PORT; do
echo "Waiting for MariaDB..."
Expand All @@ -13,6 +13,7 @@ python manage.py migrate --no-input
python manage.py collectstatic --no-input

if [ "${DEBUG}" = "False" ]; then
echo Starting fishauctions in productions mode
cron -f & # run cron in the foreground, but & allows the script to continue
exec gunicorn fishauctions.asgi:application -k uvicorn.workers.UvicornWorker -w 8 -b 0.0.0.0:8000
else
Expand Down
4 changes: 2 additions & 2 deletions fishauctions/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
else:
DEBUG = True

ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0', os.environ.get('ALLOWED_HOST_1', ''), os.environ.get('ALLOWED_HOST_2', ''), os.environ.get('ALLOWED_HOST_3', '')]
ALLOWED_HOSTS = ['localhost', 'web', '127.0.0.1', '0.0.0.0', os.environ.get('ALLOWED_HOST_1', ''), os.environ.get('ALLOWED_HOST_2', ''), os.environ.get('ALLOWED_HOST_3', '')]
CSRF_TRUSTED_ORIGINS = ['http://localhost', 'http://127.0.0.1', 'https://' + os.environ.get('ALLOWED_HOST_1', ''), 'https://' + os.environ.get('ALLOWED_HOST_2', ''), 'https://' + os.environ.get('ALLOWED_HOST_3', '')]

# Channels
Expand Down Expand Up @@ -191,7 +191,7 @@
'NAME': os.environ.get('DATABASE_NAME', 'auctions'),
'USER': os.environ.get('DATABASE_USER', 'mysqluser'),
'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'unsecure'),
'HOST': os.environ.get('DATABASE_HOST', '0.0.0.0'),
'HOST': os.environ.get('DATABASE_HOST', 'db'),
'PORT': os.environ.get('DATABASE_PORT', '3306'),
'OPTIONS': {'charset': 'utf8mb4'},
}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ defusedxml==0.7.1
# via
# -r requirements.in
# python3-openid
django==5.0.6
django>=5.0.6
# via
# -r requirements.in
# channels
Expand Down

0 comments on commit 9c0a66f

Please sign in to comment.