dokku / dokku-mongo

a mongo plugin for dokku
MIT License
177 stars 32 forks source link

mongo:backup returns gof3r error: 301 #92

Closed mbaertschi closed 7 years ago

mbaertschi commented 7 years ago

Issue

Calling dokku mongo:backup DB BUCKET results in the following error:

gof3r error: 301: "The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."

How to reproduce

AWS S3 Bucket Setup

Let's consider the following credentials:

Attribute Value
username username
access_key_id aki
secret_access_key sak
region eu-central-1
endpoint s3.eu-central-1.amazonaws.com
signature version s3v4
bucket example_bucket
database database

For my S3 buckets I set up a AWS IAM user and configured the according Bucket Policy:

{
    "Version": "Version",
    "Id": "PolicyID",
    "Statement": [
        {
            "Sid": "Sid",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::user_id:user/username"
            },
            "Action": "s3:*",
            "Resource": "arn:aws:s3:::example_bucket/*"
        }
    ]
}

AWS Console

Let's consider that the example_profile profile contains the information listed above. Then calling the following cp command works as expected:

aws s3 cp databasedump s3://example_bucket --profile example_profile

Dokku mongo

# Setup backup-auth
dokku mongo:backup-auth database awi ask eu-central-1 s3v4 s3.eu-central-1.amazonaws.com
# Issue backup
dokku mongo:backup database example_bucket
# Or
dokku mongo:backup database example_bucket --use-iam

Results in the error described above. As the aws console command works as expected the error has to be somewhere in the mongo:backup script. Do I use this script correctly or is there somewhere an error in my setup?

Thank you for your help

josegonzalez commented 7 years ago

Upgrade your mongodb plugin, we no longer use gof3r for backups.