How to debug S3 uploads

AI-generated summary

Several users are struggling to debug S3 uploads in Discourse. Andro initially had uploads working but now they go local, and can’t find clues in the error log. tggm is also having issues and requests to see Andro’s S3 IAM policy.

pfaffman suggests following the guide Using Object Storage for Uploads (S3 & Clones) and notes that using environment variables and bucket permissions can be tricky.

Andro tries running the rake command as per instructions but gets a failure error. pfaffman suspects a missing environment variable, and Andro confirms adding all the S3 variables but still experiences the same failure.

pfaffman suggests checking for a permissions issue on the bucket and points out that the example stanzas in the Clones topic can serve as a working example for the app.yml file.

For a brief moment I had S3 uploads to a bucket working. Then I followed the several posts here to make sure it is all correct and now all uploads go local. I cant see any clues in the error log.

How does one go about debugging this complex setup?

One post suggests you have to do it with mostly environment variables, but the other does not, and the admin panel seems to have all the S3 parameters necessary. I am basically confused.

I have double checked all the values for S3 in the system.

Hi @Andro

I’m also struggling with this. Could you please share your S3 IAM policy ? I can’t even get past that part.

Also, what did you set for the following config flags?

  • s3 configure tombstone policy
  • enable s3 inventory

Thanks!

The one to follow is Using Object Storage for Uploads (S3 & Clones). Things work a bit differently if you use those environment variables and that’s what you want. Don’t forget the part at the top about the rake task.

I think that there is some issue with knowing just how to create the bucket permissions.

Not looking so good. Launcher rebuild app after adding rake command as per instructions:

FAILED

Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake s3:upload_assets failed with return #<Process::Status: pid 1347 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn’
exec failed with the params {“cd”=>“$home”, “cmd”=>[“sudo -E -u discourse bundle exec rake s3:upload_assets”]}
c0b19d01faa8c6e1f217b209bdd5293c1a1dcd2016f286d17050c299f676256c
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

You likely missed one of the env variables. Having them in the database is not enough.

I added all the S3 variables but still the same failure.

What to try next? The launcher rebuild log just says exit with 1 and no further clue.

Does anybody have an example of working app.yml values (edited for privacy)?

The next guess is that you have s permissions issue on the bucket that’s keeping you from uploading.

Those example stanzas in the Clones topic are the example app.yml file.