Automating Postgre Backups

If you are using Relstorage to store your Plone data in Postgre server, you'll appreciate this nifty container. With just few lines in your docker-compose.yml. you can kick start postgresql backups.

Just create a backup folder and set correct permissions with mkdir -p /opt/pgbackups && chown -R 999:999 /opt/pgbackups

pgbackups:
        image: prodrigestivill/postgres-backup-local
        restart: always
        user: postgres:postgres # Optional: see below
        volumes:
            - /opt/pgbackups:/backups
        depends_on:
            - db
        environment:
            - POSTGRES_HOST=db
            - POSTGRES_DB=plone
            - POSTGRES_USER=plone
            - POSTGRES_PASSWORD=plone
            - POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
            - SCHEDULE=@daily
            - BACKUP_KEEP_DAYS=7
            - BACKUP_KEEP_WEEKS=4
            - BACKUP_KEEP_MONTHS=6
            - HEALTHCHECK_PORT=8081

Full list of configuration options are available here: GitHub - prodrigestivill/docker-postgres-backup-local: Backup PostgresSQL to local filesystem with periodic backups and rotate backups.

2 Likes