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

Support Wasabi S3 storage #759

Closed
fholger opened this issue Jul 15, 2019 · 11 comments
Closed

Support Wasabi S3 storage #759

fholger opened this issue Jul 15, 2019 · 11 comments
Labels
component/loki stale A stale issue or PR that will automatically be closed.

Comments

@fholger
Copy link

fholger commented Jul 15, 2019

Is your feature request related to a problem? Please describe.
I'm trying to use the Wasabi S3 storage (https://www.wasabi.com) as a storage backend for Loki. Unfortunately, this is not currently possible. Although you can specify custom S3 endpoints, it appears that Loki automatically sets region to Dummy when doing so. Wasabi, however, expects an actual region (eu-central-1 in my case) and consequently rejects the Loki API requests as invalid.

Describe the solution you'd like
I think an explicit config option to set the region would be the easiest option. (Or if there already is an option to do so, I couldn't find it :) )

Describe alternatives you've considered
I've used the csi-s3 persistent volume driver so that Loki can store chunks to a filesystem. This appears to work ok, so I'm good for now. But direct support for Wasabi would still be appreciated :)

Additional context
My storage config looks like this:

storage_config:
  boltdb:
    directory: /data/loki/index
  aws:
    s3: "s3://<ACCESS_KEY>:<SECRET_KEY>@s3.eu-central-1.wasabisys.com/<BUCKET>"
    s3forcepathstyle: true
@mizeng
Copy link
Contributor

mizeng commented Jul 15, 2019

I think it's from the code here:

if strings.Contains(awsURL.Host, ".") {
		return config.WithEndpoint(fmt.Sprintf("http://%s", awsURL.Host)).WithRegion("dummy"), nil
	}

Anyway as a workaround, you may set os env "AWS_REGION" and have a try since AWS CONFIG init as below:

func Config() *aws.Config {
	return aws.NewConfig().
		WithCredentials(credentials.AnonymousCredentials).
		WithRegion(os.Getenv("AWS_REGION")).
		WithHTTPClient(http.DefaultClient).
		WithMaxRetries(aws.UseServiceDefaultRetries).
		WithLogger(aws.NewDefaultLogger()).
		WithLogLevel(aws.LogOff).
		WithEndpointResolver(endpoints.DefaultResolver())
}

@fholger
Copy link
Author

fholger commented Jul 16, 2019

Unfortunately, setting AWS_REGION appears to have no effect. I think configuring the endpoint takes precedence in that case, as it provides both endpoint and region. But thanks, anyway!

@mizeng
Copy link
Contributor

mizeng commented Jul 16, 2019

Sorry for I have no env for testing, but from my code reading, it should work.. lol..

If that does not work, try to add similar code in https://github.com/cortexproject/cortex/blob/master/pkg/chunk/aws/s3_storage_client.go#L50 and see if it works.

@paiou
Copy link

paiou commented Aug 10, 2019

I tried to connect to Scaleway S3-compatible storage and encountered the same issue to set the region.
AWS_REGION is overridden by .WithRegion("dummy"). Removing just this part of the code works perfectly fine.
I created PR 859 to fix it.

@stale
Copy link

stale bot commented Sep 9, 2019

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Sep 9, 2019
@stale stale bot closed this as completed Sep 16, 2019
@adityacs
Copy link
Contributor

@sandlis I got my PR merged for above issue weaveworks/common@a2b2a63
Kindly requesting you to update your fork and in turn update loki.

@ThoreKr
Copy link

ThoreKr commented Sep 24, 2019

@mizeng

if strings.Contains(awsURL.Host, ".") {
		return config.WithEndpoint(fmt.Sprintf("http://%s", awsURL.Host)).WithRegion("dummy"), nil
	}

why does it use harcoded http?

@Sh4d1
Copy link

Sh4d1 commented Oct 19, 2019

@mizeng any news on the bump of weaveworks/common ?

@mizeng
Copy link
Contributor

mizeng commented Oct 21, 2019

@Sh4d1 Sorry for I did not take more time in this since I did not use wasabi s3.

@Sh4d1
Copy link

Sh4d1 commented Oct 21, 2019

@mizeng did a little digging, and apparently we just need to wait for a PR on weaveworks/common to be merged, and then we can replace the fork, and it should work :)

@ThoreKr
Copy link

ThoreKr commented Oct 21, 2019

@Sh4d1 It's all blocked by #945 which relies on an abandoned PR by @tomwilkie and weaveworks/common#167.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/loki stale A stale issue or PR that will automatically be closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants