pg_dump_command: need detailed explanation #1020
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1020
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Configure
pg_dump_commandto dump from the PostgreSQL container, since I can't update the PostgreSQL client.Steps to reproduce
First attempt, exactly as in the documentation:
Second attempt, with attaching my configuration directory (I am using borgmatic.d)
Third attempt, with attaching the directory with the default configuration location:
And so on, I also tried with
~/.pgpassinhost, in thecontainer, still no success.Actual behavior
Expected behavior
backup without error
Other notes / implementation ideas
I finally started debugging this configuration and found that all I had to do was do it this way to make it work:
In my opinion, the documentation needs to explain in more detail how the password is passed to the tool (environment variable) and, for the docker example, add passing this environment variable through this option
-e PGPASSWORD.borgmatic version
1.9.13
borgmatic installation method
pipx install borgmatic
Borg version
1.4.0
Python version
3.11.4
Database version (if applicable)
17.3
Operating system and version
Ubuntu 23.04
Thanks for bringing this to my attention! I'm glad to hear you've got things working on your system now, but I'm not sure why it wasn't working to begin with. For instance, when I run a PostgreSQL container like this:
... and then exec into it like this:
... then I get the full database dump without being prompted for a password. Which is similar to the series of steps that borgmatic does when configured with
pg_dump_command: docker exec postgresql pg_dump. My understanding is that the database password is not needed because exec-ing in bypasses that. From the docs:So I'm not sure what's going wrong on your system. Can I get a look at the error you get when
docker exec ...is configured in borgmatic? And what about exec-ing in and runningpg_dumpmanually? Also, are you settingPOSTGRES_PASSWORDwhen creating your PostgreSQL container?I don't have a postgres container locally. I connect to a database on another server. However, I need to use the postgres container with the pg_dump client to connect to that database.
Ah okay that makes more sense! I'll see if I can work this use case into the documentation.
Okay, I attempted to document this use case here:
https://torsion.org/borgmatic/docs/how-to/backup-your-databases/#containers
Those new docs should get deployed shortly.
Thanks for the suggestion!