databacker / mysql-backup

image to enable automated backups of mysql databases in containers
636 stars 178 forks source link

S3 upload issue for newer versions 1.0.0-rc+ #296

Closed lightsuner closed 5 months ago

lightsuner commented 5 months ago

I tried to use the newest version of the tool databack/mysql-backup:51c9ce6e97a5b864bef95767c707896b95a7916b, and received the following error:

mysql_backup  | time="2024-04-07T02:36:36Z" level=debug msg="uploading via protocol s3 from db_backup_2024-04-07T02:36:36Z.tgz"
mysql_backup  | Error: error running command: error running command: error running dump: failed to push file: failed to upload file, operation error S3: PutObject, unsupported protocol scheme ""
mysql_backup  | time="2024-04-07T02:36:36Z" level=fatal msg="error running command: error running command: error running dump: failed to push file: failed to upload file, operation error S3: PutObject, unsupported protocol scheme \"\""
mysql_backup exited with code 1

My compose.yaml file is:

mysql_backup:
    command: dump -v 2
    container_name: mysql_backup
    depends_on:
      mysql:
        condition: service_healthy
        required: true
    environment:
      AWS_ACCESS_KEY_ID: werwerwerwerwerewr
      AWS_DEFAULT_REGION: us-east-1
      AWS_REGION: us-east-1
      AWS_SECRET_ACCESS_KEY: sadasdasdadasdasdasdasdasd
      COMPRESSION: gzip
      DB_DUMP_DEBUG: "true"
      DB_DUMP_FREQ: "1440"
      DB_DUMP_TARGET: s3://name-of-the-bucket/
      DB_NAMES: "db1 db2"
      DB_PASS: PASSWORD
      DB_PORT: "3306"
      DB_SERVER: mysql
      DB_USER: root
      NICE: "true"
      TZ: UTC
    image: databack/mysql-backup:51c9ce6e97a5b864bef95767c707896b95a7916b
    networks:
      default: null
    restart: unless-stopped

At the same time, using the same config but an older version of the tool databack/mysql-backup:latest works well.

deitch commented 5 months ago

I can confirm the issue. It gives a bit more detail in the log message:

FATA[0002] error running command: error running command: error running dump: failed to push file: failed to upload file, operation error S3: PutObject, exceeded maximum number of attempts, 3, https response error StatusCode: 0, RequestID: , HostID: , request send failed, Put "//testbucketavideitcher./db_backup_2024-04-07T13%3A16%3A54%2B03%3A00.tgz?x-id=PutObject": unsupported protocol scheme "" 

How it got to that protocol scheme, I do not know. But we can step through it and find out.

deitch commented 5 months ago

That should do it. Try it out and report? Might take a few minutes to get pushed out to hub.

lightsuner commented 5 months ago

Hello @deitch

Thanks! The fix works! I've checked this image databack/mysql-backup:18d32f978c9281812e2615afc0bc3d096c3da1ea