Page MenuHomeDevCentral

Deploy NetBox service
DraftPublic

Authored by dereckson on Jul 8 2024, 23:10.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 03:40
Unknown Object (File)
Mon, Dec 9, 03:23
Unknown Object (File)
Fri, Dec 6, 23:59
Unknown Object (File)
Mon, Nov 25, 17:09
Unknown Object (File)
Fri, Nov 22, 05:46
Unknown Object (File)
Tue, Nov 19, 06:57
Unknown Object (File)
Nov 13 2024, 01:25
Unknown Object (File)
Nov 8 2024, 16:44
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.