netdevopsbr / netbox-proxbox

Netbox Plugin for integration between Proxmox and Netbox
Apache License 2.0
377 stars 52 forks source link

Proxbox backend docker support #195

Open Uzoma8Chi opened 1 month ago

Uzoma8Chi commented 1 month ago

Hi,

so far I can not setup Proxbox backend. If anyone found some workaround please let me know. I am thinking about creating a new docker instance with Proxbox backend only. What do you think? I would need some help for this. image

docker exec -it --user root netbox-docker-netbox-1 /bin/bash
root@1c82s1na6115:/opt/netbox/netbox# 
root@1c82s1na6115:/opt/netbox/netbox# 
root@1c82s1na6115:/opt/netbox/netbox# sudo cp -v /opt/netbox/netbox/netbox-proxbox/contrib/*.service /etc/systemd/system/
bash: sudo: command not found
root@1c82s1na6115:/opt/netbox/netbox# cp -v /opt/netbox/netbox/netbox-proxbox/contrib/*.service /etc/systemd/system/
cp: cannot stat '/opt/netbox/netbox/netbox-proxbox/contrib/*.service': No such file or directory
root@1c82s1na6115:/opt/netbox/netbox# vi
bash: vi: command not found
root@1c82s1na6115:/opt/netbox/netbox# nano
bash: nano: command not found
root@1c82s1na6115:/opt/netbox/netbox# apt install nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  hunspell
The following NEW packages will be installed:
  nano
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 282 kB of archives.
After this operation, 856 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 nano amd64 7.2-2ubuntu0.1 [282 kB]
Fetched 282 kB in 0s (1187 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package nano.
(Reading database ... 9698 files and directories currently installed.)
Preparing to unpack .../nano_7.2-2ubuntu0.1_amd64.deb ...
Unpacking nano (7.2-2ubuntu0.1) ...
Setting up nano (7.2-2ubuntu0.1) ...
update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/editor.1.gz because associated file /usr/share/man/man1/nano.1.gz (of link group editor) doesn't exist
update-alternatives: using /bin/nano to provide /usr/bin/pico (pico) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/pico.1.gz because associated file /usr/share/man/man1/nano.1.gz (of link group pico) doesn't exist
root@1c82s1na6115:/opt/netbox/netbox# nano -w /etc/systemd/system/proxbox.service
root@1c82s1na6115:/opt/netbox/netbox# systemctl daemon-reload
bash: systemctl: command not found
root@1c82s1na6115:/opt/netbox/netbox# systemctl start proxbox
bash: systemctl: command not found
root@1c82s1na6115:/opt/netbox/netbox# cd ..
root@1c82s1na6115:/opt/netbox# ls venv/bin/
Activate.ps1  activate.csh   dul-receive-pack  ghp-import  markdown-it  mkdocs-get-deps  pip      pybabel        pyrsa-encrypt   pyrsa-sign    python3     qr      rqworker   strawberry
__pycache__   activate.fish  dul-upload-pack   jp.py       markdown_py  netaddr          pip3     pygmentize     pyrsa-keygen    pyrsa-verify  python3.12  rq      sqlformat  watchmedo
activate      django-admin   dulwich           jsonschema  mkdocs       normalizer       pip3.12  pyrsa-decrypt  pyrsa-priv2pub  python        pytkdocs    rqinfo  stone      wheel

176

emersonfelipesp commented 1 month ago

40

Uzoma8Chi commented 1 month ago

django.core.exceptions.ImproperlyConfigured: Requested setting FIELD_CHOICES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

(venv) root@1c82s1na6115:/opt/netbox/netbox/netbox# /opt/netbox/venv/bin/uvicorn netbox-proxbox.netbox_proxbox.main:app --host 0.0.0.0 --port 8800 --app-dir /opt/netbox/netbox --reload
INFO:     Will watch for changes in these directories: ['/opt/netbox/netbox/netbox']
INFO:     Uvicorn running on http://0.0.0.0:8800 (Press CTRL+C to quit)
INFO:     Started reloader process [993] using WatchFiles
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/configuration.bac.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Process SpawnProcess-1:
Traceback (most recent call last):
  File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/_subprocess.py", line 80, in subprocess_started
    target(sockets=sockets)
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/server.py", line 69, in serve
    await self._serve(sockets)
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/server.py", line 76, in _serve
    config.load()
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/config.py", line 434, in load
    self.loaded_app = import_from_string(self.app)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/uvicorn-0.32.0-py3.12.egg/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/main.py", line 7, in <module>
    from netbox_proxbox.backend.exception import ProxboxException
  File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_proxbox/backend/__init__.py", line 1, in <module>
    from netbox_proxbox.backend.routes.netbox.virtualization.cluster_type import ClusterType
  File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_proxbox/backend/routes/netbox/__init__.py", line 6, in <module>
    from netbox_proxbox.backend.session.netbox import NetboxSessionDep
  File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_proxbox/backend/session/netbox.py", line 14, in <module>
    from netbox.settings import BASE_PATH
  File "/opt/netbox/netbox/netbox/settings.py", line 799, in <module>
    plugin = importlib.import_module(plugin_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_dns/__init__.py", line 5, in <module>
    from ipam.choices import IPAddressStatusChoices
  File "/opt/netbox/netbox/ipam/choices.py", line 21, in <module>
    class PrefixStatusChoices(ChoiceSet):
  File "/opt/netbox/netbox/utilities/choices.py", line 24, in __new__
    if replace_key and replace_key in settings.FIELD_CHOICES:
                                      ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
    self._setup(name)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/conf/__init__.py", line 69, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting FIELD_CHOICES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
^CINFO:     Stopping reloader process [993]