netbox-community / netbox-docker

🐳 Docker Image of NetBox
https://github.com/netbox-community/netbox-docker/wiki
Apache License 2.0
1.74k stars 805 forks source link

psycopg connection issue #1178

Closed sergey-kalikin-adjust closed 4 months ago

sergey-kalikin-adjust commented 4 months ago

Desired Behavior

My test stand has postgresql and redis running as Docker containers (docker.io/postgres:16-alpine and docker.io/redis:7-alpine). Netbox is installed in k8s via helm chart that is using netboxcommunity/netbox images. Netbox containers connect to external redis and postgresql fine. Migrations are working. App is running.

Contrast to Current Behavior

In my case when trying to start a container migration check fails:

django.db.utils.OperationalError: connection failed: %IP%), port 5432 failed: server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

At the same time if I telnet or psql to db from the same host (or even ./manage.py dbshell) it is working fine.

Required Changes

If going inside the container, activating venv and upgrading psycopg from 3.1.16 to 3.1.18 only then ./manage migrate start's working. Please bump the version in requirements-container.txt

Discussion: Benefits and Drawbacks

Why is it different from requirements.txt anyway?

tobiasge commented 4 months ago

We changed the dependency because Netbox uses the binary install and not the compiled version. But there is a PR to change that: https://github.com/netbox-community/netbox/pull/15468 Then we will remove the extra dependency from the image. The next release will contain version 3.1.18 (it's already in the develop branch).

sergey-kalikin-adjust commented 4 months ago

@tobiasge thanks! Are you talking about the next release of Netbox, that is v4.0? Or you are talking about the next netbox-docker release that might be before that?