start prod docker migration
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Lightweight wait-for-postgres using nc (expects DATABASE_HOST and DATABASE_PORT env vars)
|
||||
if [ -n "${DATABASE_HOST}" ]; then
|
||||
host="$DATABASE_HOST"
|
||||
port="${DATABASE_PORT:-5432}"
|
||||
echo "Waiting for database at ${host}:${port}..."
|
||||
while ! nc -z "$host" "$port"; do
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Applying database migrations..."
|
||||
python manage.py migrate --noinput
|
||||
|
||||
echo "Collecting static files..."
|
||||
python manage.py collectstatic --noinput
|
||||
|
||||
echo "Starting gunicorn..."
|
||||
exec gunicorn rad.wsgi:application \
|
||||
--name rad_gunicorn \
|
||||
--bind 0.0.0.0:8000 \
|
||||
--workers ${GUNICORN_WORKERS:-3} \
|
||||
--log-level ${GUNICORN_LOGLEVEL:-info}
|
||||
Reference in New Issue
Block a user