Merge pull request #696 from eitchtee/feat/web-threads

feat(docker): add WEB_THREADS to run gunicorn workers with threads
This commit is contained in:
Herculino Trotta authored and GitHub committed 2026-11-20 13:01:38 -03:00
commit 61acd10441
3 files changed
+8 -2

No files matched your search

+4 -1
View File
@@ -22,7 +22,10 @@ SQL_HOST=${DB_NAME}
SQL_PORT=5432
# Gunicorn
WEB_CONCURRENCY=4
# Each worker is a full copy of the app in memory (~140 MiB); threads share their worker's memory.
# One worker with a few threads is plenty for a personal instance. Add workers only for heavy traffic.
WEB_CONCURRENCY=1
WEB_THREADS=4
# App Configs
# Enable this if you want to keep deleted transactions in the database
+2
View File
@@ -192,6 +192,8 @@ To create the first user, open the container's console using Unraid's UI, by cli
| ENABLE_SOFT_DELETE | true\|false | false | Whether to enable transactions soft delete, if enabled, deleted transactions will remain in the database. Useful for imports and avoiding duplicate entries. |
| KEEP_DELETED_TRANSACTIONS_FOR | int | 365 | Time in days to keep soft deleted transactions for. If 0, will keep all transactions indefinitely. Only works if ENABLE_SOFT_DELETE is true. |
| TASK_WORKERS | int | 1 | How many workers to have for async tasks. One should be enough for most use cases |
| WEB_CONCURRENCY | int | 1 | How many web worker processes to run. Each one is a full copy of the app in memory |
| WEB_THREADS | int | 1 | How many threads each web worker runs. Threads share their worker's memory, so `WEB_CONCURRENCY=1` with `WEB_THREADS=4` serves more requests at once with less RAM than 2 workers |
| IMPORT_TEMP_ROOT | string | /usr/src/app/temp | Where uploaded import files wait to be processed. Defaults to the `temp` folder inside the app folder. Must be writable and shared between the web and task processes. |
| CACHE_ROOT | string | /var/tmp | The writable folder the file-based caches are stored in. |
| DEMO | true\|false | false | If demo mode is enabled. |
+2 -1
View File
@@ -21,4 +21,5 @@ python manage.py setup_oauth
# Check for updates on startup instead of waiting for the next periodic run; never block boot on it
python manage.py procrastinate defer check_for_updates || true
exec gunicorn WYGIWYH.wsgi:application --bind 0.0.0.0:$INTERNAL_PORT --timeout 600
# Only pass --threads when WEB_THREADS is set, so a --threads in GUNICORN_CMD_ARGS still applies otherwise
exec gunicorn WYGIWYH.wsgi:application --bind 0.0.0.0:$INTERNAL_PORT --timeout 600 ${WEB_THREADS:+--threads "$WEB_THREADS"}