Page MenuHomeDevCentral

Deploy NetBox service
DraftPublic

Authored by dereckson on Jul 8 2024, 23:10.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 20, 14:27
Unknown Object (File)
Sun, Oct 13, 09:18
Unknown Object (File)
Sun, Oct 13, 08:56
Unknown Object (File)
Sun, Oct 13, 08:12
Unknown Object (File)
Fri, Oct 11, 13:16
Unknown Object (File)
Sun, Oct 6, 21:22
Unknown Object (File)
Oct 3 2024, 18:02
Unknown Object (File)
Sep 28 2024, 13:46
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.