Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error captured when pg_dump fails - backup logged as successful and no notifications #366

Open
beyerleinf opened this issue Sep 4, 2024 · 0 comments
Labels

Comments

@beyerleinf
Copy link

Summary

When the pg_dump command fails (as seen in the logs), the exit code seems to be ignored the the logs indicate that the backup was successful.

Steps to reproduce

I set a wrong username on purpose to test the notifications, then I ran backup-now in the container and observed that the backup was falsely reported as successful.

What is the expected correct behavior?

The backup should fail and a notification should be sent.

Relevant logs and/or screenshots

Logs
2024-09-04.12:57:02 [NOTICE] /etc/services.available/dbbackup-01/run ** [01-db-pg16__umami] Dumping PostgresSQL database: 'umami' and compressing with 'gzip:3' with '16' threads
<omitted for brevity>
+ run_as_user pg_dump -h db-pg16 -p 5432 -U something umami
+ sudo -Eu dbbackup pg_dump -h db-pg16 -p 5432 -U something umami
+ pigz -q -3 -p 16 --rsyncable
+ run_as_user tee /tmp/backups/01_dbbackup.JWZfw8/pgsql_umami_db-pg16_20240904-125702.sql.gz
+ sudo -Eu dbbackup tee /tmp/backups/01_dbbackup.JWZfw8/pgsql_umami_db-pg16_20240904-125702.sql.gz
pg_dump: error: connection to server at "db-pg16" (172.27.0.3), port 5432 failed: FATAL:  password authentication failed for user "something"
+ exit_code=0
+ var_true ''
+ '[' '' = true ']'
+ '[' '' = yes ']'
+ check_exit_code backup pgsql_umami_db-pg16_20240904-125702.sql.gz
+ var_true ''
+ '[' '' = true ']'
+ '[' '' = yes ']'
+ case "${1}" in
+ write_log debug 'DB Backup exit Code is 0'
+ var_true ''
+ '[' '' = true ']'
+ '[' '' = yes ']'
+ output_off
+ '[' true = true ']'
+ set +x
2024-09-04.12:57:02 [DEBUG] /etc/services.available/dbbackup-01/run ** [01-db-pg16__umami] DB Backup exit Code is 0

Environment

docker-compose.yml
  db-backup:
    image: tiredofit/db-backup
    environment:
      TIMEZONE: "Europe/Berlin"
      MODE: "MANUAL"
      DEBUG_MODE: true
      MANUAL_RUN_FOREVER: false
      CONTAINER_ENABLE_SCHEDULING: false
      CONTAINER_ENABLE_MONITORING: false
      BACKUP_JOB_CONCURRENCY: 1
      DEFAULT_COMPRESSION: "GZ"
      DEFAULT_GZ_RSYNCABLE: true
      DEFAULT_S3_BUCKET: ${S3_BUCKET_NAME}
      DEFAULT_S3_KEY_ID: ${S3_BUCKET_KEY_ID}
      DEFAULT_S3_KEY_SECRET: ${S3_BUCKET_KEY_SECRET}
      DEFAULT_S3_REGION: ${S3_BUCKET_REGION}
      DEFAULT_S3_HOST: ${S3_BUCKET_HOST}
      ENABLE_NOTIFICATIONS: true
      NOTIFICATION_TYPE: "MATRIX"
      MATRIX_HOST: ${MATRIX_HOST}
      MATRIX_ROOM: ${MATRIX_ROOM}
      MATRIX_ACCESS_TOKEN: ${MATRIX_ACCESS_TOKEN}
      DB01_TYPE: "pgsql"
      DB01_HOST: "db-pg16"
      DB01_NAME: "umami"
      DB01_SPLIT_DB: true
      DB01_BACKUP_LOCATION: "S3"
      DB01_USER: something # this is wrong on purpose
      DB01_PASS: ${DB_PASSWORD}
      DB01_S3_PATH: "db/umami"
      DB01_CLEANUP_TIME: 40320 # 28 days
    networks:
      - umami
  • Image version / tag: latest
  • Host OS: unRAID
@beyerleinf beyerleinf added the bug label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant