You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/installation/migrating-to-systemd.md
+28-71Lines changed: 28 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -12,89 +12,46 @@ Migration is not required, as supervisord will still continue to function.
12
12
13
13
### systemd configuration:
14
14
15
-
Copy or link contrib/netbox.service and contrib/netbox-rq.service to /etc/systemd/system/netbox.service and /etc/systemd/system/netbox-rq.service
15
+
We'll use systemd to control the daemonization of NetBox services. First, copy `contrib/netbox.service` and `contrib/netbox-rq.service` to the `/etc/systemd/system/` directory:
Edit /etc/systemd/system/netbox.service and /etc/systemd/system/netbox-rq.service. Be sure to verify the location of the gunicorn executable on your server (e.g. `which gunicorn`). If using CentOS/RHEL. Change the username from `www-data` to `nginx` or `apache`:
21
+
!!! note
22
+
These service files assume that gunicorn is installed at `/usr/local/bin/gunicorn`. If the output of `which gunicorn` indicates a different path, you'll need to correct the `ExecStart` path in both files.
Copy contrib/netbox.env to /etc/sysconfig/netbox.env
34
-
35
-
```no-highlight
36
-
# cp contrib/netbox.env /etc/sysconfig/netbox.env
37
-
```
38
-
39
-
Edit /etc/sysconfig/netbox.env and change the settings as required. Update the `WorkingDirectory` variable if needed.
40
-
41
-
```no-highlight
42
-
# Name is the Process Name
43
-
#
44
-
Name = 'Netbox'
45
-
46
-
# ConfigPath is the path to the gunicorn config file.
47
-
#
48
-
ConfigPath=/opt/netbox/gunicorn.conf
49
-
50
-
# WorkingDirectory is the Working Directory for Netbox.
51
-
#
52
-
WorkingDirectory=/opt/netbox/
53
-
54
-
# PidPath is the path to the pid for the netbox WSGI
55
-
#
56
-
PidPath=/var/run/netbox.pid
57
-
```
24
+
!!! note
25
+
You may need to modify the user that the systemd service runs as. Please verify the user for httpd on your specific release and edit both files to match your httpd service under user and group. The username could be "nobody", "nginx", "apache", "www-data" or any number of other usernames.
58
26
59
-
Copy contrib/gunicorn.conf to gunicorn.conf
27
+
Then, start the `netbox` and `netbox-rq` services and enable them to initiate at boot time:
60
28
61
29
```no-highlight
62
-
# cp contrib/gunicorn.conf to gunicorn.conf
30
+
# systemctl daemon-reload
31
+
# systemctl start netbox.service
32
+
# systemctl start netbox-rq.service
33
+
# systemctl enable netbox.service
34
+
# systemctl enable netbox-rq.service
63
35
```
64
36
65
-
Edit gunicorn.conf and change the settings as required.
37
+
You can use the command `systemctl status netbox` to verify that the WSGI service is running:
66
38
67
39
```
68
-
# Bind is the ip and port that the Netbox WSGI should bind to
69
-
#
70
-
bind='127.0.0.1:8001'
71
-
72
-
# Workers is the number of workers that GUnicorn should spawn.
73
-
# Workers should be: cores * 2 + 1. So if you have 8 cores, it would be 17.
74
-
#
75
-
workers=3
76
-
77
-
# Threads
78
-
# The number of threads for handling requests
79
-
#
80
-
threads=3
81
-
82
-
# Timeout is the timeout between gunicorn receiving a request and returning a response (or failing with a 500 error)
Finally, start the `netbox` and `netbox-rq` services and enable them to initiate at boot time:
54
+
At this point, you should be able to connect to the HTTP service at the server name or IP address you provided. If you are unable to connect, check that the nginx service is running and properly configured. If you receive a 502 (bad gateway) error, this indicates that gunicorn is misconfigured or not running.
93
55
94
-
```no-highlight
95
-
# systemctl daemon-reload
96
-
# systemctl start netbox.service
97
-
# systemctl start netbox-rq.service
98
-
# systemctl enable netbox.service
99
-
# systemctl enable netbox-rq.service
100
-
```
56
+
!!! info
57
+
Please keep in mind that the configurations provided here are bare minimums required to get NetBox up and running. You may want to make adjustments to better suit your production environment.
0 commit comments