No access to site after set S3 credentials

i can not access the site after set s3 credentials for backup. i did not change anything out of this.

1 Like

You can look at /var/discourse/shared/log/rails/production.log (or something like that) and see the error.

Perhaps you need to

cd /var/discourse
./launcher enter app
rails c
# and then something like
SiteSetting.backup_location='local'

But it could be coincidence that S3 backups has nothing to do with this and your disk is full.

6 Likes

thank you. i tried but i can not fix it. error log is below.

ActionView::Template::Error (s3_upload_bucket)
/var/www/discourse/lib/file_store/s3_store.rb:153:in `s3_bucket'
Started HEAD "/" for 35.111.111.163 at 2020-03-05 06:34:08 +0000
Processing by ListController#latest as HTML
  Rendering list/list.erb within layouts/application
  Rendered list/list.erb within layouts/application (Duration: 6.1ms | Allocations: 2278)
  Rendered layouts/_head.html.erb (Duration: 0.2ms | Allocations: 102)
  Rendered common/_google_universal_analytics.html.erb (Duration: 0.2ms | Allocations: 79)
  Rendered common/_discourse_stylesheet.html.erb (Duration: 0.4ms | Allocations: 200)
Completed 500 Internal Server Error in 60ms (ActiveRecord: 0.0ms | Allocations: 17538)
ActionView::Template::Error (s3_upload_bucket)
/var/www/discourse/lib/file_store/s3_store.rb:153:in `s3_bucket'

there is 5 GB free space.

I would disable the S3 settings from the rails console. I tried to give an example above. You might need to search here for some more examples

1 Like

You did not set the s3_upload_bucket parameter.
Just do

cd /var/discourse
./launcher enter app
rails c
SiteSetting.s3_upload_bucket = 'thenameofyourbucket'

where you change the last line so it has the actual name of your S3 bucket.

5 Likes

thank you. that fixed the problem. But why this happened ? Because i only wanted use S3 for backups so i did not enter any butket for uploads. Is this normal or a bug ?

I can only reproduce this issue when enabling enable_s3_uploads.

I think this is what happened and which does result in an Oops screen:

  • you added s3 access key id and s3 secret access key
  • you configured an s3_upload_bucket
  • you enabled enable_3s_uploads
  • you set backup_location to s3
  • you had to set a s3_backup_bucket and you set it to the same bucket
  • this gives an error message You cannot use the same bucket for ‘s3_upload_bucket’ and ‘s3_backup_bucket’. Choose a different bucket or use a different path for each bucket.
  • you cleared s3_upload_bucket so you could use s3_backup_bucket
  • you did not turn off enable_s3_uploads

The bug is that enabling_s3_uploads requires an s3_upload_bucket, but emptying that setting while s3 uploads are still enabled crashes the forum.

7 Likes

anything we can do to fix the above @eviltrout?

1 Like

There’s already a validation in place to prevent this:

But it doesn’t cover the case where you blank the bucket while leaving uploads enabled.

2 Likes

This should do it:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.