eeshugerman / postgres-backup-s3

A handy Docker container to periodically backup PostgreSQL to S3
MIT License
485 stars 167 forks source link

Error: (0x51b998,0x59acf8) When trying to use Cloudflare R2? #29

Closed wovalle closed 1 year ago

wovalle commented 1 year ago

Hi! I'm trying to run this project but I'm getting an error I can't decipher:

04/02/2023 6:47:19 PM new cron: @daily
04/02/2023 6:47:19 PM (0x51b998,0x59acf8)
04/02/2023 6:47:19 PM Stopping
04/02/2023 6:47:19 PM Waiting
04/02/2023 6:47:19 PM Exiting
04/02/2023 6:47:20 PM new cron: @daily

My docker compose looks like this:

version: '3'

services:
  pg:
    container_name: pg
    image: postgres:15
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      PGDATA: /data/postgres
      PGDATABASE: ${POSTGRES_DB}
    volumes:
       - pg:/data/postgres
    ports:
      - "5432:5432"

  pg_backup:
    image: eeshugerman/postgres-backup-s3:15
    container_name: pg_backup
    environment:
      SCHEDULE: '@daily'    
      BACKUP_KEEP_DAYS: 7    
      PASSPHRASE: ${PG_BACKUP_PASSPHRASE}
      S3_REGION: "" # Empty since is not required in Cloudflare R2
      S3_ACCESS_KEY_ID: ${PG_BACKUP_S3_ACCESS_KEY_ID}
      S3_SECRET_ACCESS_KEY: ${PG_BACKUP_S3_SECRET_ACCESS_KEY}
      S3_BUCKET: ${PG_BACKUP_S3_BUCKET}
      S3_PREFIX: ${PG_BACKUP_S3_PREFIX}
      S3_ENDPOINT: ${PG_BACKUP_S3_ENDPOINT}
      POSTGRES_HOST: pg
      POSTGRES_DATABASE: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

I don't know what's failing or why. Can you point me in the right direction?

eeshugerman commented 1 year ago

04/02/2023 6:47:19 PM new cron: @daily 04/02/2023 6:47:19 PM (0x51b998,0x59acf8) 04/02/2023 6:47:19 PM Stopping 04/02/2023 6:47:19 PM Waiting 04/02/2023 6:47:19 PM Exiting 04/02/2023 6:47:20 PM new cron: @daily

Where is this log from? And what makes you believe those hex values are an error? Does the backup not appear in R2?

wovalle commented 1 year ago

@eeshugerman Sorry I was in a holiday and getting back today.

Where is this log from?

Docker logs

And what makes you believe those hex values are an error?

That's the only thing I can see in the logs and no backup appeared in R2 so I assumed it was an error

Does the backup not appear in R2?

No

Is there a way I can have a more verbose logging? 🤔

wovalle commented 1 year ago

This is all I get:

image
MaxMls commented 1 year ago

i have no problems with r2 with this configuration

  S3_ENDPOINT: https://(userid).r2.cloudflarestorage.com
  S3_REGION: "auto"
  S3_ACCESS_KEY_ID: ${S3_ID:?err}
  S3_SECRET_ACCESS_KEY: ${S3_KEY:?err}
  S3_BUCKET: backups
  S3_PREFIX: pgbackup
wovalle commented 1 year ago

Oh I found the issue and is my bad (wrong env var).

I didn't understand that @daily meant at 2am and I thought that the process was getting stuck.

Sorry for the troubleshooting time!

eeshugerman commented 1 year ago

No worries, glad to hear you got it sorted out!