run-uwsgi.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env sh
  2. set -e
  3. UWSGI_LISTEN="${UWSGI_LISTEN:-128}"
  4. PORT="${PORT:-8000}"
  5. MIN_WORKERS="${MIN_WORKERS:-4}"
  6. INITIAL_WORKERS="${INITIAL_WORKERS:-6}"
  7. MAX_WORKERS="${MAX_WORKERS:-8}"
  8. OVERLOAD_TIME="${OVERLOAD_TIME:-30}"
  9. UWSGI_THREADS=${UWSGI_THREADS:-1}
  10. echo "Running uwsgi with INITIAL_WORKERS: $INITIAL_WORKERS, MIN_WORKERS: $MIN_WORKERS, MAX_WORKERS: $MAX_WORKERS, OVERLOAD_TIME: $OVERLOAD_TIME, THREADS: $UWSGI_THREADS"
  11. exec uwsgi \
  12. --module=glitchtip.wsgi:application \
  13. --env DJANGO_SETTINGS_MODULE=glitchtip.settings \
  14. --master --pidfile=/tmp/project-master.pid \
  15. --log-x-forwarded-for \
  16. --log-format-strftime \
  17. --http-socket=:$PORT \
  18. --cheaper-algo=busyness \
  19. --cheaper=$MIN_WORKERS \
  20. --cheaper-initial=$INITIAL_WORKERS \
  21. --workers=$MAX_WORKERS \
  22. --cheaper-overload=$OVERLOAD_TIME \
  23. --cheaper-step=1 \
  24. --cheaper-busyness-max=50 \
  25. --cheaper-busyness-min=25 \
  26. --cheaper-busyness-multiplier=20 \
  27. --threads=$UWSGI_THREADS \
  28. --harakiri=60 \
  29. --max-requests=10000 \
  30. --die-on-term \
  31. --enable-threads \
  32. --single-interpreter \
  33. --post-buffering \
  34. --buffer-size=83146 \
  35. --ignore-sigpipe \
  36. --ignore-write-errors \
  37. --disable-write-exception \
  38. --listen=$UWSGI_LISTEN