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

Document that S3 ACLs must be enabled #952

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

AustinWise
Copy link
Contributor

@AustinWise AustinWise commented Jul 2, 2022

When using S3 compatible object stores to save attachments, object-level ACLs must be enabled. If they are not enabled, attaching pictures to toots will fail. For some object stores, the error message does not indicate the root cause of the problem.

Unfortunately it is likely that people will accidentally disable ACLs when first setting up Mastodon. This is because both AWS S3 and Google cloud storage disable object-level ACLs by default. The GUIs for creating buckets recommend somewhat strongly that they should not be enabled.

For example, the AWS docs say

we recommend that you disable ACLs except in unusual circumstances

And the creation UI looks like this:

image

It appears I'm not the only person who has had trouble with this:

@nightpool
Copy link
Member

I'm not sure there's any good reason for Mastodon to require Object-level ACLs, maybe kreeti/kt-paperclip#92 would be a better approach instead?

@AustinWise
Copy link
Contributor Author

One place that Mastodon explicitly sets ACLs is when suspending an account. All media from the suspended account is made private using ACLs. There is a PR (mastodon/mastodon#17979) that adds support disabling the use of ACLs in Mastodon. However a comment from @Gargron suggests that hiding media from suspended accounts is an important feature.

Besides the places where Mastodon explicitly sets ACLs, I needed to enable ACLs to successfully attach a picture to a toot. I tested this using Mastodon v3.5.3 against AWS S3 and GCS.

@nightpool
Copy link
Member

nightpool commented Jul 5, 2022 via email

@kmeisthax
Copy link

This actually took down my instance. I enabled S3 uploads but used the recommended configuration from Amazon - i.e. no ACLs. This meant that all the uploads fail because Amazon does not have a "transparently ignore public ACLs but let the uploads succeed" option.

I didn't notice that jobs were failing at the time for two reasons:

  • I was migrating old media from a local filesystem.
  • I set up Amazon Cloudfront to get around the fact that no ACLs = no public files.

This resulted in a massive queue of Sidekiq jobs piling up and Sidekiq constantly using more RAM than I had. Previously I had added swap space specifically for occasional memory excursions, but constant usage burns through EBS's burst balance really quick. And once you run out of EBS burst the instance locks up and dies.

@twilde
Copy link

twilde commented Nov 23, 2022

This just bit me. Can this one line PR please be reviewed and merged?

@AustinWise
Copy link
Contributor Author

I rebased the commit to resolve merge conflicts and update the description of this PR with more details.

@AustinWise
Copy link
Contributor Author

@nightpool Can you take another look at this PR. I updated the description with a more detailed description on why people are likely to incorrectly setup their S3-compatible storage. And there have been a couple of commenters mentioning that they hit this issue.

@nightpool
Copy link
Member

@AustinWise I don't have permission to merge this PR but it LGTM

When using the web GUI to create a bucket, both AWS S3 and GCS have
ACLs disabled by default.
@vmstan vmstan requested a review from a team March 16, 2024 19:56
Copy link
Sponsor Member

@andypiper andypiper left a comment

Choose a reason for hiding this comment

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

thank you, LGTM, merging.

@andypiper andypiper merged commit fa953aa into mastodon:main Mar 17, 2024
@nightpool
Copy link
Member

nightpool commented Mar 17, 2024 via email

@AustinWise AustinWise deleted the austin/ObjectStorageSetup branch March 17, 2024 22:47
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.

None yet

6 participants