added postgres vars to backup

This commit is contained in:
André Bauer 2018-05-07 18:28:17 +02:00
parent c5855a7e01
commit a29eb5bd89

View File

@ -4,6 +4,10 @@ set -e
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
: "${ZAMMAD_RAILSSERVER_PORT:=3000}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}"
: "${POSTGRES_USER:=postgres}"
: "${POSTGRES_HOST:=zammad-postgresql}"
: "${POSTGRES_PORT:=5432}"
: "${POSTGRES_DB:=zammad_production}"
function check_railsserver_available { function check_railsserver_available {
until (echo > /dev/tcp/${ZAMMAD_RAILSSERVER_HOST}/${ZAMMAD_RAILSSERVER_PORT}) &> /dev/null; do until (echo > /dev/tcp/${ZAMMAD_RAILSSERVER_HOST}/${ZAMMAD_RAILSSERVER_PORT}) &> /dev/null; do
@ -28,7 +32,7 @@ function zammad_backup {
fi fi
#db backup #db backup
pg_dump --dbname=postgresql://postgres@zammad-postgresql:5432/zammad_production | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz pg_dump --dbname=postgresql://${POSTGRES_USER}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz
} }
if [ "$1" = 'zammad-backup' ]; then if [ "$1" = 'zammad-backup' ]; then