Skip to content

Commit

Permalink
Fixes #440 - zammad-backup not working with postgres 17 (#441)
Browse files Browse the repository at this point in the history
* Fixes #440 - zammad-backup not working with postgres 17
* Improve test to fail for empty DB backups
  • Loading branch information
mgruner authored Nov 22, 2024
1 parent d1f2406 commit 5d7adaf
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 25 additions & 38 deletions .github/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]')" | grep '[email protected]'
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 :)"
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5d7adaf

Please sign in to comment.