From 5d7adafff1a0ce9ea5d754f1789a6baa72182ce9 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Fri, 22 Nov 2024 07:21:54 +0100 Subject: [PATCH] Fixes #440 - zammad-backup not working with postgres 17 (#441) * Fixes #440 - zammad-backup not working with postgres 17 * Improve test to fail for empty DB backups --- .env.dist | 2 +- .github/tests.sh | 63 ++++++++++++++++++---------------------------- docker-compose.yml | 2 +- 3 files changed, 27 insertions(+), 40 deletions(-) diff --git a/.env.dist b/.env.dist index 8543566b..d3c8d65c 100644 --- a/.env.dist +++ b/.env.dist @@ -15,7 +15,7 @@ # REDIS_VERSION=7.4.1-alpine # RESTART=always # Use a fixed version. You are responsible to update this to newer patch level versions yourself. -# VERSION=6.4.0-17 +# VERSION=6.4.0-26 # You can also use floating versions that will give you automatic updates: # VERSION=6.2 # all patchlevel updates # VERSION=6 # including minor updates diff --git a/.github/tests.sh b/.github/tests.sh index 00e61f77..84f0a6cd 100755 --- a/.github/tests.sh +++ b/.github/tests.sh @@ -6,55 +6,42 @@ set -o errexit set -o pipefail +# Send the logs to STDOUT for debugging. docker compose logs --timestamps --follow & -echo -echo "wait for zammad to be ready..." -echo +# Print empty lines before and after the heading to find it between the logs. +print_heading() { + echo ">" + echo "> $1" + echo ">" +} +print_heading "wait for zammad to be ready..." docker compose wait zammad-init curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:8080 | grep "Zammad" +print_heading "Success - Zammad is up :)" -echo -echo "Success - Zammad is up :)" -echo - -echo -echo "Execute autowizard..." -echo - +print_heading "Execute autowizard..." docker compose exec --env=AUTOWIZARD_RELATIVE_PATH=tmp/auto_wizard.json --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-railsserver bundle exec rake zammad:setup:auto_wizard +print_heading "Autowizard executed successfully :)" -echo -echo "Autowizard executed successful :)" -echo - -echo -echo "Check DB for AutoWizard user" -echo - +print_heading "Check DB for AutoWizard user" docker compose exec --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-railsserver bundle exec rails r "p User.find_by(email: 'info@zammad.org')" | grep 'info@zammad.org' +print_heading "Check DB for AutoWizard user successful :)" -echo -echo "Check DB for AutoWizard user successfull :)" -echo - -echo -echo "Fill DB with some random data" -echo - +print_heading "Fill DB with some random data" docker compose exec --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-railsserver bundle exec rails r "FillDb.load(agents: 1,customers: 1,groups: 1,organizations: 1,overviews: 1,tickets: 1)" +print_heading "DB fill successful :)" -echo -echo "DB fill successful :)" -echo - -echo -echo "Check if the Zammad user can write to FS storage" -echo - +print_heading "Check if the Zammad user can write to FS storage" docker compose exec zammad-railsserver touch storage/test.txt +print_heading "Storage write successful :)" + +print_heading "Check if zammad-backup created an application backup" +docker compose exec zammad-backup sh -c "find /var/tmp/zammad/ -name \"*zammad_files.tar.gz\" | grep ." +print_heading "Application backup successful :)" -echo -echo "Storage write successful :)" -echo +print_heading "Check if zammad-backup created a database backup" +# Check that the db dump actually has content in the .gz file to catch cases where pg_dump fails. +docker compose exec zammad-backup sh -c "find /var/tmp/zammad/ -name \"*zammad_db.psql.gz\" -size +100k | grep ." +print_heading "Database backup successful :)" diff --git a/docker-compose.yml b/docker-compose.yml index 848cab34..6a6387a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ x-shared: ZAMMAD_SESSION_JOBS: ZAMMAD_PROCESS_SCHEDULED: ZAMMAD_PROCESS_DELAYED_JOBS_WORKERS: - image: ${IMAGE_REPO:-ghcr.io/zammad/zammad}:${VERSION:-6.4.0-17} + image: ${IMAGE_REPO:-ghcr.io/zammad/zammad}:${VERSION:-6.4.0-26} restart: ${RESTART:-always} volumes: - zammad-storage:/opt/zammad/storage