I am trying to do "bundle exec rake s3:upload_assets" as root and it yields the following erros: Could not locate Gemfile or .bundle/ directory.
I also tried doing it without root, using "sudo -E -u discourse bundle exec rake s3:upload_assets" and it yielded the following error: sudo: unknown user discourse sudo: error initializing audit plugin sudoers_audit
I did both commands in the following directory: /var/discourse
This is a normal installation, not using docker or anything.
Thank you! That got me further, I am now at this error:
root@redacted:/var/www/discourse# sudo -E -u discourse bundle exec rake s3:upload_assets
/root is not writable.
Bundler will use `/tmp/bundler20250409-510203-w6snye510203' as your home directory temporarily.
ERROR: Ensure S3 is configured in config/discourse.conf or environment vars```
I do have everything configured in the Discourse site settings. I am not using Docker so I would not need environment vars?
All of the S3 variables should be moved to hidden settings, as mostly no good can come from configuring them in the settings.
Sorry, and I forgot that you’re not using Docker. But yes, you still need to set them in the ENV variables. I do that in my development environment to restore databases from S3.
If you’re not doing this for a development environment, you’re very likely making a big mistakes.
Fixed it by doing the following - there were two errors.
First, I fixed the second error by doing the following:
rails c
Upload.find(386).destroy!
exit
This fixed the corrupt post(malformatted text or something)
Then the red errors on the screen were from using the random subdomain(provided by cloudflare) and uploading to that. I had to upload the files to the new domain(which includes my connected domain)