Skip to content

Commit

Permalink
Follow-up: cb6a82d - Repair and improve zammad-backup. (zammad#370)
Browse files Browse the repository at this point in the history
- Switch back to postgres container for zammad-backup
- Add command passthrough for more convenient container usage/testing
- Add default value handling for HOLD_DAYS variable
  • Loading branch information
mgruner authored and floriankessler committed Jan 5, 2024
1 parent b793440 commit cd2d7f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ x-shared:
services:

zammad-backup:
<<: *zammad-service
command: ["zammad-backup"]
depends_on:
- zammad-railsserver
Expand All @@ -38,6 +37,8 @@ services:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- zammad-backup:/var/tmp/zammad
- zammad-var:/opt/zammad/var:ro
Expand Down
10 changes: 6 additions & 4 deletions scripts/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
: "${ZAMMAD_DIR:=/opt/zammad/var}"
: "${BACKUP_DIR:=/var/tmp/zammad}"
: "${BACKUP_TIME:=03:00}"
: "${HOLD_DAYS:=10}"
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
: "${ZAMMAD_RAILSSERVER_PORT:=3000}"
: "${POSTGRESQL_DB:=zammad_production}"
Expand Down Expand Up @@ -57,16 +58,17 @@ if [ "$1" = 'zammad-backup' ]; then

sleep $((NEXT_TIMESTAMP - NOW_TIMESTAMP))
done
fi

if [ "$1" = 'zammad-backup-once' ]; then
elif [ "$1" = 'zammad-backup-once' ]; then
check_railsserver_available

zammad_backup
fi

if [ "$1" = 'zammad-backup-db' ]; then
elif [ "$1" = 'zammad-backup-db' ]; then
NO_FILE_BACKUP="yes"

zammad_backup

else
exec "$@"
fi

0 comments on commit cd2d7f1

Please sign in to comment.