Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minio S3 backend (#4) #7

Merged
merged 6 commits into from
Jul 20, 2022
Merged

Minio S3 backend (#4) #7

merged 6 commits into from
Jul 20, 2022

Conversation

ahouene
Copy link
Contributor

@ahouene ahouene commented Jul 13, 2022

Use Minio client for S3 instead of AWS SDK

@ahouene ahouene changed the title Minio S3 backend Minio S3 backend (#4) Jul 13, 2022
Copy link
Member

@wojas wojas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a lot cleaner!

I added a few reviews comments and have not actually tried to run it yet.

@@ -48,8 +46,8 @@ type Options struct {
// CreateBucket tells us to try to create the bucket
CreateBucket bool `yaml:"create_bucket"`

// EndpointURL can be set to something like "http://localhost:9000" when using Minio
// instead of AWS S3.
// EndpointURL can be set to something like "localhost:9000" when using Minio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change the configuration format if not strictly necessary. This seemingly innocent change would break all existing configurations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this against a configuration I had used prior and was presented with the following error (thrown by minIO client):
"Endpoint url cannot have fully qualified paths"

Endpoint used: https://s3.eu-central-1.amazonaws.com/

See suggestion in the 'Secure' flag comment, perhaps that can be used to prevent/solve both.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error was the reason for this change in the first place, but indeed the configuration format should not have been changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested; Error is no longer reproducible and my prior used configurations all seem to work. Nice to have the format of this config option stay the same 👍

s3config.WithHTTPClient(hc))
cfg := &minio.Options{
Creds: credentials.NewStaticV4(opt.AccessKey, opt.SecretKey, ""),
//Secure: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this needs to depend on if the URL starts with http or https?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems so indeed, I tested against an AWS s3 bucket with the following endpoint variations:

  • s3.eu-central-1.amazonaws.com:443/
  • s3.eu-central-1.amazonaws.com:80/
  • s3.eu-central-1.amazonaws.com/

Worked fine over 'no port' + port 80, but seemed to stop functioning with port 443 specified. Likely due to a protocol mismatch.

Perhaps enforce or allow endpoints in opt.EndpointURL to have protocols specified, then set the minIO Client's 'Secure' option based on the protocol identified in the opt.EndpointURL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the file to read the URL's scheme to determine the value of Secure. I then pass the URL with https?:(//)? stripped out to Minio.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested; The 'Secure' flag now indeed reflects the scheme of the configured Endpoint

test-minio.json Outdated Show resolved Hide resolved
@wojas wojas requested a review from nvaatstra July 20, 2022 08:42
ahouene added 3 commits July 20, 2022 12:24
Minio only accepts the endpoint URL's host value as its endoint URL. Providing the scheme along throws an error.
Now the scheme and host are split from the endpoint URL in config file.
Scheme is used to determine whether the client should use a secure connection.
Copy link
Contributor

@nvaatstra nvaatstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Both findings encountered earlier have been resolved and prior configurations seem to work fine.

And on an extra positive side-note: An issue I had earlier with simpleblob (while it was using the AWS SDK) related to the AWS SDK retry budget when SSL certificate errors were encountered is now also resolved with this switch to the minIO Client 👍

Copy link
Member

@wojas wojas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants