Table of Contents
Backup and restore
DipDup has no built-in functionality to backup and restore database at the moment. Good news is that DipDup indexes are fully atomic. That means you can perform backup with regular psql
/pgdump
regardless of the DipDup state.
This page contains several recipes for backup/restore.
Scheduled backup to S3
This example is for Swarm deployments. We use this solution to backup our services in production. Adapt it to your needs if needed.
version: "3.8"
services:
indexer:
...
db:
...
hasura:
...
backuper:
image: ghcr.io/dipdup-io/postgres-s3-backup:master
environment:
- S3_ENDPOINT=${S3_ENDPOINT:-https://fra1.digitaloceanspaces.com}
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID}
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
- S3_BUCKET=dipdup
- S3_PATH=dipdup
- S3_FILENAME=${SERVICE}-postgres
- PG_BACKUP_FILE=${PG_BACKUP_FILE}
- PG_BACKUP_ACTION=${PG_BACKUP_ACTION:-dump}
- PG_RESTORE_JOBS=${PG_RESTORE_JOBS:-8}
- POSTGRES_USER=${POSTGRES_USER:-dipdup}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme}
- POSTGRES_DB=${POSTGRES_DB:-dipdup}
- POSTGRES_HOST=${POSTGRES_HOST:-db}
- HEARTBEAT_URI=${HEARTBEAT_URI}
- SCHEDULE=${SCHEDULE}
deploy:
mode: replicated
replicas: ${BACKUP_ENABLED:-0}
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
window: 120s
placement: *placement
networks:
- internal
logging: *logging
Help and tips -> Join our Discord
Ideas or suggestions -> Issue Tracker
GraphQL IDE -> Open Playground