ixg_platform/scripts/entrypoint.sh
ixgadmin 8f1649aaa1 Deployment hardening: HTTPS/CSRF settings, loopback-only app port, entrypoint passthrough
- settings: trust nginx X-Forwarded-Proto, mark session and CSRF cookies secure,
  and set the CSRF trusted origins for the ixgltd.com hosts
- docker-compose: bind the app port to 127.0.0.1 only; nginx fronts it, so there
  is no reason for 0.0.0.0
- entrypoint: when the container is given a command, run that instead of always
  starting gunicorn (needed for manage.py shell and the test suite)
- gitignore: keep Celery runtime state and stray local backups out of the tree

No functional change to the application itself.
2026-09-16 16:39:07 +00:00

26 lines
536 B
Bash
Executable file

#!/bin/bash
set -e
echo "Waiting for PostgreSQL..."
while ! nc -z "$DB_HOST" "$DB_PORT" 2>/dev/null; do
sleep 1
done
echo "PostgreSQL is ready."
echo "Running migrations..."
python manage.py migrate --noinput || true
echo "Collecting static files..."
python manage.py collectstatic --noinput
if [ "$#" -gt 0 ]; then
echo "Executing command: $*"
exec "$@"
fi
echo "Starting Gunicorn..."
exec gunicorn --bind 0.0.0.0:8000 \
--workers 2 \
--timeout 300 \
--access-logfile - \
dsp_platform.wsgi:application