Onemind-Services-LLC / netbox-secrets

Enhance your secret management with encrypted storage and flexible, user-friendly features.
Apache License 2.0
105 stars 11 forks source link

[Bug]: Failed to build docker image #58

Closed bsv9 closed 1 year ago

bsv9 commented 1 year ago

NetBox Secrets plugin version

v1.8.0

NetBox version

v3.5.1

Steps to Reproduce

Hi

I'm unable to build docker image with official netbox-docker repo (v2.6.1)

docker step "collectstatic" executed in a build step while a database is not available.

Expected Behavior

"collectstatic" stage should be running without database connection

Observed Behavior

I got un exception

> [7/7] RUN SECRET_KEY="dummyKeyWithMinimumLength----------------------------------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input:

#0 3.993 The above exception was the direct cause of the following exception:
#0 3.993
#0 3.993 Traceback (most recent call last):
#0 3.993   File "/opt/netbox/netbox/manage.py", line 10, in <module>
#0 3.993     execute_from_command_line(sys.argv)
#0 3.993   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
#0 3.994     utility.execute()
#0 3.994   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute
#0 3.995     django.setup()
#0 3.995   File "/opt/netbox/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
#0 3.995     apps.populate(settings.INSTALLED_APPS)
#0 3.995   File "/opt/netbox/venv/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
#0 3.996     app_config.ready()
#0 3.996   File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_secrets/__init__.py", line 39, in ready
#0 3.996     for content_type in ContentType.objects.filter(SECRET_ASSIGNABLE_MODELS):
#0 3.996   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 394, in __iter__
#0 3.997     self._fetch_all()
#0 3.997   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1867, in _fetch_all
#0 3.998     self._result_cache = list(self._iterable_class(self))
#0 3.998   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 87, in __iter__
#0 3.998     results = compiler.execute_sql(
#0 3.998   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1396, in execute_sql
#0 3.999     cursor = self.connection.cursor()
#0 3.999   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
#0 3.999     return func(*args, **kwargs)
#0 3.999   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/base.py", line 323, in cursor
#0 4.000     return self._cursor()
#0 4.000   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/base.py", line 299, in _cursor
#0 4.000     self.ensure_connection()
#0 4.000   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
#0 4.000     return func(*args, **kwargs)
#0 4.000   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/base.py", line 281, in ensure_connection
#0 4.001     with self.wrap_database_errors:
#0 4.001   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
#0 4.001     raise dj_exc_value.with_traceback(traceback) from exc_value
#0 4.001   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/base.py", line 282, in ensure_connection
#0 4.001     self.connect()
#0 4.001   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
#0 4.001     return func(*args, **kwargs)
#0 4.001   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/base/base.py", line 263, in connect
#0 4.002     self.connection = self.get_new_connection(conn_params)
#0 4.002   File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/asyncio.py", line 26, in inner
#0 4.002     return func(*args, **kwargs)
#0 4.002   File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/backends/postgresql/base.py", line 215, in get_new_connection
#0 4.002     connection = Database.connect(**conn_params)
#0 4.002   File "/opt/netbox/venv/lib/python3.10/site-packages/psycopg2/__init__.py", line 122, in connect
#0 4.003     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
#0 4.003 django.db.utils.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
#0 4.003        Is the server running on that host and accepting TCP/IP connections?
#0 4.003 connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
#0 4.003        Is the server running on that host and accepting TCP/IP connections?