Page MenuHomeDevCentral

Deploy NetBox service
DraftPublic

Authored by dereckson on Mon, Jul 8, 23:10.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 13, 06:52
Unknown Object (File)
Fri, Jul 12, 10:34
Unknown Object (File)
Wed, Jul 10, 11:13
Unknown Object (File)
Wed, Jul 10, 10:29
Unknown Object (File)
Wed, Jul 10, 10:12
Unknown Object (File)
Wed, Jul 10, 09:30
Subscribers
None
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
DorianWinty
Maniphest Tasks
T1762: Deploy NetBox
Summary

As demonstrated on P339, a custom service to run NetBox was written
in June 2023, which calls service.sh wrapper to run gunicorn.

This has been stabilized with several NetBox updates, so it's ready
to be added to this repository.

This change does NOT currently install NetBox itself.

Ref T1762

Test Plan

Deploy on WindRiver

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
SeverityLocationCodeMessage
Adviceroles/netbox/server/files/service.sh:41SC1091SHELLCHECK
Unit
No Test Coverage
Branch
netbox-service
Build Status
Buildable 5339
Build 5620: arc lint + arc unit

Event Timeline

dereckson held this revision as a draft.

Some changes planned:

  • debug why service.sh doesn't work as sh script but works when called by bash (it was a bash script where I've s/source/.)
  • fix pid grok so we can determine status correctly
  • pillar to document Python version in venv
roles/netbox/server/files/rc/netbox
44

The check on pid to determine if the service is running
uses procname to ensure it's the RIGHT process at that pid.

So currently, we've:

WindRiver
$ /usr/local/etc/rc.d/netbox status
netbox is not running.

$ cat /var/run/netbox/netbox.pid
79164

$ ps auxw | grep 79164
netbox              79164   0.0  0.0  42124  28384  -  S    23:04       0:00.12 /srv/netbox/venv/bin/python3.11 /srv/netbox/venv/bin/gunicorn --pid /var/run/netbox/netbox.pid --pythonpath /

In that context, $procname needs to be be "/srv/netbox/venv/bin/python3.11"

46
roles/netbox/server/service.sls
30
  • template: jinja
  • context: netbox_python_interpreter: /srv/netbox/venv/bin/python3.11

Python 3.11 version should be taken from a pillar, as we aren't dependant of the current OS default Python version.