-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: allow custom container name for Postgres backups; misc. cleanu…
…p of backup scripts
- Loading branch information
1 parent
0d17aa8
commit bff927c
Showing
5 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
support/containers/volumes/backups/postgres/backup-restore-inside-container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
show_help() { | ||
echo "Lists available backups inside the Postgres container directory '/var/lib/postgresql/backups/'." | ||
echo "Lists available backups inside the Postgres container directory '/var/lib/postgresql/backups/'. | ||
This script accepts the following environment variable(s): | ||
- POSTGRES_VOLUME_NAME: The name of the Postgres volume to be restored | ||
- Default: 'phoenix-todo-list_postgres' | ||
This script accepts the following positional arguments: | ||
--podman - When passed as the last positional argument, use Podman instead of Docker" | ||
} | ||
|
||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | ||
show_help | ||
exit | ||
elif [ "$1" = "--docker" ]; then | ||
container_program=docker | ||
fi | ||
|
||
if [ "$1" = "--podman" ]; then | ||
container_manager=podman | ||
else | ||
container_program=podman | ||
container_manager=docker | ||
fi | ||
|
||
printf "Listing available backups in Postgres container volume directory '/var/lib/postgresql/backups/'...\n\n" | ||
|
||
$container_program exec -it postgres sh -c 'cd /var/lib/postgresql/backups/ && ls *.dump' | ||
$container_manager exec -it phoenix-todo-list_postgres sh -c 'cd /var/lib/postgresql/backups/ && ls *.dump' |