NetBox WSGI Service issue

742 views
Skip to first unread message

decbe...@gmail.com

unread,
Dec 16, 2020, 6:12:25 AM12/16/20
to NetBox
Hi,

i have gone to my netbox deployment today and found i have issues with the Apache web service, a common one from what ive read online..

" Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Apache/2.4.29 (Ubuntu) Server at x.x.x.x Port 443"

although ive been unsuccessful fixing this, see below for some outputs


root@netbox:~# systemctl status netbox
● netbox.service - NetBox WSGI Service
   Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2020-12-16 11:06:56 GMT; 26s ago
     Docs: https://netbox.readthedocs.io/en/stable/
  Process: 19592 ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi (code=exited, status=1/FAILURE)
 Main PID: 19592 (code=exited, status=1/FAILURE)




root@netbox:~# cat /etc/systemd/system/netbox
cat: /etc/systemd/system/netbox: No such file or directory
root@netbox:~# cat /etc/systemd/system/netbox.service
[Unit]
Description=NetBox WSGI Service
Documentation=https://netbox.readthedocs.io/en/stable/
After=network-online.target
Wants=network-online.target

[Service]
Type=simple

User=netbox
Group=netbox
PIDFile=/var/tmp/netbox.pid
WorkingDirectory=/opt/netbox

ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi

Restart=on-failure
RestartSec=30
PrivateTmp=true

[Install]
WantedBy=multi-user.target
root@netbox:~#
root@netbox:~#
root@netbox:~# systemctl status netbox
● netbox.service - NetBox WSGI Service
   Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2020-12-16 11:06:56 GMT; 26s ago
     Docs: https://netbox.readthedocs.io/en/stable/
  Process: 19592 ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi (code=exited, status=1/FAILURE)
 Main PID: 19592 (code=exited, status=1/FAILURE)

Dec 16 11:06:56 netbox systemd[1]: netbox.service: Failed with result 'exit-code'.
root@netbox:~#

tried restarting the service etc but no joy, confirmed i have the gunicorn path,

root@netbox:~# ls /opt/netbox/venv/bin/
activate       chardetect           cl_napalm_validate  easy_install      gunicorn     miniterm.py   netaddr     pip3         python   rqinfo
activate.csh   cl_napalm_configure  django-admin        easy_install-3.6  jsonschema   miniterm.pyc  pasteurize  pip3.6       python3  rqworker
activate.fish  cl_napalm_test       django-admin.py     futurize          markdown_py  napalm        pip         __pycache__  rq       sqlformat
root@netbox:~#

any help would be appriciated.

Thanks,
Dec

Markku Leiniö

unread,
Dec 16, 2020, 7:07:24 AM12/16/20
to NetBox
journalctl -eu netbox

should give you logs from the starting attempts.

Markku

decbe...@gmail.com

unread,
Dec 16, 2020, 7:24:25 AM12/16/20
to NetBox
Hi Markku,

thanks for the quick response, see output below

root@netbox:/opt/netbox# journalctl -eu netbox
Dec 16 12:02:30 netbox gunicorn[27710]:     django.setup(set_prefix=False)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
Dec 16 12:02:30 netbox gunicorn[27710]:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
Dec 16 12:02:30 netbox gunicorn[27710]:     self._setup(name)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
Dec 16 12:02:30 netbox gunicorn[27710]:     self._wrapped = Settings(settings_module)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
Dec 16 12:02:30 netbox gunicorn[27710]:     mod = importlib.import_module(self.SETTINGS_MODULE)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
Dec 16 12:02:30 netbox gunicorn[27710]:     return _bootstrap._gcd_import(name[level:], package, level)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
Dec 16 12:02:30 netbox gunicorn[27710]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/netbox/netbox/settings.py", line 411, in <module>
Dec 16 12:02:30 netbox gunicorn[27710]:     "Required parameter AUTH_LDAP_SERVER_URI is missing from ldap_config.py."
Dec 16 12:02:30 netbox gunicorn[27710]: django.core.exceptions.ImproperlyConfigured: Required parameter AUTH_LDAP_SERVER_URI is missing from ldap_config.py.
Dec 16 12:02:30 netbox gunicorn[27710]: [2020-12-16 12:02:30 +0000] [27733] [INFO] Worker exiting (pid: 27733)
Dec 16 12:02:30 netbox gunicorn[27710]: Traceback (most recent call last):
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in run
Dec 16 12:02:30 netbox gunicorn[27710]:     self.sleep()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 357, in sleep
Dec 16 12:02:30 netbox gunicorn[27710]:     ready = select.select([self.PIPE[0]], [], [], 1.0)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
Dec 16 12:02:30 netbox gunicorn[27710]:     self.reap_workers()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
Dec 16 12:02:30 netbox gunicorn[27710]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
Dec 16 12:02:30 netbox gunicorn[27710]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
Dec 16 12:02:30 netbox gunicorn[27710]: During handling of the above exception, another exception occurred:
Dec 16 12:02:30 netbox gunicorn[27710]: Traceback (most recent call last):
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/bin/gunicorn", line 11, in <module>
Dec 16 12:02:30 netbox gunicorn[27710]:     sys.exit(run())
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
Dec 16 12:02:30 netbox gunicorn[27710]:     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
Dec 16 12:02:30 netbox gunicorn[27710]:     super().run()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
Dec 16 12:02:30 netbox gunicorn[27710]:     Arbiter(self).run()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 229, in run
Dec 16 12:02:30 netbox gunicorn[27710]:     self.halt(reason=inst.reason, exit_status=inst.exit_status)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 342, in halt
Dec 16 12:02:30 netbox gunicorn[27710]:     self.stop()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
Dec 16 12:02:30 netbox gunicorn[27710]:     time.sleep(0.1)
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
Dec 16 12:02:30 netbox gunicorn[27710]:     self.reap_workers()
Dec 16 12:02:30 netbox gunicorn[27710]:   File "/opt/netbox/venv/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
Dec 16 12:02:30 netbox gunicorn[27710]:     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
Dec 16 12:02:30 netbox gunicorn[27710]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
Dec 16 12:02:30 netbox systemd[1]: netbox.service: Supervising process 27740 which is not our child. We'll most likely not notice when it exits.
root@netbox:/opt/netbox#

some things stand out in this to me?

"gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>"
"Required parameter AUTH_LDAP_SERVER_URI is missing from ldap_config.py."

Thanks

Markku Leiniö

unread,
Dec 16, 2020, 7:38:43 AM12/16/20
to NetBox
Yeah, check and fix your /opt/netbox/netbox/netbox/ldap_config.py for any problems.

Markku
Reply all
Reply to author
Forward
0 new messages