pg_dump in directory format can't be done if extracted using docker exec #978
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#978
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
I was just curious and tried to test
pg_dumpfor #975.Steps to reproduce
docker run --name database -e POSTGRES_PASSWORD=password -d postgres/etc/borgmatic.d/postgres.yamlborgmatic -c /etc/borgmatic.d/postgres.yaml create -v2Actual behavior
The database tries to create dump in the database container, but borgmatic expects it in the local directory.
Expected behavior
The problem is not so simple, I don't expect anything.
Other notes / implementation ideas
Add a note about this behavior in the documentation.
borgmatic version
1.9.6
borgmatic installation method
self built package in a container
Borg version
1.4.0
Python version
Python 3.12.8
Database version (if applicable)
15.2
Operating system and version
alpine:3.21
Thanks for taking the time to file and describe this. Have you tried mounting the borgmatic runtime directory into the database container? See the docs here, which should be updated shortly with a correction about the runtime directory: https://torsion.org/borgmatic/docs/how-to/backup-your-databases/#containers
In my case this could be achieved by adding
-v /tmp/borgmatic:/tmp/borgmaticto thedocker runcommand and settinguser_runtime_directory: /tmp/borgmatic. I think this would work fine, but without it I can't extract the directory from the container.The configuration reference mentions
borgmatic_runtime_directoryonly in one place.borgmatic_source_directory:type: stringdescription: |Deprecated. Only used for locating database dumps and bootstrapmetadata within backup archives created prior to deprecation.Replaced by borgmatic_runtime_directory andborgmatic_state_directory. Defaults to ~/.borgmaticexample: /tmp/borgmaticuser_runtime_directory:type: stringdescription: |Path for storing temporary runtime data like streaming databasedumps and bootstrap metadata. borgmatic automatically creates anduses a "borgmatic" subdirectory here. Defaults to $XDG_RUNTIME_DIRor or $TMPDIR or $TEMP or /run/user/$UID.example: /run/user/1001I'm glad to hear it's working for you with a volume mount in place. The configuration file reference is unfortunately not exhaustive. It documents the individual options but not every use case of borgmatic. For that, the rest of the docs are needed. (Tangentially related: #942.) Please let me know though if there are any clarifications I can make to the docs so that this is easier for future users. Thanks!
I'd say that
7551810eshould explicitly mention that mounting the directory should be done when dumping the database in directory format. I have not experienced any problems when the format is custom.Good point! I forgot that non-directory-format dumps get conveniently exfiltrated from the database container via shell redirection. This is hopefully addressed now.