diff options
Diffstat (limited to 'netbox/etc')
-rwxr-xr-x | netbox/etc/service/netbox-rq/log/run | 3 | ||||
-rwxr-xr-x | netbox/etc/service/netbox-rq/run | 23 | ||||
-rwxr-xr-x | netbox/etc/service/uwsgi/log/run | 3 | ||||
-rwxr-xr-x | netbox/etc/service/uwsgi/run | 23 | ||||
-rw-r--r-- | netbox/etc/uwsgi/netbox.ini | 15 |
5 files changed, 67 insertions, 0 deletions
diff --git a/netbox/etc/service/netbox-rq/log/run b/netbox/etc/service/netbox-rq/log/run new file mode 100755 index 0000000..6193824 --- /dev/null +++ b/netbox/etc/service/netbox-rq/log/run | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cat - | ||
diff --git a/netbox/etc/service/netbox-rq/run b/netbox/etc/service/netbox-rq/run new file mode 100755 index 0000000..aa4b675 --- /dev/null +++ b/netbox/etc/service/netbox-rq/run | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # runsv sends us a TERM but uwsgi will only shutdown cleanly | ||
4 | # if it receives an INT so we need to translate the signal | ||
5 | # properly for uwsgi | ||
6 | trap 'kill -INT $PID' TERM | ||
7 | |||
8 | /sbin/su-exec netbox /usr/bin/python3 /opt/netbox/netbox/manage.py rqworker & | ||
9 | |||
10 | PID=$! | ||
11 | |||
12 | # wait for uwsgi, will get cancelled when runsv TERMs us and | ||
13 | # the trap will get executed next, unless something goes wrong | ||
14 | # and uwsgi fails then this wait will run | ||
15 | wait $PID | ||
16 | |||
17 | # if something went wrong then unregister the trap because it | ||
18 | # won't have a target | ||
19 | trap - TERM | ||
20 | |||
21 | # waiting on a dead process will return the return code of the | ||
22 | # processes original exit | ||
23 | wait $PID | ||
diff --git a/netbox/etc/service/uwsgi/log/run b/netbox/etc/service/uwsgi/log/run new file mode 100755 index 0000000..6193824 --- /dev/null +++ b/netbox/etc/service/uwsgi/log/run | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cat - | ||
diff --git a/netbox/etc/service/uwsgi/run b/netbox/etc/service/uwsgi/run new file mode 100755 index 0000000..e24ede7 --- /dev/null +++ b/netbox/etc/service/uwsgi/run | |||
@@ -0,0 +1,23 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # runsv sends us a TERM but uwsgi will only shutdown cleanly | ||
4 | # if it receives an INT so we need to translate the signal | ||
5 | # properly for uwsgi | ||
6 | trap 'kill -INT $PID' TERM | ||
7 | |||
8 | /usr/sbin/uwsgi --ini /etc/uwsgi/netbox.ini & | ||
9 | |||
10 | PID=$! | ||
11 | |||
12 | # wait for uwsgi, will get cancelled when runsv TERMs us and | ||
13 | # the trap will get executed next, unless something goes wrong | ||
14 | # and uwsgi fails then this wait will run | ||
15 | wait $PID | ||
16 | |||
17 | # if something went wrong then unregister the trap because it | ||
18 | # won't have a target | ||
19 | trap - TERM | ||
20 | |||
21 | # waiting on a dead process will return the return code of the | ||
22 | # processes original exit | ||
23 | wait $PID | ||
diff --git a/netbox/etc/uwsgi/netbox.ini b/netbox/etc/uwsgi/netbox.ini new file mode 100644 index 0000000..8431c6f --- /dev/null +++ b/netbox/etc/uwsgi/netbox.ini | |||
@@ -0,0 +1,15 @@ | |||
1 | [uwsgi] | ||
2 | plugin = python | ||
3 | master = true | ||
4 | no-orphans = true | ||
5 | socket = [::]:9000 | ||
6 | uid = netbox | ||
7 | gid = netbox | ||
8 | mime-file = /etc/mime.types | ||
9 | chdir = /opt/netbox/netbox | ||
10 | pythonpath = /opt/netbox/netbox | ||
11 | workers = 2 | ||
12 | wsgi-file = netbox/wsgi.py | ||
13 | harakiri = 300 | ||
14 | offload-threads = 4 | ||
15 | static-map = /static=/opt/netbox/netbox/static | ||