Scaleway の S3 互換オブジェクトストレージの利用

Hi,

I’m trying to set up Discourse to use Scaleways S3-compatible Object Storage, but I can’t seem to get it to work and I’m not sure where the problem is.

I’ve verified that the both of the buckets work using aws-cli and that the CORS settings are properly set up by following the official docs from Scaleway so I don’t think the buckets themselves are the problem.

These are my Discourse S3 settings (part of bucket name redacted):

When I open the backups tab I get ‘Failed to list backups from S3: Aws::S3::Errors::BadRequest’
And when I try to upload an image, I see this in the log: 'Job exception: Failed to open TCP connection to [redacted]-discourse-files.s3.fr-par.amazonaws.com:443 (getaddrinfo: Name or service not known) '.

I’m running the latest Discourse - 2.4.0.beta10 (14ae574bc5).

My guess is they are less s3 compatible than they think they are?

The s3 region setting seems like it is influencing things here as well.

「いいね!」 1

That’s possible, but the url shouldn’t include amazonaws.com if I entered the endpoint - right?

Exactly, this is weird. Maybe because of the hipster TLD? Let me take a look.

@dino try removing the https:// from s3 endpoint

「いいね!」 3

The validation won’t let me do that: ‘s3_endpoint: Value doesn’t match the required format.’

「いいね!」 1

Yeah, that was a bad guess.

I can’t find a way to end with a URL like yours by reading the code responsible for it:

Is this only affecting backups? Are uploads working?

「いいね!」 1

Well, that’s different from the issue that I had with GCP buckets, but you might have a look at Trouble with Google Bucket for backup - #4 by pfaffman.

I was able to determine which upgrade of the aws-sdk-s3 gem caused using GCP Buckets not to work, though the solution my client chose was to switch to an AWS bucket.

@Falco yeah, I’m stumped too.
The error with the url which contains amazonaws is specifically for the file upload, not backups. For backups I only get the generic error, so I guess both are broken because of the url issue.

Can you think of anything else?

@pfaffman thanks for the tip - I’ll see if changing the version of the gem helps.

「いいね!」 1

Hey @dino, did that end up helping out? I’m having the same problem here and I’m about to give up and switch to Amazon S3.

Hey @FroggyC,
I actually ran out of time to debug this so I didn’t experiment with changing the gem vesions after all. I switched to using Amazon S3 using the official docs and things worked right away.
Sorry it’s not better news…

「いいね!」 1

Thank you. I guess we will have to do the same. Thank you!

同じ問題が発生しています。デバッグに何かお手伝いできることはありますか?

例えば、CLI を介してバケットにアクセスし、ログファイルを送信するなどです。

s3_region は無視されますよね?Scaleway は AWS と 異なる値 を使用しているためです。

Scalewayに問い合わせてみることをお勧めします。互換性の責任は彼らにあります。彼らが完全にAWS S3と互換性がない場合、その点を修正すべきです。

あなたはそれが彼らの責任だと暗示していますが、これまで@dino のコメントを無視し続けていますね:

(改ざんされていない)s3_endpoint の URL をそのまま使用しない限り、Scaleway にエラーが自社の側に起因すると納得させるのは難しいでしょう。特に、他の S3 クライアントが接続できているという事実があるからです。

わかりました、証明してください。それが事実であることを示すドキュメントとログのトレースを示してください。当社の問題に関する実際の証拠を提供いただければ、確認いたします。

はい、私が言いたかったのはそのことです。

では、DiscourseにS3接続の試行をログ出力させるにはどうすればよいでしょうか?接続先URLが何であるかを確認できれば、トラフィックを傍受して結果を共有できます。

「いいね!」 1

S3 アップロード/バックアップが機能しない理由は、fr-par(または nl-ams)に設定する必要があるリージョンを、Discourse の SiteSetting 検証を迂回してのみ設定できるためです。

./launcher enter app を実行し、その後 rails c を実行)

SiteSetting.find_by(name: 's3_region').update_attribute(:value, 'fr-par')

この変更後、アップロードとバックアップは Scaleway オブジェクトストレージに対して正常に機能します。

Scaleway のオブジェクトストレージ機能に関するドキュメント

もちろん、これは回避策であり、Web 管理者を通じてこのサイト設定をリセットまたは変更すると、再度動作する状態に戻すことができません(Rails コンソールを再度使用する必要がある場合を除く)。

現在の Web 管理者の状態とは異なり、AWS/S3 クライアントは明示的にリージョン文字列を設定できるはずです。

また、Discourse の「EU (Paris)」ドロップダウン値についても、これは AWS の命名規則である eu-west-3(またはそれに類する値)を指しており、Scaleway での期待される値とは異なるため、やや誤解を招く可能性があります。

「いいね!」 5

なるほど。@falco さん、特別な「S3 互換リージョン」の設定フィールドが必要でしょうか?それにより、ユーザーが完全に任意(つまり、Amazon の観点からは「架空」の)のリージョンを入力できるようになります。

それはいりません。

S3 クローンを使用する場合は、S3 エンドポイント環境変数を設定する必要があります。これにより、S3 リージョンが上書きされます。

Digital Ocean の S3 クローンを使った詳しい手順をまとめたガイドを用意しているのですが、Digital Ocean が S3 CDN のバグを修正するのを待っているところです。

Scaleway の方が Digital Ocean より状況が良ければ、試してみようと考えています。その場合、ガイドもそれを基に作成する予定です。

「いいね!」 4

その通りですが、彼らはそれをどうやって知るのでしょうか?既存のサイト設定の説明にはこれが記載されていますか?記載されるべきだと思います。対応可能でしょうか?

「いいね!」 3