resticker-pg/README.md

41 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2025-03-01 06:32:03 +00:00
# resticker-pg
An adapted [resticker](https://github.com/djmaze/resticker) Docker image built
with a PostgreSQL client and pg_dump helper script to safely backup PostgreSQL
databases without having to mount `docker.sock`.
# Usage
Make sure to set the following environment variables:
- `DB_HOSTNAME`
- `DB_USERNAME`
- `DB_PASSWORD`
`DB_PORT` can be used to set a non-standard database port.
This image is a drop-in replacement for resticker, and therefore will not
attempt to dump a database (even if environment variables are provided) unless
the script is explicitly called.
The database dump script is copied to `/usr/local/bin/dump_pg_db.sh`. To use it,
add the following to the container's environment:
```yaml
environment:
# ...
PRE_COMMANDS: |-
/usr/local/bin/dump_pg_db.sh
# ...
```
The resulting dump is written to `/data/db/DATABASE_NAME.sql` within
the container.
# Credits
Base Dockerfile from https://github.com/djmaze/resticker [Apache-2.0 License]
Postgres backup/dump script adapted from https://github.com/ixc/restic-pg-dump-docker
[MIT License]
# License
This project is licensed under the MIT license.
See [LICENSE](LICENSE).