Compare commits

...

2 Commits

Author SHA1 Message Date
MickLesk
099a9b712a fix(dispatcharr): migrate existing installs from gunicorn to uwsgi on update 2026-05-07 20:59:40 +02:00
MickLesk
c812bb6eb1 fix(dispatcharr): switch from gunicorn to uwsgi 2026-05-07 20:58:47 +02:00
2 changed files with 50 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ function update_script() {
cp /opt/dispatcharr/.env /tmp/dispatcharr.env.backup
fi
if [[ -f /opt/dispatcharr/start-gunicorn.sh ]]; then
cp /opt/dispatcharr/start-gunicorn.sh /tmp/start-gunicorn.sh.backup
rm -f /opt/dispatcharr/start-gunicorn.sh
fi
if [[ -f /opt/dispatcharr/start-celery.sh ]]; then
cp /opt/dispatcharr/start-celery.sh /tmp/start-celery.sh.backup
@@ -83,9 +83,6 @@ function update_script() {
if [[ -f /tmp/dispatcharr.env.backup ]]; then
mv /tmp/dispatcharr.env.backup /opt/dispatcharr/.env
fi
if [[ -f /tmp/start-gunicorn.sh.backup ]]; then
mv /tmp/start-gunicorn.sh.backup /opt/dispatcharr/start-gunicorn.sh
fi
if [[ -f /tmp/start-celery.sh.backup ]]; then
mv /tmp/start-celery.sh.backup /opt/dispatcharr/start-celery.sh
fi
@@ -105,7 +102,35 @@ function update_script() {
rm -rf .venv
$STD uv venv --clear
$STD uv sync
$STD uv pip install gunicorn gevent celery redis daphne
$STD uv pip install uwsgi gevent celery redis daphne
cat <<'UWSGI_EOF' >/opt/dispatcharr/start-uwsgi.sh
#!/usr/bin/env bash
cd /opt/dispatcharr
set -a
source .env
set +a
exec .venv/bin/uwsgi \
--chdir=/opt/dispatcharr \
--module=dispatcharr.wsgi:application \
--master \
--workers=4 \
--gevent=400 \
--http=0.0.0.0:5656 \
--http-keepalive=1 \
--http-timeout=600 \
--socket-timeout=600 \
--buffer-size=65536 \
--post-buffering=4096 \
--lazy-apps \
--thunder-lock \
--die-on-term \
--vacuum
UWSGI_EOF
chmod +x /opt/dispatcharr/start-uwsgi.sh
if grep -q 'start-gunicorn.sh' /etc/systemd/system/dispatcharr.service; then
sed -i 's|start-gunicorn.sh|start-uwsgi.sh|g' /etc/systemd/system/dispatcharr.service
systemctl daemon-reload
fi
msg_ok "Updated Dispatcharr Backend"
msg_info "Building Frontend"

View File

@@ -38,7 +38,7 @@ msg_info "Installing Python Dependencies with uv"
cd /opt/dispatcharr
$STD uv venv --clear
$STD uv sync
$STD uv pip install gunicorn gevent celery redis daphne
$STD uv pip install uwsgi gevent celery redis daphne
msg_ok "Installed Python Dependencies"
msg_info "Configuring Dispatcharr"
@@ -118,7 +118,7 @@ server {
proxy_set_header X-Forwarded-Proto \$scheme;
}
# All other requests proxy to Gunicorn
# All other requests proxy to uWSGI
location / {
include proxy_params;
proxy_pass http://127.0.0.1:5656;
@@ -131,20 +131,30 @@ systemctl restart nginx
msg_ok "Configured Nginx"
msg_info "Creating Services"
cat <<EOF >/opt/dispatcharr/start-gunicorn.sh
cat <<EOF >/opt/dispatcharr/start-uwsgi.sh
#!/usr/bin/env bash
cd /opt/dispatcharr
set -a
source .env
set +a
exec uv run gunicorn \\
exec .venv/bin/uwsgi \\
--chdir=/opt/dispatcharr \\
--module=dispatcharr.wsgi:application \\
--master \\
--workers=4 \\
--worker-class=gevent \\
--timeout=300 \\
--bind 0.0.0.0:5656 \\
dispatcharr.wsgi:application
--gevent=400 \\
--http=0.0.0.0:5656 \\
--http-keepalive=1 \\
--http-timeout=600 \\
--socket-timeout=600 \\
--buffer-size=65536 \\
--post-buffering=4096 \\
--lazy-apps \\
--thunder-lock \\
--die-on-term \\
--vacuum
EOF
chmod +x /opt/dispatcharr/start-gunicorn.sh
chmod +x /opt/dispatcharr/start-uwsgi.sh
cat <<EOF >/opt/dispatcharr/start-celery.sh
#!/usr/bin/env bash
@@ -184,7 +194,7 @@ After=network.target postgresql.service redis-server.service
[Service]
Type=simple
WorkingDirectory=/opt/dispatcharr
ExecStart=/opt/dispatcharr/start-gunicorn.sh
ExecStart=/opt/dispatcharr/start-uwsgi.sh
Restart=on-failure
RestartSec=10
User=root