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
826 stars 140 forks source link

Error: aborting because of server version mismatch #63

Closed loganbonsignore closed 3 years ago

loganbonsignore commented 3 years ago

I would like to use the 'latest' postgres docker image for my application. At the time of this post it is postgres version '14.0'. Backups are not successful and my 'postgres-backup' shows this error:

2021/10/24 22:58:28 13 Exit Status: 1
2021/10/24 22:58:48 24 cmd: /backup.sh 
2021/10/24 22:58:48 24: Creating dump of kylin_parachain database from db...
2021/10/24 22:58:48 24: pg_dump: error: server version: 14.0 (Debian 14.0-1.pgdg110+1); pg_dump version: 13.2 (Debian 13.2-1.pgdg100+1)
pg_dump: error: aborting because of server version mismatch
2021/10/24 22:58:48 24 Exit Status: 1

When I use the '13.2' postgres image, everything works great. Is it possible to use the 'latest' postgres version in my compose file or do I need to pick one postgres version and stick with it? Here is my compose file.

  postgres:
    environment: 
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: kylin_parachain
    image: postgres:latest
    ports:
      - 5433:5432
    restart: always
    container_name: postgres
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
      - ./schemas.sql:/docker-entrypoint-initdb.d/schemas.sql
  postgres-backups:
    image: prodrigestivill/postgres-backup-local
    depends_on:
      - postgres
    restart: always
    user: postgres:postgres
    container_name: postgres-backups
    environment:
      POSTGRES_HOST: postgres
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: kylin_parachain
      SCHEDULE: "@every 20s"
      BACKUP_KEEP_DAYS: 7
      BACKUP_KEEP_WEEKS: 4
      BACKUP_KEEP_MONTHS: 6
      HEALTHCHECK_PORT: 8080
    volumes:
      - ./postgres-backups:/backups
prodrigestivill commented 3 years ago

Using the tag latest of this project is not recommended. Also keep in mind that using the tag latest of any component for a production environment could lead to future problems in general.

In any case, this looks like a duplicate issue of #62