From 5b57e48156663655f54c443ef6cdbd80fa319c87 Mon Sep 17 00:00:00 2001 From: Gitouche <26656-gitouche@users.noreply.framagit.org> Date: Sat, 9 Dec 2023 23:09:13 +0100 Subject: [PATCH] passwordless backups for all --- podman-framadate/60_db_dump.sh | 13 +++++++++++++ podman-gitea/60_db_dump.sh | 15 +++++++++++++++ podman-matrix/60_db_dump.sh | 15 +++++++++++++++ podman-seafile/60_db_dump.sh | 13 +++++++++++++ 4 files changed, 56 insertions(+) create mode 100755 podman-framadate/60_db_dump.sh create mode 100755 podman-gitea/60_db_dump.sh create mode 100755 podman-matrix/60_db_dump.sh create mode 100755 podman-seafile/60_db_dump.sh diff --git a/podman-framadate/60_db_dump.sh b/podman-framadate/60_db_dump.sh new file mode 100755 index 0000000..9ab03ce --- /dev/null +++ b/podman-framadate/60_db_dump.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_not_root +ensure_scriptdir_equals_user + +# pod should exist +ensure_pod_exists "${pod_name}" + +podman exec framadate-db /bin/bash -c '/usr/bin/mysqldump -uroot --password=${MYSQL_ROOT_PASSWORD} --all-databases' diff --git a/podman-gitea/60_db_dump.sh b/podman-gitea/60_db_dump.sh new file mode 100755 index 0000000..f62f073 --- /dev/null +++ b/podman-gitea/60_db_dump.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_not_root +ensure_scriptdir_equals_user + +# pod should exist +ensure_pod_exists "${pod_name}" + +db=${1} + +podman exec gitea-db /bin/bash -c "PGPASSWORD=\${POSTGRES_PASSWORD} pg_dump -w -F t -U \${POSTGRES_USER} ${db}" diff --git a/podman-matrix/60_db_dump.sh b/podman-matrix/60_db_dump.sh new file mode 100755 index 0000000..8215df1 --- /dev/null +++ b/podman-matrix/60_db_dump.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_not_root +ensure_scriptdir_equals_user + +# pod should exist +ensure_pod_exists "${pod_name}" + +db=${1} + +podman exec synapse-db /bin/bash -c "PGPASSWORD=\${POSTGRES_PASSWORD} pg_dump -w -F t -U \${POSTGRES_USER} ${db}" diff --git a/podman-seafile/60_db_dump.sh b/podman-seafile/60_db_dump.sh new file mode 100755 index 0000000..1f921f5 --- /dev/null +++ b/podman-seafile/60_db_dump.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +ABSDIR="$( dirname "$(readlink -f -- "$0")" )" +source ${ABSDIR}/../functions.sh +source ${ABSDIR}/vars.sh + +ensure_not_root +ensure_scriptdir_equals_user + +# pod should exist +ensure_pod_exists "${pod_name}" + +podman exec seafile-db /bin/bash -c '/usr/bin/mysqldump -uroot --password=${MYSQL_ROOT_PASSWORD} --all-databases'