Merge pull request #2 from mandlm/postgres

feat: add postgres backup option
This commit is contained in:
mandlm 2022-10-06 17:19:11 +02:00 committed by GitHub
commit e24093769c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,6 @@
FROM debian 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 ARG CLIENT_VERSION

View File

@ -2,9 +2,9 @@
BACKUP_DIR="/backup/database" BACKUP_DIR="/backup/database"
echo "Starting to backup database" echo "Starting to backup mysql database"
mkdir --parents $BACKUP_DIR 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 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 if [[ -n "$DO_MYSQL_BACKUP" ]]; then
sh /usr/local/etc/urbackup/mysql_backup.sh sh /usr/local/etc/urbackup/mysql_backup.sh
fi fi
if [[ -n "$DO_POSTGRES_BACKUP" ]]; then
sh /usr/local/etc/urbackup/postgres_backup.sh
fi