kartoza / docker-pg-backup

A cron job that will back up databases running in a docker postgres container
GNU General Public License v2.0
452 stars 103 forks source link

Backup service unavailable #67

Closed ghost closed 1 year ago

ghost commented 2 years ago

Use version:v12.0

$ docker logs -f --tail 1000 postgis-dbbackups-1
psql: error: could not connect to server: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Start script running with these environment options
DUMPPREFIX=PG_db
PG_ENV=/pgenv.sh
ghost commented 2 years ago

my script:

---
version: '3.8'
services:
  db:
    image: kartoza/postgis:12.0
    environment:
      # If you need to create multiple database you can add coma separated databases eg gis,data
      - POSTGRES_DB=gis
      - POSTGRES_USER=postgres
      - POSTGRES_PASS=admin@123
      - ALLOW_IP_RANGE=0.0.0.0/0
      # Add extensions you need to be enabled by default in the DB. Default are the five specified below
      - POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology,postgis_raster,pgrouting
    ports:
      - "35432:5432"
    restart: always
    volumes:
      - /data/postgis/data:/var/lib/postgresql
      - /data/postgis/backups:/backups
    healthcheck:
      test: "exit 0"

  dbbackups:
    image: kartoza/pg-backup:12.0
    hostname: pg-backups
    volumes:
      - /data/postgis/backups:/backups
    environment:
      - DUMPPREFIX=PG_db
      - POSTGRES_USER=postgres
      - POSTGRES_PASS=admin@123
      - POSTGRES_PORT=5432
      - POSTGRES_HOST=db
    restart: always
    depends_on:
      db:
        condition: service_healthy
NyakudyaA commented 2 years ago

This should be reported in the backup repo

techpet commented 1 year ago

Any news on this? Having the same problem as @freemankevin reported.

 postgis:
        image: kartoza/postgis:12.4
        container_name: postgis_${ENVIRONMENT}
        restart: always
        env_file:
            - .env
        environment:
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_PASS=${POSTGRES_PASS}
            - POSTGRES_DBNAME=${POSTGRES_DBNAME}
        expose: 
            - 5432
        volumes:
            - "./${POSTGRES_VOLUME}:/var/lib/postgresql"
        healthcheck:
            test: "PGPASSWORD=${POSTGRES_PASS} pg_isready -h 127.0.0.1 -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"
dbbackups:
        image: kartoza/pg-backup:12.0
        volumes:
        - ./db-backups:/backups
        env_file:
        - .env
        environment:
        - DUMPPREFIX=PG_gis
        - POSTGRES_HOST=postgis
        - POSTGRES_DBNAME=${POSTGRES_DBNAME}
        - POSTGRES_USER=${POSTGRES_USER}
        - POSTGRES_PASS=${POSTGRES_PASS}
        - POSTGRES_PORT=5432
        #- CRON_SCHEDULE="*/5 * * * *"
        restart: on-failure
        depends_on:
          postgis:
            condition: service_healthy
NyakudyaA commented 1 year ago

I suggest you clone the repo and build a local image using the specific version you need, if I get chance will build a new image and upload to hub

ghost commented 1 year ago

It is urgently needed, and the arm environment also encounters similar problems. That backup service is basically a decoration.

NyakudyaA commented 1 year ago

@freemankevin Are you using version 12.4 as well ?

NyakudyaA commented 1 year ago

Image kartoza/pg-backup:12.4 available on the hub

ghost commented 1 year ago

The currently used version span range: 12.x~14.x

ghost commented 1 year ago

Image kartoza/pg-backup:12.4 available on the hub

Thanks, I'll test it out when I have time.