# RasterizedDB with continuous backup to S3-compatible object storage, here a # RustFS container beside it. Copy .env.example to .env first. # # To back up to AWS S3 or another provider instead, delete the `rustfs` and # `buckets` services and the depends_on block, and set the AWS_* variables # and the bucket in .env to your provider's (see README.md). name: rasterizeddb-s3 services: # S3-compatible object storage (https://github.com/rustfs/rustfs). rustfs: image: rustfs/rustfs:1.0.6 environment: RUSTFS_ACCESS_KEY: ${S3_ACCESS_KEY:?set S3_ACCESS_KEY in .env} RUSTFS_SECRET_KEY: ${S3_SECRET_KEY:?set S3_SECRET_KEY in .env} volumes: - s3data:/data # The S3 API (9000) and console (9001) stay on the project network. # Publish "127.0.0.1:9001:9001" to open the console from this machine. restart: unless-stopped healthcheck: test: ["CMD", "curl", "-fsS", "http://127.0.0.1:9000/health/ready"] interval: 5s timeout: 5s retries: 24 # Creates the backup bucket if it is missing, then exits. buckets: image: rustfs/rustfs:1.0.6 entrypoint: ["/bin/sh", "-c"] command: - rc bucket create "local/$$BUCKET" --ignore-existing environment: BUCKET: ${BACKUP_BUCKET:-rasterizeddb-backup} RC_CONFIG_DIR: /tmp RC_HOST_local: http://${S3_ACCESS_KEY}:${S3_SECRET_KEY}@rustfs:9000 depends_on: rustfs: condition: service_healthy restart: "no" rasterizeddb: image: ${RASTERIZEDDB_IMAGE:-milendenev/rasterizeddb:1.1.0} environment: RASTERIZEDDB_PG_PASSWORD: ${RASTERIZEDDB_PG_PASSWORD:?set RASTERIZEDDB_PG_PASSWORD in .env} # Read by the server's S3 client: kept out of its command line. AWS_ACCESS_KEY_ID: ${S3_ACCESS_KEY} AWS_SECRET_ACCESS_KEY: ${S3_SECRET_KEY} AWS_REGION: ${S3_REGION:-us-east-1} AWS_ENDPOINT_URL: ${S3_ENDPOINT:-http://rustfs:9000} command: - --s3-bucket - ${BACKUP_BUCKET:-rasterizeddb-backup} - --s3-prefix - ${BACKUP_PREFIX:-main} # RustFS and MinIO need path-style addressing. Remove for AWS S3. - --s3-path-style # How much recent history a lost host can lose, in seconds. - --s3-wal-flush-secs - "60" # A full snapshot a day, the last 7 kept. - --s3-snapshot-interval-secs - "86400" - --s3-retain-snapshots - "7" # Start even when the bucket does not answer (after a host reboot, # RustFS may come up second); the log is held locally until it does. - --s3-start-offline - --log-level - warn ports: - "127.0.0.1:5432:5432" - "127.0.0.1:61170:61170" volumes: - data:/var/lib/rasterizeddb depends_on: buckets: condition: service_completed_successfully restart: unless-stopped stop_grace_period: 90s healthcheck: test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/5432"] interval: 10s timeout: 5s retries: 6 start_period: 30s volumes: data: s3data: