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

Fixes: #2902 - Implements systemd (#3017)

* Closes #2902 - Migrate to systemd from supervisord
* Closes #2902 - Migrate to systemd from supervisord

* Update systemd unit and environment file
* Add gunicorn.conf
* Update documentation and CHANGELOG.  Moved parameters around on service file
* Update Gitignore
This commit is contained in:
Daniel Sheppard
2019-09-06 11:46:35 -05:00
committed by GitHub
parent 480db83f39
commit 9e258dd31e
11 changed files with 311 additions and 29 deletions

22
contrib/gunicorn.conf Normal file
View File

@ -0,0 +1,22 @@
# Bind is the ip and port that the Netbox WSGI should bind to
#
bind='127.0.0.1:8001'
# Workers is the number of workers that GUnicorn should spawn.
# Workers should be: cores * 2 + 1. So if you have 8 cores, it would be 17.
#
workers=3
# Threads
# The number of threads for handling requests
#
threads=3
# Timeout is the timeout between gunicorn receiving a request and returning a response (or failing with a 500 error)
#
timeout=120
# ErrorLog
# ErrorLog is the logfile for the ErrorLog
#
errorlog='/opt/netbox/netbox.log'

24
contrib/netbox-rq.service Normal file
View File

@ -0,0 +1,24 @@
[Unit]
Description=Netbox RQ Worker
Documentation=https://netbox.readthedocs.io/en/stable/
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/netbox.env
User=www-data
Group=www-data
WorkingDirectory=${WorkingDirectory}
ExecStart=/usr/bin/python3 ${WorkingDirectory}/netbox/manage.py rqworker
Restart=on-failure
RestartSec=30
PrivateTmp=true
[Install]
WantedBy=multi-user.target

15
contrib/netbox.env Normal file
View File

@ -0,0 +1,15 @@
# Name is the Process Name
#
Name = 'Netbox'
# ConfigPath is the path to the gunicorn config file.
#
ConfigPath=/opt/netbox/gunicorn.conf
# WorkingDirectory is the Working Directory for Netbox.
#
WorkingDirectory=/opt/netbox/
# PidPath is the path to the pid for the netbox WSGI
#
PidPath=/opt/netbox/netbox.pid

24
contrib/netbox.service Normal file
View File

@ -0,0 +1,24 @@
[Unit]
Description=Netbox WSGI
Documentation=https://netbox.readthedocs.io/en/stable/
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/netbox.env
User=www-data
Group=www-data
PIDFile=${PidPath}
WorkingDirectory=${WorkingDirectory}
ExecStart=/usr/local/bin/gunicorn --pid ${PidPath} --pythonpath ${WorkingDirectory}/netbox --config ${ConfigPath} netbox.wsgi
Restart=on-failure
RestartSec=30
PrivateTmp=true
[Install]
WantedBy=multi-user.target

24
contrib/netbox@.service Normal file
View File

@ -0,0 +1,24 @@
[Unit]
Description=Netbox WSGI
Documentation=https://netbox.readthedocs.io/en/stable/
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/sysconfig/netbox.%i.env
User=www-data
Group=www-data
PIDFile=${PidPath}
WorkingDirectory=${WorkingDirectory}
ExecStart=/usr/local/bin/gunicorn --pid ${PidPath} --pythonpath ${WorkingDirectory}/netbox --config ${ConfigPath} netbox.wsgi
Restart=on-failure
RestartSec=30
PrivateTmp=true
[Install]
WantedBy=multi-user.target