mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 09:06:06 +00:00
- Added a new function `_is_uwsgi_worker` to accurately identify when the application is running within a uWSGI worker. - Updated `get_process_role` to label processes as "uwsgi" based on the new function or command-line arguments, improving process role accuracy. - Expanded unit tests to cover various scenarios for uWSGI role detection, ensuring robust validation of the new logic.
91 lines
No EOL
2.7 KiB
INI
91 lines
No EOL
2.7 KiB
INI
[uwsgi]
|
|
; exec-before = python manage.py collectstatic --noinput
|
|
; exec-before = python manage.py migrate --noinput
|
|
|
|
; First run Redis availability check script once
|
|
exec-before = python /app/scripts/wait_for_redis.py
|
|
|
|
; Start Redis first
|
|
attach-daemon = redis-server
|
|
; Default prefork worker: every queue except `dvr`.
|
|
attach-daemon = nice -n $(CELERY_NICE_LEVEL) celery -A dispatcharr worker -Q celery -n default@%%h --autoscale=6,1
|
|
; DVR worker: thread pool for the long-running, I/O-bound run_recording task.
|
|
attach-daemon = nice -n $(CELERY_NICE_LEVEL) celery -A dispatcharr worker -Q dvr -n dvr@%%h --pool=threads --concurrency=20
|
|
attach-daemon = nice -n $(CELERY_NICE_LEVEL) celery -A dispatcharr beat
|
|
attach-daemon = daphne -b 0.0.0.0 -p 8001 dispatcharr.asgi:application
|
|
attach-daemon = cd /app/frontend && npm run dev
|
|
|
|
# Core settings
|
|
chdir = /app
|
|
module = scripts.debug_wrapper:application
|
|
virtualenv = /dispatcharrpy
|
|
master = true
|
|
env = DJANGO_SETTINGS_MODULE=dispatcharr.settings
|
|
socket = /app/uwsgi.sock
|
|
chmod-socket = 777
|
|
vacuum = true
|
|
die-on-term = true
|
|
static-map = /static=/app/static
|
|
|
|
# Worker configuration
|
|
workers = 1
|
|
lazy-apps = true
|
|
|
|
# HTTP server
|
|
http = 0.0.0.0:5656
|
|
http-keepalive = 1
|
|
buffer-size = 65536
|
|
http-timeout = 600
|
|
|
|
# Async mode (use gevent for high concurrency)
|
|
gevent = 100
|
|
|
|
# Patch the stdlib (socket, threading, time, ...) before any app code
|
|
# loads so blocking calls yield to the gevent hub. Without this, a single
|
|
# blocking requests / DNS call freezes every greenlet on the
|
|
# worker. psycopg3 uses Python's socket layer, so no additional patching is needed.
|
|
gevent-early-monkey-patch = true
|
|
import = dispatcharr.gevent_patch
|
|
|
|
# Performance tuning
|
|
thunder-lock = true
|
|
log-4xx = true
|
|
log-5xx = true
|
|
disable-logging = false
|
|
log-buffering = 1024 # Add buffer size limit for logging
|
|
|
|
; Longer timeouts for debugging sessions
|
|
harakiri = 3600
|
|
socket-timeout = 3600
|
|
http-timeout = 3600
|
|
|
|
|
|
# Ignore unknown options
|
|
ignore-sigpipe = true
|
|
ignore-write-errors = true
|
|
disable-write-exception = true
|
|
|
|
# Debugging settings
|
|
py-autoreload = 1
|
|
honour-stdin = true
|
|
|
|
# Environment variables
|
|
env = PYTHONPATH=/app
|
|
env = PYTHONUNBUFFERED=1
|
|
env = PYDEVD_DISABLE_FILE_VALIDATION=1
|
|
env = PYTHONUTF8=1
|
|
env = PYTHONXOPT=-Xfrozen_modules=off
|
|
env = PYDEVD_DEBUG=1
|
|
env = DEBUGPY_LOG_DIR=/app/debugpy_logs
|
|
|
|
# Debugging control variables
|
|
env = WAIT_FOR_DEBUGGER=false
|
|
env = DEBUG_TIMEOUT=30
|
|
|
|
# Enable console logging (stdout)
|
|
log-master = true
|
|
# Enable strftime formatting for timestamps
|
|
logformat-strftime = true
|
|
log-date = %%Y-%%m-%%d %%H:%%M:%%S,000
|
|
# Use the environment variable in log format - ensure consistent formatting with other files
|
|
log-format = %(ftime) $(DISPATCHARR_LOG_LEVEL) uwsgi.requests Worker ID: %(wid) %(method) %(status) %(uri) %(msecs)ms |