Project_Manager/gunicorn.conf.py
2026-06-26 18:21:22 +02:00

31 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Gunicorn-Konfiguration für den Projekt-Hub.
Aufruf (im aktivierten venv, WorkingDirectory = Projektordner):
gunicorn -c gunicorn.conf.py wsgi:app
Wird vom systemd-Service (deploy/projekt-hub.service) genutzt. Werte sind über
Umgebungsvariablen überschreibbar, sinnvolle Defaults für einen kleinen VPS.
"""
import multiprocessing
import os
# Bind-Adresse: standardmäßig ein Unix-Socket relativ zum WorkingDirectory.
# nginx spricht denselben Socket per absoluter Pfadangabe an
# (z.B. /home/projekthub/projekt-hub/projekt-hub.sock).
bind = os.environ.get("GUNICORN_BIND", "unix:projekt-hub.sock")
# Worker-Anzahl: Faustregel (2 × CPU-Kerne) + 1, per env begrenzbar.
workers = int(os.environ.get("GUNICORN_WORKERS", str(multiprocessing.cpu_count() * 2 + 1)))
worker_class = os.environ.get("GUNICORN_WORKER_CLASS", "sync")
timeout = int(os.environ.get("GUNICORN_TIMEOUT", "30"))
# Socket-Dateirechte, damit nginx (Gruppe www-data) zugreifen kann.
umask = 0o007
# Logs auf stdout/stderr → landen via systemd im journal (journalctl -u projekt-hub).
accesslog = "-"
errorlog = "-"
loglevel = os.environ.get("GUNICORN_LOGLEVEL", "info")
proc_name = "projekt-hub"