Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Install Slurpit Plugin for netbox) #944

Merged
merged 11 commits into from
Aug 27, 2024

Conversation

jared-bloomer
Copy link

Install the Slurpit Plugin for netbox

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

This will allow for the slurpit_netbox python Package to be installed. Once running this a user can update the Plugins section of their configuration.py to include this Plugin.

PLUGINS = ['slurpit_netbox']

Benefits of this PR and context:

Currently their are no Docker Mods available for netbox and this is a starting point for others to add plugin installation support for netbox.

How Has This Been Tested?

Unsure how to test this without restarting the container and losing the installation of the package.

Source / References:

Official Slurpit Repository
Netbox supported plugins

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

README.md Show resolved Hide resolved
@aptalca aptalca self-assigned this Aug 26, 2024
@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

Copy link
Member

@aptalca aptalca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the mod's init has to be a dependency for init-mod-package-install instead of init-mods-end so that it runs before the package install script and not after or concurrently

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@aptalca
Copy link
Member

aptalca commented Aug 26, 2024

Looks good, thanks.

Please test the mod ghcr.io/linuxserver/mods:pull_request_944 to confirm it works and we'll merge

@LinuxServer-CI
Copy link

PR build pushed to ghcr.io/linuxserver/mods:pull_request_944

@jared-bloomer
Copy link
Author

Looks good, thanks.

Please test the mod ghcr.io/linuxserver/mods:pull_request_944 to confirm it works and we'll merge

Unfortunately, I am not having any luck. It is as if the mod is not being executed at all.

compose.yml

services:
  netbox:
    image: lscr.io/linuxserver/netbox:4.0.9
    container_name: netbox
    env_file: env/netbox.env
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - SUPERUSER_EMAIL=<sanitized>
      - ALLOWED_HOST="*"
      - DB_NAME=netbox
      - DOCKER_MODS=ghcr.io/linuxserver/mods:pull_request_944
    volumes:
      - ./config:/config
    ports:
      - 8000:8000
    restart: unless-stopped
    depends_on:
      - postgres
      - redis
      - redis-cache
    links:
      - postgres:postgres
      - redis:redis
      - redis-cache:redis-cache
  postgres:
    image: docker.io/postgres:16-alpine
    env_file: env/postgres.env
    volumes:
      - ./postgresql:/var/lib/postgresql/data
  redis:
    image: docker.io/redis:7-alpine
    command:
      - sh
      - -c # this is to evaluate the $REDIS_PASSWORD from the env
      - redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis.env
    volumes:
      - ./redis-data:/data
  redis-cache:
    image: docker.io/redis:7-alpine
    command:
      - sh
      - -c # this is to evaluate the $REDIS_PASSWORD from the env
      - redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis-cache.env
    volumes:
      - ./redis-cache-data:/data

output

root@docker04:/config/netbox# docker compose up -d && docker logs -f netbox
[+] Running 5/5
 ✔ Network netbox_default          Created                                                                                                                                                                                                                               0.1s
 ✔ Container netbox-redis-cache-1  Started                                                                                                                                                                                                                               0.7s
 ✔ Container netbox-postgres-1     Started                                                                                                                                                                                                                               0.9s
 ✔ Container netbox-redis-1        Started                                                                                                                                                                                                                               0.9s
 ✔ Container netbox                Started                                                                                                                                                                                                                               0.9s
[mod-init] Running Docker Modification Logic
[mod-init] Adding linuxserver/mods:pull_request_944 to container
[mod-init] Downloading linuxserver/mods:pull_request_944 from lscr.io
[mod-init] Installing linuxserver/mods:pull_request_944
[mod-init] linuxserver/mods:pull_request_944 applied to container
[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────
Linuxserver.io version: v4.0.9-ls219
Build-date: 2024-08-22T15:50:05+00:00
───────────────────────────────────────

Building local documentation
Traceback (most recent call last):
  File "/app/netbox/netbox/netbox/settings.py", line 778, 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 "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'slurpit_netbox'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/lsiopy/lib/python3.12/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
    self._setup(name)
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 76, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/app/netbox/netbox/netbox/settings.py", line 781, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin slurpit_netbox: Module not found. Check that the plugin module has been installed within the correct Python environment.
ERROR   -  mkdocstrings: Error while loading JSON:

Traceback (most recent call last):
  File "/lsiopy/lib/python3.12/site-packages/mkdocstrings_handlers/python/handler.py", line 271, in collect
    result = json.loads(stdout)
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


Aborted with a BuildError!
ERROR   -  Error reading page 'plugins/development/dashboard-widgets.md':
ERROR   -  Could not collect 'extras.dashboard.widgets.DashboardWidget'
Traceback (most recent call last):
  File "/app/netbox/netbox/netbox/settings.py", line 778, 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 "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'slurpit_netbox'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/netbox/netbox/./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/base.py", line 104, in wrapper
    saved_locale = translation.get_language()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/utils/translation/__init__.py", line 211, in get_language
    return _trans.get_language()
           ^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/utils/translation/__init__.py", line 66, in __getattr__
    if settings.USE_I18N:
       ^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
    self._setup(name)
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 76, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/app/netbox/netbox/netbox/settings.py", line 781, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin slurpit_netbox: Module not found. Check that the plugin module has been installed within the correct Python environment.
Traceback (most recent call last):
  File "/app/netbox/netbox/netbox/settings.py", line 778, 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 "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'slurpit_netbox'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/core/management/commands/shell.py", line 127, in handle
    exec(sys.stdin.read(), globals())
  File "<string>", line 1, in <module>
  File "/app/netbox/netbox/users/models/__init__.py", line 1, in <module>
    from .users import *
  File "/app/netbox/netbox/users/models/users.py", line 1, in <module>
    from django.contrib.auth.models import (
  File "/lsiopy/lib/python3.12/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/lsiopy/lib/python3.12/site-packages/django/contrib/auth/base_user.py", line 59, in <module>
    class AbstractBaseUser(models.Model):
  File "/lsiopy/lib/python3.12/site-packages/django/db/models/base.py", line 129, in __new__
    app_config = apps.get_containing_app_config(module)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/apps/registry.py", line 260, in get_containing_app_config
    self.check_apps_ready()
  File "/lsiopy/lib/python3.12/site-packages/django/apps/registry.py", line 137, in check_apps_ready
    settings.INSTALLED_APPS
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
    self._setup(name)
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 76, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/netbox/netbox/netbox/settings.py", line 781, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin slurpit_netbox: Module not found. Check that the plugin module has been installed within the correct Python environment.
s6-rc: warning: unable to start service init-netbox-config: command exited 1

@aptalca
Copy link
Member

aptalca commented Aug 26, 2024

Ah, the issue is, netbox's init actually runs some of netbox scripts and it runs before the mods. So your config references the plugin, but it's not installed yet.

@aptalca
Copy link
Member

aptalca commented Aug 26, 2024

May have to modify netbox's init to move the migration to the service file instead.

I'll have to discuss with the team internally.

@jared-bloomer
Copy link
Author

May have to modify netbox's init to move the migration to the service file instead.

I'll have to discuss with the team internally.

Alright. Given that I will hold on further development on this PR until further notice. Thanks for all your help so far.

@aptalca
Copy link
Member

aptalca commented Aug 27, 2024

Can you test this netbox image with the mod builds from here? lspipepr/netbox:amd64-v4.0.9-pkg-eef91fa3-dev-d175a8dea405a7e861789420e59f4e35a05e5531-pr-61

@jared-bloomer
Copy link
Author

Can you test this netbox image with the mod builds from here? lspipepr/netbox:amd64-v4.0.9-pkg-eef91fa3-dev-d175a8dea405a7e861789420e59f4e35a05e5531-pr-61

Not completely clean on start, but it is functional now.

netbox         | [mod-init] Adding linuxserver/mods:pull_request_944 to container
netbox         | [mod-init] Downloading linuxserver/mods:pull_request_944 from lscr.io
netbox         | [mod-init] Installing linuxserver/mods:pull_request_944
netbox         | [mod-init] linuxserver/mods:pull_request_944 applied to container
netbox         | [migrations] started
netbox         | [migrations] no migrations found
netbox         | ───────────────────────────────────────
netbox         |
netbox         |       ██╗     ███████╗██╗ ██████╗
netbox         |       ██║     ██╔════╝██║██╔═══██╗
netbox         |       ██║     ███████╗██║██║   ██║
netbox         |       ██║     ╚════██║██║██║   ██║
netbox         |       ███████╗███████║██║╚██████╔╝
netbox         |       ╚══════╝╚══════╝╚═╝ ╚═════╝
netbox         |
netbox         |    Brought to you by linuxserver.io
netbox         | ───────────────────────────────────────
netbox         |
netbox         | To support LSIO projects visit:
netbox         | https://www.linuxserver.io/donate/
netbox         |
netbox         | ───────────────────────────────────────
netbox         | GID/UID
netbox         | ───────────────────────────────────────
netbox         |
netbox         | User UID:    1000
netbox         | User GID:    1000
netbox         | ───────────────────────────────────────
netbox         | Linuxserver.io version: v4.0.9-pkg-eef91fa3-dev-d175a8dea405a7e861789420e59f4e35a05e5531-pr-61
netbox         | Build-date: 2024-08-27T01:00:01+00:00
netbox         | ───────────────────────────────────────
netbox         |
netbox         | Building local documentation
netbox         | Traceback (most recent call last):
netbox         |   File "/app/netbox/netbox/netbox/settings.py", line 778, in <module>
netbox         |     plugin = importlib.import_module(plugin_name)
netbox         |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
netbox         |     return _bootstrap._gcd_import(name[level:], package, level)
netbox         |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
netbox         |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
netbox         |   File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
netbox         | ModuleNotFoundError: No module named 'slurpit_netbox'
netbox         |
netbox         | During handling of the above exception, another exception occurred:
netbox         |
netbox         | Traceback (most recent call last):
netbox         |   File "<string>", line 1, in <module>
netbox         |   File "/lsiopy/lib/python3.12/site-packages/django/__init__.py", line 19, in setup
netbox         |     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
netbox         |                       ^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
netbox         |     self._setup(name)
netbox         |   File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 76, in _setup
netbox         |     self._wrapped = Settings(settings_module)
netbox         |                     ^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/lsiopy/lib/python3.12/site-packages/django/conf/__init__.py", line 190, in __init__
netbox         |     mod = importlib.import_module(self.SETTINGS_MODULE)
netbox         |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
netbox         |     return _bootstrap._gcd_import(name[level:], package, level)
netbox         |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
netbox         |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
netbox         |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
netbox         |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
netbox         |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
netbox         |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
netbox         |   File "/app/netbox/netbox/netbox/settings.py", line 781, in <module>
netbox         |     raise ImproperlyConfigured(
netbox         | django.core.exceptions.ImproperlyConfigured: Unable to import plugin slurpit_netbox: Module not found. Check that the plugin module has been installed within the correct Python environment.
netbox         | ERROR   -  mkdocstrings: Error while loading JSON:
netbox         |
netbox         | Traceback (most recent call last):
netbox         |   File "/lsiopy/lib/python3.12/site-packages/mkdocstrings_handlers/python/handler.py", line 271, in collect
netbox         |     result = json.loads(stdout)
netbox         |              ^^^^^^^^^^^^^^^^^^
netbox         |   File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
netbox         |     return _default_decoder.decode(s)
netbox         |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
netbox         |     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
netbox         |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox         |   File "/usr/lib/python3.12/json/decoder.py", line 355, in raw_decode
netbox         |     raise JSONDecodeError("Expecting value", s, err.value) from None
netbox         | json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
netbox         |
netbox         | ERROR   -  Error reading page 'plugins/development/dashboard-widgets.md':
netbox         | ERROR   -  Could not collect 'extras.dashboard.widgets.DashboardWidget'
netbox         |
netbox         | Aborted with a BuildError!
netbox         | **** Checking if slurpit_netbox is already installed ****
netbox         | **** Adding slurpit_netbox and their deps to package install lists ****
netbox         | [pkg-install-init] **** Installing all pip packages ****
netbox         | Requirement already satisfied: pip in /lsiopy/lib/python3.12/site-packages (24.2)
netbox         | Requirement already satisfied: wheel in /lsiopy/lib/python3.12/site-packages (0.44.0)
netbox         | Collecting setuptools
netbox         |   Downloading setuptools-73.0.1-py3-none-any.whl.metadata (6.6 kB)
netbox         | Downloading setuptools-73.0.1-py3-none-any.whl (2.3 MB)
netbox         |    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 2.6 MB/s eta 0:00:00
netbox         | Installing collected packages: setuptools
netbox         | Successfully installed setuptools-73.0.1
netbox         | Looking in links: https://wheel-index.linuxserver.io/alpine-3.20/
netbox         | Requirement already satisfied: setuptools in /lsiopy/lib/python3.12/site-packages (73.0.1)
netbox         | Collecting slurpit_netbox
netbox         |   Downloading slurpit_netbox-0.9.57-py3-none-any.whl.metadata (1.5 kB)
netbox         | Collecting djangorestframework-bulk<0.3.0,>=0.2.1 (from slurpit_netbox)
netbox         |   Downloading djangorestframework-bulk-0.2.1.tar.gz (13 kB)
netbox         |   Preparing metadata (setup.py): started
netbox         |   Preparing metadata (setup.py): finished with status 'done'
netbox         | Requirement already satisfied: requests<3.0.0,>=2.31.0 in /lsiopy/lib/python3.12/site-packages (from slurpit_netbox) (2.32.3)
netbox         | Requirement already satisfied: django in /lsiopy/lib/python3.12/site-packages (from djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (5.0.8)
netbox         | Requirement already satisfied: djangorestframework in /lsiopy/lib/python3.12/site-packages (from djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (3.15.2)
netbox         | Requirement already satisfied: charset-normalizer<4,>=2 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (3.3.2)
netbox         | Requirement already satisfied: idna<4,>=2.5 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (3.8)
netbox         | Requirement already satisfied: urllib3<3,>=1.21.1 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (2.2.2)
netbox         | Requirement already satisfied: certifi>=2017.4.17 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (2024.7.4)
netbox         | Requirement already satisfied: asgiref<4,>=3.7.0 in /lsiopy/lib/python3.12/site-packages (from django->djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (3.8.1)
netbox         | Requirement already satisfied: sqlparse>=0.3.1 in /lsiopy/lib/python3.12/site-packages (from django->djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (0.5.1)
netbox         | Downloading slurpit_netbox-0.9.57-py3-none-any.whl (116 kB)
netbox         | Building wheels for collected packages: djangorestframework-bulk
netbox         |   Building wheel for djangorestframework-bulk (setup.py): started
netbox         |   Building wheel for djangorestframework-bulk (setup.py): finished with status 'done'
netbox         |   Created wheel for djangorestframework-bulk: filename=djangorestframework_bulk-0.2.1-py3-none-any.whl size=17349 sha256=be436c5eae8788c939af296af7ea9914c0be02f1c458ec99cf3f4c20b0eb5886
netbox         |   Stored in directory: /root/.cache/pip/wheels/62/c5/2b/b267f91d85276292f778a13d7e05be13d5343d786cb0ae4a8f
netbox         | Successfully built djangorestframework-bulk
netbox         | Installing collected packages: djangorestframework-bulk, slurpit_netbox
netbox         | Successfully installed djangorestframework-bulk-0.2.1 slurpit_netbox-0.9.57
netbox         | [custom-init] No custom files found, skipping...
netbox         | Operations to perform:
netbox         |   Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, slurpit_netbox, social_django, taggit, tenancy, users, virtualization, vpn, wireless
netbox         | Running migrations:
netbox         |   No migrations to apply.
netbox         | Superuser creation skipped. Already exists.
netbox         | [uWSGI] getting INI configuration from uwsgi.ini
netbox         | [uwsgi-static] added mapping for /static => static
netbox         | *** Starting uWSGI 2.0.25.1 (64bit) on [Tue Aug 27 11:43:56 2024] ***
netbox         | compiled with version: 13.2.1 20240309 on 17 May 2024 06:11:37
netbox         | os: Linux-5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024
netbox         | nodename: 27d5917bf1f1
netbox         | machine: x86_64
netbox         | clock source: unix
netbox         | pcre jit disabled
netbox         | detected number of CPU cores: 4
netbox         | current working directory: /app/netbox/netbox
netbox         | detected binary path: /usr/sbin/uwsgi
netbox         | your memory page size is 4096 bytes
netbox         | detected max file descriptor number: 1048576
netbox         | building mime-types dictionary from file /etc/mime.types...1390 entry found
netbox         | lock engine: pthread robust mutexes
netbox         | thunder lock: disabled (you can enable it with --thunder-lock)
netbox         | uwsgi socket 0 bound to TCP address :8000 fd 3
netbox         | Python version: 3.12.3 (main, Aug 23 2024, 06:10:48) [GCC 13.2.1 20240309]
netbox         | PEP 405 virtualenv detected: /lsiopy
netbox         | Set PythonHome to /lsiopy
netbox         | Python main interpreter initialized at 0x7fe0363d4688
netbox         | python threads support enabled
netbox         | your server socket listen backlog is limited to 100 connections
netbox         | your mercy for graceful operations on workers is 60 seconds
netbox         | mapped 203184 bytes (198 KB) for 1 cores
netbox         | *** Operational MODE: single process ***
netbox         | running "exec:python3 ./manage.py collectstatic --noinput" (pre app)...
netbox         | Connection to localhost (127.0.0.1) 8000 port [tcp/*] succeeded!
netbox         | [ls.io-init] done.
netbox         |
netbox         | 171 static files copied to '/app/netbox/netbox/static'.
netbox         | running "exec:python3 ./manage.py remove_stale_contenttypes --no-input" (pre app)...
netbox         | running "exec:python3 ./manage.py clearsessions" (pre app)...
netbox         | WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x7fe0363d4688 pid: 227 (default app)
netbox         | *** uWSGI is running in multiple interpreter mode ***
netbox         | spawned uWSGI master process (pid: 227)
netbox         | spawned uWSGI worker 1 (pid: 254, cores: 1)
netbox         | [uwsgi-daemons] spawning "python3 ./manage.py rqworker" (uid: 1000 gid: 1000)
netbox         | No queues have been specified. This process will service the following queues by default: high, default, low
netbox         | 11:44:32 Worker rq:worker:8fc41dabd1ef4f008151181a33d13b8d started with PID 255, version 1.16.2
netbox         | 11:44:32 Subscribing to channel rq:pubsub:8fc41dabd1ef4f008151181a33d13b8d
netbox         | 11:44:32 *** Listening on high, default, low...
netbox         | 11:44:32 Scheduler for default, low, high started with PID 257
netbox         | 11:44:32 Cleaning registries for queue: high
netbox         | 11:44:32 Cleaning registries for queue: default
netbox         | 11:44:32 Cleaning registries for queue: low

Now in the netbox UI I can see Slurpit in the navigation menu and adjust settings and such.

image

Thanks again for your help on this.

@aptalca
Copy link
Member

aptalca commented Aug 27, 2024

Can you try this one? lspipepr/netbox:amd64-v4.0.9-pkg-eef91fa3-dev-b45c949faaaa8e1b8afc751bf8821971b1cd9bcf-pr-61)

Thanks

@jared-bloomer
Copy link
Author

Can you try this one? lspipepr/netbox:amd64-v4.0.9-pkg-eef91fa3-dev-b45c949faaaa8e1b8afc751bf8821971b1cd9bcf-pr-61)

Thanks

That one gives a clean startup like I was expecting

netbox         | [mod-init] Adding linuxserver/mods:pull_request_944 to container
netbox         | [mod-init] Downloading linuxserver/mods:pull_request_944 from lscr.io
netbox         | [mod-init] Installing linuxserver/mods:pull_request_944
netbox         | [mod-init] linuxserver/mods:pull_request_944 applied to container
netbox         | [migrations] started
netbox         | [migrations] no migrations found
netbox         | ───────────────────────────────────────
netbox         |
netbox         |       ██╗     ███████╗██╗ ██████╗
netbox         |       ██║     ██╔════╝██║██╔═══██╗
netbox         |       ██║     ███████╗██║██║   ██║
netbox         |       ██║     ╚════██║██║██║   ██║
netbox         |       ███████╗███████║██║╚██████╔╝
netbox         |       ╚══════╝╚══════╝╚═╝ ╚═════╝
netbox         |
netbox         |    Brought to you by linuxserver.io
netbox         | ───────────────────────────────────────
netbox         |
netbox         | To support LSIO projects visit:
netbox         | https://www.linuxserver.io/donate/
netbox         |
netbox         | ───────────────────────────────────────
netbox         | GID/UID
netbox         | ───────────────────────────────────────
netbox         |
netbox         | User UID:    1000
netbox         | User GID:    1000
netbox         | ───────────────────────────────────────
netbox         | Linuxserver.io version: v4.0.9-pkg-eef91fa3-dev-b45c949faaaa8e1b8afc751bf8821971b1cd9bcf-pr-61
netbox         | Build-date: 2024-08-27T12:25:03+00:00
netbox         | ───────────────────────────────────────
netbox         |
netbox         | **** Checking if slurpit_netbox is already installed ****
netbox         | **** Adding slurpit_netbox and their deps to package install lists ****
netbox         | [pkg-install-init] **** Installing all pip packages ****
netbox         | Requirement already satisfied: pip in /lsiopy/lib/python3.12/site-packages (24.2)
netbox         | Requirement already satisfied: wheel in /lsiopy/lib/python3.12/site-packages (0.44.0)
netbox         | Collecting setuptools
netbox         |   Downloading setuptools-73.0.1-py3-none-any.whl.metadata (6.6 kB)
netbox         | Downloading setuptools-73.0.1-py3-none-any.whl (2.3 MB)
netbox         |    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 2.5 MB/s eta 0:00:00
netbox         | Installing collected packages: setuptools
netbox         | Successfully installed setuptools-73.0.1
netbox         | Looking in links: https://wheel-index.linuxserver.io/alpine-3.20/
netbox         | Requirement already satisfied: setuptools in /lsiopy/lib/python3.12/site-packages (73.0.1)
netbox         | Collecting slurpit_netbox
netbox         |   Downloading slurpit_netbox-0.9.57-py3-none-any.whl.metadata (1.5 kB)
netbox         | Collecting djangorestframework-bulk<0.3.0,>=0.2.1 (from slurpit_netbox)
netbox         |   Downloading djangorestframework-bulk-0.2.1.tar.gz (13 kB)
netbox         |   Preparing metadata (setup.py): started
netbox         |   Preparing metadata (setup.py): finished with status 'done'
netbox         | Requirement already satisfied: requests<3.0.0,>=2.31.0 in /lsiopy/lib/python3.12/site-packages (from slurpit_netbox) (2.32.3)
netbox         | Requirement already satisfied: django in /lsiopy/lib/python3.12/site-packages (from djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (5.0.8)
netbox         | Requirement already satisfied: djangorestframework in /lsiopy/lib/python3.12/site-packages (from djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (3.15.2)
netbox         | Requirement already satisfied: charset-normalizer<4,>=2 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (3.3.2)
netbox         | Requirement already satisfied: idna<4,>=2.5 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (3.8)
netbox         | Requirement already satisfied: urllib3<3,>=1.21.1 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (2.2.2)
netbox         | Requirement already satisfied: certifi>=2017.4.17 in /lsiopy/lib/python3.12/site-packages (from requests<3.0.0,>=2.31.0->slurpit_netbox) (2024.7.4)
netbox         | Requirement already satisfied: asgiref<4,>=3.7.0 in /lsiopy/lib/python3.12/site-packages (from django->djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (3.8.1)
netbox         | Requirement already satisfied: sqlparse>=0.3.1 in /lsiopy/lib/python3.12/site-packages (from django->djangorestframework-bulk<0.3.0,>=0.2.1->slurpit_netbox) (0.5.1)
netbox         | Downloading slurpit_netbox-0.9.57-py3-none-any.whl (116 kB)
netbox         | Building wheels for collected packages: djangorestframework-bulk
netbox         |   Building wheel for djangorestframework-bulk (setup.py): started
netbox         |   Building wheel for djangorestframework-bulk (setup.py): finished with status 'done'
netbox         |   Created wheel for djangorestframework-bulk: filename=djangorestframework_bulk-0.2.1-py3-none-any.whl size=17349 sha256=ec30cab6ca718e524d3306c06beadd2d9e9d563cac3a1ae3af78dc2b40eccb5d
netbox         |   Stored in directory: /root/.cache/pip/wheels/62/c5/2b/b267f91d85276292f778a13d7e05be13d5343d786cb0ae4a8f
netbox         | Successfully built djangorestframework-bulk
netbox         | Installing collected packages: djangorestframework-bulk, slurpit_netbox
netbox         | Successfully installed djangorestframework-bulk-0.2.1 slurpit_netbox-0.9.57
netbox         | [custom-init] No custom files found, skipping...
netbox         | Operations to perform:
netbox         |   Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, slurpit_netbox, social_django, taggit, tenancy, users, virtualization, vpn, wireless
netbox         | Running migrations:
netbox         |   No migrations to apply.
netbox         | Superuser creation skipped. Already exists.
netbox         | Building local documentation
netbox         | /lsiopy/lib/python3.12/site-packages/strawberry/utils/deprecations.py:23: UserWarning: _type_definition is deprecated, use __strawberry_definition__ instead
netbox         |   self.warn()
netbox         | [uWSGI] getting INI configuration from uwsgi.ini
netbox         | [uwsgi-static] added mapping for /static => static
netbox         | *** Starting uWSGI 2.0.25.1 (64bit) on [Tue Aug 27 14:48:52 2024] ***
netbox         | compiled with version: 13.2.1 20240309 on 17 May 2024 06:11:37
netbox         | os: Linux-5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024
netbox         | nodename: 0903fb6b52ae
netbox         | machine: x86_64
netbox         | clock source: unix
netbox         | pcre jit disabled
netbox         | detected number of CPU cores: 4
netbox         | current working directory: /app/netbox/netbox
netbox         | detected binary path: /usr/sbin/uwsgi
netbox         | your memory page size is 4096 bytes
netbox         | detected max file descriptor number: 1048576
netbox         | building mime-types dictionary from file /etc/mime.types...1390 entry found
netbox         | lock engine: pthread robust mutexes
netbox         | thunder lock: disabled (you can enable it with --thunder-lock)
netbox         | uwsgi socket 0 bound to TCP address :8000 fd 3
netbox         | Python version: 3.12.3 (main, Aug 23 2024, 06:10:48) [GCC 13.2.1 20240309]
netbox         | PEP 405 virtualenv detected: /lsiopy
netbox         | Set PythonHome to /lsiopy
netbox         | Python main interpreter initialized at 0x7f611851c688
netbox         | python threads support enabled
netbox         | your server socket listen backlog is limited to 100 connections
netbox         | your mercy for graceful operations on workers is 60 seconds
netbox         | mapped 203184 bytes (198 KB) for 1 cores
netbox         | *** Operational MODE: single process ***
netbox         | running "exec:python3 ./manage.py collectstatic --noinput" (pre app)...
netbox         | Connection to localhost (127.0.0.1) 8000 port [tcp/*] succeeded!
netbox         | [ls.io-init] done.
netbox         |
netbox         | 487 static files copied to '/app/netbox/netbox/static'.
netbox         | running "exec:python3 ./manage.py remove_stale_contenttypes --no-input" (pre app)...
netbox         | running "exec:python3 ./manage.py clearsessions" (pre app)...

compose.yml for reference

services:
  netbox:
    image: lspipepr/netbox:amd64-v4.0.9-pkg-eef91fa3-dev-b45c949faaaa8e1b8afc751bf8821971b1cd9bcf-pr-61
    container_name: netbox
    env_file: env/netbox.env
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - SUPERUSER_EMAIL=<sanitized>
      - ALLOWED_HOST="*"
      - DB_NAME=netbox
      - DOCKER_MODS=ghcr.io/linuxserver/mods:pull_request_944
    volumes:
      - ./config:/config
    ports:
      - 8000:8000
    restart: unless-stopped
    depends_on:
      - postgres
      - redis
      - redis-cache
    links:
      - postgres:postgres
      - redis:redis
      - redis-cache:redis-cache
  postgres:
    image: docker.io/postgres:16-alpine
    env_file: env/postgres.env
    volumes:
      - ./postgresql:/var/lib/postgresql/data
  redis:
    image: docker.io/redis:7-alpine
    command:
      - sh
      - -c # this is to evaluate the $REDIS_PASSWORD from the env
      - redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis.env
    volumes:
      - ./redis-data:/data
  redis-cache:
    image: docker.io/redis:7-alpine
    command:
      - sh
      - -c # this is to evaluate the $REDIS_PASSWORD from the env
      - redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
    env_file: env/redis-cache.env
    volumes:
      - ./redis-cache-data:/data

@aptalca
Copy link
Member

aptalca commented Aug 27, 2024

Perfect, thanks.

@aptalca aptalca merged commit 19cc4c5 into linuxserver:netbox-slurpit Aug 27, 2024
4 checks passed
@jared-bloomer jared-bloomer deleted the netbox-slurpit branch August 27, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants