| 228 | |
| 229 | === Gunicorn === |
| 230 | Like most Django applications, NetBox runs as a WSGI application behind an HTTP server. This documentation shows how to install and configure gunicorn (which is automatically installed with NetBox) for this role, however other WSGI servers are available and should work similarly well. uWSGI is a popular alternative. |
| 231 | |
| 232 | ''' Configuration ''' |
| 233 | |
| 234 | NetBox ships with a default configuration file for gunicorn. To use it, copy ''' /opt/netbox/contrib/gunicorn.py to /opt/netbox/gunicorn.py. '''(We make a copy of this file rather than pointing to it directly to ensure that any local changes to it do not get overwritten by a future upgrade.) |
| 235 | |
| 236 | {{{ |
| 237 | # sudo cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py |
| 238 | }}} |
| 239 | |
| 240 | ''' systemd Setup ''' |
| 241 | We'll use systemd to control both gunicorn and NetBox's background worker process. First, copy ''' contrib/netbox.service ''' and ''' contrib/netbox-rq.service ''' to the ''' /etc/systemd/system/ '''directory and reload the ''' systemd ''' daemon: |
| 242 | {{{ |
| 243 | # sudo cp -v /opt/netbox/contrib/*.service /etc/systemd/system/ |
| 244 | # sudo systemctl daemon-reload |
| 245 | }}} |
| 246 | Then, start the ''' netbox ''' and ''' netbox-rq ''' services and enable them to initiate at boot time: |
| 247 | {{{ |
| 248 | # sudo systemctl start netbox netbox-rq |
| 249 | # sudo systemctl enable netbox netbox-rq |
| 250 | }}} |
| 251 | You can use the command ''' systemctl ''' status netbox to verify that the WSGI service is running: |
| 252 | {{{ |
| 253 | systemctl status netbox.service |
| 254 | }}} |