netbox-docker icon indicating copy to clipboard operation
netbox-docker copied to clipboard

add psql client for dbshell

Open ryanmerolle opened this issue 2 years ago • 3 comments

Related Issue: #817

New Behavior

Fixes dbshell

Contrast to Current Behavior

dbshell no longer works with new image

Discussion: Benefits and Drawbacks

Working dbshell

Changes to the Wiki

N/A

Proposed Release Note Entry

Update image to include psql client to fix dbshell access in netbox container.

Double Check

  • [X] I have read the comments and followed the PR template.
  • [X] I have explained my PR according to the information in the comments.
  • [X] My PR targets the develop branch.

ryanmerolle avatar Aug 03 '22 14:08 ryanmerolle

something up with the github actions?

ryanmerolle avatar Aug 03 '22 14:08 ryanmerolle

For some reason postgresql-client pulls in a bunch of perl requirements. Which ware definitely not needed for Netbox. So I'm hesitant to merge this. @cimnine What do you think? If we wan't to merge, this should target develop and not release.

tobiasge avatar Aug 05 '22 20:08 tobiasge

hmm I meant to set a PR for develop and not release. My bad.

ryanmerolle avatar Aug 05 '22 20:08 ryanmerolle

With our compose-based setup one can access the database client psql easily through docker compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'. Personally, I don't see the need for postgres-client in the container when it's not required to run NetBox.

cimnine avatar Aug 30 '22 13:08 cimnine

With our compose-based setup one can access the database client psql easily through docker compose exec postgres sh -c 'psql -U $POSTGRES_USER $POSTGRES_DB'. Personally, I don't see the need for postgres-client in the container when it's not required to run NetBox.

I agree with you, but it breaks docker compose run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py dbshell

✅ Initialisation is done.
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
CommandError: You appear not to have the 'psql' program installed or on your path.

ryanmerolle avatar Aug 30 '22 15:08 ryanmerolle

It's true, but that's just a shortcut into the psql shell anyway, isn't it?

cimnine avatar Aug 30 '22 15:08 cimnine

fair enough, we could just add a blurb on the wiki

ryanmerolle avatar Aug 31 '22 01:08 ryanmerolle

Added an explanation to the wiki.

tobiasge avatar Aug 31 '22 11:08 tobiasge