From dca7389a1a4ea5f635911d38ace5645675bca6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Mon, 4 May 2026 10:57:03 +0200 Subject: [PATCH] gunicorn --- deploy/pytorrent.service | 4 +--- systemd/pytorrent.service | 16 +++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/deploy/pytorrent.service b/deploy/pytorrent.service index 9954bb2..0374ac4 100644 --- a/deploy/pytorrent.service +++ b/deploy/pytorrent.service @@ -13,15 +13,13 @@ Group=pytorrent WorkingDirectory=/opt/pyTorrent Environment="PYTHONUNBUFFERED=1" EnvironmentFile=/opt/pyTorrent/.env -# Note: production starts through Gunicorn, so Socket.IO keeps WebSocket/thread support without unsafe Werkzeug. ExecStart=/opt/pyTorrent/venv/bin/gunicorn --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app Restart=always RestartSec=3 KillSignal=SIGINT TimeoutStopSec=20 - NoNewPrivileges=true PrivateTmp=true [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file diff --git a/systemd/pytorrent.service b/systemd/pytorrent.service index 05d8f02..4f22db5 100644 --- a/systemd/pytorrent.service +++ b/systemd/pytorrent.service @@ -1,23 +1,25 @@ [Unit] -Description=pyTorrent web UI for rTorrent +Description=pyTorrent Web UI After=network-online.target Wants=network-online.target [Service] Type=simple -WorkingDirectory=/opt/pytorrent +#User=root +#Group=root +User=pytorrent +Group=pytorrent +WorkingDirectory=/opt/pyTorrent Environment="PYTHONUNBUFFERED=1" -EnvironmentFile=/opt/pytorrent/.env +EnvironmentFile=/opt/pyTorrent/.env # Note: threaded Gunicorn preserves Flask-SocketIO background tasks without running Werkzeug in production. -ExecStart=/opt/pytorrent/venv/bin/gunicorn --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app +ExecStart=/opt/pyTorrent/venv/bin/gunicorn --worker-class gthread --workers 1 --threads 32 --bind ${PYTORRENT_HOST}:${PYTORRENT_PORT} --access-logfile - --error-logfile - wsgi:app Restart=always RestartSec=3 KillSignal=SIGINT TimeoutStopSec=20 -User=www-data -Group=www-data NoNewPrivileges=true PrivateTmp=true [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file