1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

15154 Add uWSGI as option to gunicorn (#15550)

* 15154 uwsgi docs

* 15154 uwsgi contrib files

* 15154 review comments - merge nginx conf

* Restructure gunicorn/uWSGI installation docs

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
Arthur Hanson
2024-03-28 12:24:08 -07:00
committed by GitHub
parent 744be59a4d
commit 99508150d3
7 changed files with 146 additions and 3 deletions

View File

@ -12,8 +12,12 @@ Group=netbox
PIDFile=/var/tmp/netbox.pid
WorkingDirectory=/opt/netbox
# Remove the following line if using uWSGI instead of Gunicorn
ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi
# Uncomment the following line if using uWSGI instead of Gunicorn
#ExecStart=/opt/netbox/venv/bin/uwsgi --ini /opt/netbox/uwsgi.ini
Restart=on-failure
RestartSec=30
PrivateTmp=true

View File

@ -14,10 +14,20 @@ server {
}
location / {
# Remove these lines if using uWSGI instead of Gunicorn
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# Uncomment these lines if using uWSGI instead of Gunicorn
# include uwsgi_params;
# uwsgi_pass 127.0.0.1:8001;
# uwsgi_param Host $host;
# uwsgi_param X-Real-IP $remote_addr;
# uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
# uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
}
}

18
contrib/uwsgi.ini Normal file
View File

@ -0,0 +1,18 @@
[uwsgi]
; bind to the specified UNIX/TCP socket and port (usually localhost)
socket = 127.0.0.1:8001
; fail to start if any parameter in the configuration file isnt explicitly understood by uWSGI.
strict = true
; re-spawn and pre-fork workers
master = true
; clear environment on exit
vacuum = true
; exit if no app can be loaded
need-app = true
; do not use multiple interpreters
single-interpreter = true