26 lines
732 B
Bash
26 lines
732 B
Bash
#!/usr/bin/env bash
|
|
# 生产环境启动脚本:PostgreSQL + Granian (多 worker)
|
|
# WORKDIR in Dockerfile = /app
|
|
set -e
|
|
cd /app
|
|
|
|
export DJANGO_SETTINGS_MODULE=config.settings.prod
|
|
|
|
echo "[dealerhub-prod] Running migrations..."
|
|
python manage.py migrate --noinput
|
|
|
|
echo "[dealerhub-prod] Collecting static files..."
|
|
python manage.py collectstatic --noinput
|
|
|
|
WORKERS="${GRANIAN_WORKERS:-4}"
|
|
RUNTIME_THREADS="${GRANIAN_RUNTIME_THREADS:-1}"
|
|
|
|
echo "[dealerhub-prod] Starting Granian ASGI (workers=$WORKERS, runtime-threads=$RUNTIME_THREADS)..."
|
|
exec granian config.asgi:application \
|
|
--interface asgi \
|
|
--host 0.0.0.0 \
|
|
--port 8000 \
|
|
--workers "$WORKERS" \
|
|
--runtime-threads "$RUNTIME_THREADS" \
|
|
--log-level info
|