prodrigestivill / docker-postgres-backup-local

Backup PostgresSQL to local filesystem with periodic backups and rotate backups.
https://hub.docker.com/r/prodrigestivill/postgres-backup-local
MIT License
806 stars 137 forks source link

I have deployed it just now, dose it work? #155

Closed Yumega closed 2 months ago

Yumega commented 2 months ago

no file backuped, the container logs

stderr: 2024/08/24 18:00:28 Running version: v0.0.10
stderr: 2024/08/24 18:00:28 new cron: @weekly
stderr: 2024/08/24 18:00:28 Opening port 8085 for health checking
stderr: 2024/08/25 00:00:00 530: mkdir: cannot create directory ‘/backups/last/’: Permission denied
stderr: mkdir: cannot create directory ‘/backups/daily/’: Permission denied
stderr: 2024/08/25 00:00:00 530: mkdir: cannot create directory ‘/backups/weekly/’: Permission denied
stderr: mkdir: cannot create directory ‘/backups/monthly/’: Permission denied
stderr: 2024/08/25 00:00:00 530 Exit Status: 1
stdout: 
stdout: PostgreSQL Database directory appears to contain a database; Skipping initialization
stdout: 
stderr: 2024-08-24 18:00:28.165 UTC [1] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
stderr: 2024-08-24 18:00:28.165 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
stderr: 2024-08-24 18:00:28.165 UTC [1] LOG:  listening on IPv6 address "::", port 5432
stderr: 2024-08-24 18:00:28.169 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
stderr: 2024-08-24 18:00:28.175 UTC [29] LOG:  database system was shut down at 2024-08-24 18:00:26 UTC
stderr: 2024-08-24 18:00:28.183 UTC [1] LOG:  database system is ready to accept connections
stderr: 2024-08-24 18:05:28.273 UTC [27] LOG:  checkpoint starting: time
stderr: 2024-08-24 18:05:28.291 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.004 s, sync=0.002 s, total=0.018 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/19536C0, redo lsn=0/1953688
Yumega commented 2 months ago
version: '2'
services:
    postgres:
        image: postgres
        restart: always
        environment:
            - POSTGRES_DB=database
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=h666p2
    pgbackups:
        image: prodrigestivill/postgres-backup-local
        restart: always
        user: postgres:postgres 
        volumes:
            - /mnt/sdb1/immich/pgbackups:/backups
        links:
            - postgres
        depends_on:
            - postgres
        environment:
            - POSTGRES_HOST=postgres
            - POSTGRES_DB=database
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=h666p2
            - POSTGRES_EXTRA_OPTS=-Z1 --schema=public --blobs
            - SCHEDULE=@weekly
            - BACKUP_KEEP_DAYS=5
            - BACKUP_KEEP_WEEKS=2
            - BACKUP_KEEP_MONTHS=4
            - HEALTHCHECK_PORT=8085
prodrigestivill commented 2 months ago

did you wait for a full week or tried with a lower SCHEDULE?

Yumega commented 2 months ago

did you wait for a full week or tried with a lower SCHEDULE?

thank you, it works now