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

3.2.0 Docker version string breaks startup #1393

Closed
janders3-oberlin opened this issue Feb 11, 2025 · 3 comments
Closed

3.2.0 Docker version string breaks startup #1393

janders3-oberlin opened this issue Feb 11, 2025 · 3 comments

Comments

@janders3-oberlin
Copy link

Current Behavior

After pulling down v3.2.0 and switching my Dockerfile-Plugins over to uv from pip, I found that the changes made in #1380 break a couple of things.

First, building failed with the netbox-topology-views plugin included due to the version string changing from 4.2.3 to 4.2.3-Docker-3.2.0, which it didn't seem to like. Removing that plugin from configuration allowed the build to be successful.

Build error
2.291 🧬 loaded config '/etc/netbox/config/configuration.py'
2.291 🧬 loaded config '/etc/netbox/config/extra.py'
2.291 🧬 loaded config '/etc/netbox/config/logging.py'
2.291 🧬 loaded config '/etc/netbox/config/plugins.py'
2.291 Traceback (most recent call last):
2.291   File "/opt/netbox/netbox/manage.py", line 10, in <module>
2.291     execute_from_command_line(sys.argv)
2.291   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
2.291     utility.execute()
2.291   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
2.291     django.setup()
2.291   File "/opt/netbox/venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
2.291     apps.populate(settings.INSTALLED_APPS)
2.291   File "/opt/netbox/venv/lib/python3.12/site-packages/django/apps/registry.py", line 124, in populate
2.291     app_config.ready()
2.291   File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_topology_views/__init__.py", line 22, in ready
2.291     super().ready()
2.291   File "/opt/netbox/netbox/netbox/plugins/__init__.py", line 116, in ready
2.291     if template_extensions := self._load_resource('template_extensions'):
2.291                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.291   File "/opt/netbox/netbox/netbox/plugins/__init__.py", line 92, in _load_resource
2.291     module = import_module(default_module)
2.291              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.291   File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
2.292     return _bootstrap._gcd_import(name[level:], package, level)
2.292            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.292   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
2.292   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
2.292   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
2.292   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
2.292   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
2.292   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
2.292   File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_topology_views/template_content.py", line 6, in <module>
2.292     NETBOX_CURRENT_VERSION = version.parse(settings.VERSION)
2.292                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2.292   File "/opt/netbox/venv/lib/python3.12/site-packages/packaging/version.py", line 56, in parse
2.292     return Version(version)
2.292            ^^^^^^^^^^^^^^^^
2.292   File "/opt/netbox/venv/lib/python3.12/site-packages/packaging/version.py", line 202, in __init__
2.292     raise InvalidVersion(f"Invalid version: {version!r}")
2.292 packaging.version.InvalidVersion: Invalid version: '4.2.3-Docker-3.2.0'
------
failed to solve: process "/bin/sh -c SECRET_KEY=\"dummydummydummydummydummydummydummydummydummydummy\" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input" did not complete successfully: exit code: 1

Second, and more importantly, docker compose up no longer allows the instance to come up. It repeats the following error over and over and times out the "waiting on DB" phase of startup:

netbox-1               | packaging.version.InvalidVersion: Invalid version: '4.2.3-Docker-3.2.0'

Expected Behavior

Expected the instance to come up. While plugin incompatibility is probably out of scope for this repo, it's still a problem that the NetBox instance will now not start up. I suspect that the root cause is independent of the plugin in question, and that the plugin just happened to be the most noisy complainant about the version string prior to starting up the compose project.

Docker Compose Version

v2.32.4

Docker Version

Client: Docker Engine - Community
 Version:           27.5.1
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        9f9e405
 Built:             Wed Jan 22 13:42:47 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.5.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.11
  Git commit:       4c9b3b0
  Built:            Wed Jan 22 13:41:09 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

The git Revision

0b70f72

The git Status

On branch release
Your branch is up to date with 'origin/release'.

Startup Command

docker compose up

NetBox Logs

netbox-1               | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox-1               | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox-1               | Traceback (most recent call last):
netbox-1               |   File "/opt/netbox/netbox/./manage.py", line 10, in <module>
netbox-1               |     execute_from_command_line(sys.argv)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
netbox-1               |     utility.execute()
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
netbox-1               |     self.fetch_command(subcommand).run_from_argv(self.argv)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
netbox-1               |     self.execute(*args, **cmd_options)
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 454, in execute
netbox-1               |     self.check()
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 486, in check
netbox-1               |     all_issues = checks.run_checks(
netbox-1               |                  ^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/registry.py", line 88, in run_checks
netbox-1               |     new_errors = check(app_configs=app_configs, databases=databases)
netbox-1               |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 44, in check_url_namespaces_unique
netbox-1               |     all_namespaces = _load_all_namespaces(resolver)
netbox-1               |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/checks/urls.py", line 63, in _load_all_namespaces
netbox-1               |     url_patterns = getattr(resolver, "url_patterns", [])
netbox-1               |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
netbox-1               |     res = instance.__dict__[self.name] = self.func(instance)
netbox-1               |                                          ^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 718, in url_patterns
netbox-1               |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
netbox-1               |                        ^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/functional.py", line 47, in __get__
netbox-1               |     res = instance.__dict__[self.name] = self.func(instance)
netbox-1               |                                          ^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 711, in urlconf_module
netbox-1               |     return import_module(self.urlconf_name)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
netbox-1               |     return _bootstrap._gcd_import(name[level:], package, level)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
netbox-1               |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
netbox-1               |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
netbox-1               |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
netbox-1               |   File "<frozen importlib._bootstrap_external>", line 995, in exec_module
netbox-1               |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
netbox-1               |   File "/opt/netbox/netbox/netbox/urls.py", line 11, in <module>
netbox-1               |     from netbox.plugins.urls import plugin_patterns, plugin_api_patterns
netbox-1               |   File "/opt/netbox/netbox/netbox/plugins/urls.py", line 26, in <module>
netbox-1               |     urlpatterns = import_string(f"{plugin_path}.urls.urlpatterns")
netbox-1               |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/module_loading.py", line 30, in import_string
netbox-1               |     return cached_import(module_path, class_name)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/module_loading.py", line 15, in cached_import
netbox-1               |     module = import_module(module_path)
netbox-1               |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
netbox-1               |     return _bootstrap._gcd_import(name[level:], package, level)
netbox-1               |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_diode_plugin/urls.py", line 7, in <module>
netbox-1               |     from . import views
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_diode_plugin/views.py", line 26, in <module>
netbox-1               |     from netbox_diode_plugin.tables import IngestionLogsTable
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/netbox_diode_plugin/tables.py", line 11, in <module>
netbox-1               |     if version.parse(settings.VERSION).major >= 4:
netbox-1               |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/packaging/version.py", line 56, in parse
netbox-1               |     return Version(version)
netbox-1               |            ^^^^^^^^^^^^^^^^
netbox-1               |   File "/opt/netbox/venv/lib/python3.12/site-packages/packaging/version.py", line 202, in __init__
netbox-1               |     raise InvalidVersion(f"Invalid version: {version!r}")
netbox-1               | packaging.version.InvalidVersion: Invalid version: '4.2.3-Docker-3.2.0'
netbox-1               | ⏳ Waiting on DB... (0s / 30s)

Content of docker-compose.override.yml

services:
  netbox:
    image: netbox:latest-plugins
    ports:
      - "9000:8080"
    build:
      context: .
      dockerfile: Dockerfile-Plugins
    # If you want the Nginx unit status page visible from the
    # outside of the container add the following port mapping:
    #- "8001:8081"
    healthcheck:
      # Time for which the health check can fail after the container is started.
      # This depends mostly on the performance of your database. On the first start,
      # when all tables need to be created the start_period should be higher than on
      # subsequent starts. For the first start after major version upgrades of NetBox
      # the start_period might also need to be set higher.
      # Default value in our docker-compose.yml is 60s
      start_period: 180s
    environment:
      ALLOWED_HOSTS: '*'
      TIME_ZONE: "America/New_York"
      SECRET_KEY: [SCRUBBED]
      PREFER_IPV4: "True"
      # SKIP_SUPERUSER: "false"
      REMOTE_AUTH_ENABLED: "True"
      REMOTE_AUTH_BACKEND: "netbox.authentication.LDAPBackend"
  netbox-worker:
    image: netbox:latest-plugins
    build:
      context: .
      dockerfile: Dockerfile-Plugins
  netbox-housekeeping:
    image: netbox:latest-plugins
    build:
      context: .
      dockerfile: Dockerfile-Plugins
@tobiasge
Copy link
Member

I opened a PR in the plugin repository:
netbox-community/netbox-topology-views#608

@janders3-oberlin
Copy link
Author

That's good to know for the first part of the opened issue, but even with the plugin completely removed from configuration, my instance is still failing to start up.

@janders3-oberlin
Copy link
Author

Actually, it looks like the diode plugin might be affected by the same issue, but it just didn't show as much until attempting to start up.
Looks like there is already a PR open over there:
netboxlabs/diode-netbox-plugin#59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants