Skip to content

Database backup errors goes unnoticed #417

@alteriks

Description

@alteriks

Summary

I've been playing with docker-db-backup and I've noticed that pg_dump error is masked when passing wrong password to docker-db-backup container

Steps to reproduce

Use this docker-compose.yml, it's mostly verbatim ./examples/compose.yml
Notable changes are

services:
  example-db:
    hostname: example-postgres-host
    container_name: example-db
    image: postgres:16
    ports:
      - 3306:3306
    volumes:
      - ./db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=example
      - POSTGRES_PASSWORD=examplepassword
    restart: always
    networks:
      - example-db-network

  example-db-backup:
    container_name: example-db-backup
    image: tiredofit/db-backup
    volumes:
      - ./backups:/backup
    environment:
      - TIMEZONE=America/Vancouver
      # - TIMEZONE=Europe/Warsaw
      - CONTAINER_NAME=example-db-backup
      - CONTAINER_ENABLE_MONITORING=FALSE
      # - DEBUG_MODE=TRUE

      - BACKUP_JOB_CONCURRENCY=1 # Only run one job at a time
      - DEFAULT_CHECKSUM=NONE # Don't create checksums
      - DEFAULT_COMPRESSION=ZSTD # Compress all with ZSTD
      - DEFAULT_BACKUP_INTERVAL=1440 # Backup every 1440 minutes
      - DEFAULT_BACKUP_BEGIN=0000 # Start backing up at midnight
      - DEFAULT_CLEANUP_TIME=8640 # Cleanup backups after a week

      - DB01_TYPE=postgres
      - DB01_HOST=example-postgres-host
      - DB01_NAME=example
      - DB01_USER=example
      - DB01_PASS=examplepassword
      - DB01_BACKUP_INTERVAL=60 # (override) Backup every 60 minutes
      - DB01_BACKUP_BEGIN=+1 # (override) Backup starts in ten minutes
      - DB01_CLEANUP_TIME=240 # (override) Cleanup backups they are older than 240 minutes
      - DB01_CHECKSUM=MD5 # (override) Create a SHA1 checksum
      - DB01_COMPRESSION=BZ # (override) Compress with BZIP

    restart: always
    networks:
      - example-db-network

networks:
  example-db-network:
    name: example-db-network

OK: Image

What is the expected correct behavior?

All errors should be marked as errors and not masked as success

Relevant logs and/or screenshots

executing pg_dump with wrong password inside container produces error and exitcode=1
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions