Kani999 / netbox-attachments

Plugin to manage attachments for any model
Apache License 2.0
56 stars 4 forks source link

Fail to manage.py migrate on docker-compose #74

Open Flabenelli opened 1 week ago

Flabenelli commented 1 week ago

When I do RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate netbox_attachments and regenerate de worker image

I get


5.136   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 274, in ensure_connection
5.137     with self.wrap_database_errors:
5.137   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
5.137     raise dj_exc_value.with_traceback(traceback) from exc_value
5.137   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
5.137     self.connect()
5.138   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
5.138     return func(*args, **kwargs)
5.138            ^^^^^^^^^^^^^^^^^^^^^
5.138   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
5.138     self.connection = self.get_new_connection(conn_params)
5.138                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5.138   File "/opt/netbox/venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
5.138     return func(*args, **kwargs)
5.138            ^^^^^^^^^^^^^^^^^^^^^
5.138   File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/backends/postgresql/base.py", line 277, in get_new_connection
5.138     connection = self.Database.connect(**conn_params)
5.138                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5.138   File "/opt/netbox/venv/lib/python3.12/site-packages/psycopg/connection.py", line 119, in connect
5.139     raise last_ex.with_traceback(None)
5.139 django.db.utils.OperationalError: connection is bad: connection to server at "::1", port 5432 failed: Cannot assign requested address
5.139   Is the server running on that host and accepting TCP/IP connections?```

There is some extra vars I need to add?
Kani999 commented 1 week ago

The error you're encountering indicates that there is a problem with connecting to the PostgreSQL server. Is your PostgreSQL server running? (connecting to"::1", port 5432 )

connection is bad: connection to server at "::1", port 5432 failed. Cannot assign requested address Is the server running on that host and accepting TCP/IP connections?

Flabenelli commented 1 week ago

I'm aware, but the db works and connects to the fronted, netbox works without the plugin. And the plugin it's installed since I see the add attachment box in netbox. But since I'm not able to run the migration command, when I try to upload something won't work.

In the docker compose instance, I have a container with postgres and the port 5432 open.

I guess the issue comes from the ::1 part, since this should be the ip of the postgres container isn't it? Is there some way to explicit the ip of the db?