canonical / postgresql-operator

A Charmed Operator for running PostgreSQL on machines
https://charmhub.io/postgresql
Apache License 2.0
8 stars 19 forks source link

Can't use pg_dump or pg_restore with db unit host #241

Closed omar-selo closed 11 months ago

omar-selo commented 11 months ago

Steps to reproduce

  1. Deploy postgresql 14/candidate charm
  2. juju ssh into the charm
  3. Try to run pg_dump through charmed-postgresql.pg-dump and pass --host <unit-host> and use the operator user (as relation user doesn't work)

Expected behavior

I expected it to actually create a dump. In the case of pg_restore I expect it to actually import a dump.

Actual behavior

I get the following output with -v option:

pg_restore: connecting to database for restore
pg_restore: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

Note that this works if we use --host /tmp instead.

Versions

Operating system: Ubuntu 22.04.3 LTS in the postgresql unit

Juju CLI: 2.9.45-ubuntu-amd64

Juju agent: 2.9.44

Charm revision: 326

LXD: 4.0.9

Log output

Can't get juju logs but they're probably irrelevant.

Additional context

Original MM discussion https://chat.charmhub.io/charmhub/pl/fsuw5cc4aibkxf4itixc9zhy4e

github-actions[bot] commented 11 months ago

https://warthogs.atlassian.net/browse/DPE-2721

dragomirp commented 11 months ago

Latest edge (rev. 333) should solve this.