1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 11:46:49 +00:00
webvirtcloud/gunicorn.conf.py
catborise 34b9fb21c8 chore: comments say what the code does
- gunicorn.conf.py was gunicorn's sample file: pages of generic
  comments, a broken link and examples of the eventlet worker the panel
  no longer has. Only the panel's own comments stay; every setting keeps
  its value.
- docker-compose.yml: the backups hold the database, keys and
  certificates, not "both".
- accounts' system checks point to settings.py.template, which has the
  middleware they ask for (the README does not list it).
- The authorization matrix test names doc/permissions.md, where the
  roles table is; the keymap list no longer cites a dead page.
2026-11-06 13:48:04 +03:00

52 lines
1.5 KiB
Python

"""gunicorn's settings for the panel (systemd and Docker run it with -c)."""
import os
# behind nginx, on the loopback only
bind = '127.0.0.1:8000'
backlog = 2048
# Workers, each holding its own libvirt connections; capped so a big host
# does not start dozens of them against sqlite. Override with
# GUNICORN_CMD_ARGS="--workers N".
MAX_WORKERS = 8
def get_workers():
procs = os.sysconf('SC_NPROCESSORS_ONLN')
return min(procs * 2 + 1, MAX_WORKERS) if procs > 0 else 3
workers = get_workers()
# threads of a worker: a request waiting on a host that does not answer
# holds one thread, not the whole worker
worker_class = 'webvirtcloud.gunicorn_worker.Worker'
threads = 4
# a worker takes no more connections than it has threads: one whose threads
# are all busy leaves new requests to the others. nginx opens a connection
# per request, so none is kept alive.
worker_connections = threads
timeout = 600
keepalive = 0
# gunicorn 26's control socket is unused, and the service user cannot create it
control_socket_disable = True
debug = False
spew = False
daemon = False
pidfile = None
umask = 0
user = None
group = None
tmp_upload_dir = None
# to the service's output: the journal, or docker logs
logfile = '-'
loglevel = 'info'
accesslog = '-'
# the client's address from nginx (gunicorn itself sees 127.0.0.1) and the
# request's ID, as on the app log's lines
access_log_format = '%({x-real-ip}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({x-request-id}o)s'
proc_name = None