feat: add postgres backup option

This commit is contained in:
mandlm 2022-10-06 17:07:05 +02:00
parent 64bf6cc38f
commit 0852cb8c00
Signed by: mandlm
GPG Key ID: 4AA25D647AA54CC7
4 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,6 @@
FROM debian
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp mariadb-client
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget lftp mariadb-client postgresql-client
ARG CLIENT_VERSION

View File

@ -2,9 +2,9 @@
BACKUP_DIR="/backup/database"
echo "Starting to backup database"
echo "Starting to backup mysql database"
mkdir --parents $BACKUP_DIR
mysqldump --single-transaction --host=$MYSQL_BACKUP_HOST --user=$MYSQL_BACKUP_USER --password=$MYSQL_BACKUP_PASSWORD $MYSQL_BACKUP_DATABASE > $BACKUP_DIR/$MYSQL_BACKUP_DATABASE.sqldump
echo "Database backup finished"
echo "Mysql database backup finished"

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
BACKUP_DIR="/backup/database"
echo "Starting to backup postgres database"
mkdir --parents $BACKUP_DIR
PGPASSWORD=$PG_PASSWORD pg_dump --host=$PG_HOST --username=$PG_USER $PG_DATABASE > $BACKUP_DIR/$PG_DATABASE.sqldump
echo "Postgres database backup finished"

View File

@ -7,3 +7,7 @@ fi
if [[ -n "$DO_MYSQL_BACKUP" ]]; then
sh /usr/local/etc/urbackup/mysql_backup.sh
fi
if [[ -n "$DO_POSTGRES_BACKUP" ]]; then
sh /usr/local/etc/urbackup/postgres_backup.sh
fi