# S3 자격 증명 설정 후 사이트 접근 불가

**URL:** https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344
**Category:** Support
**Created:** [3월 4, 2020, 8:26오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344 "2020-03-04T20:26:35Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ufukayyildiz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ufukayyildiz/32/217157_2.png) [@ufukayyildiz](https://meta.discourse.org/u/ufukayyildiz)
#### Post date: [3월 4, 2020, 8:26오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/1 "2020-03-04T20:26:35Z")

</div>

백업용 S3 자격 증명을 설정한 후 사이트에 액세스할 수 없습니다. 이 부분 외에는 아무것도 변경하지 않았습니다.

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/0/f0debf119853b5c69f25182e99322ba5a1f76603.png)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 5, 2020, 12:09오전 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/2 "2020-03-05T00:09:55Z")

</div>

`/var/discourse/shared/log/rails/production.log`(또는 비슷한 경로)를 확인하면 오류를 볼 수 있습니다.

아래와 같은 작업을 수행해야 할 수도 있습니다.

```plaintext
cd /var/discourse
./launcher enter app
rails c
# 그리고 다음과 같은 명령을 실행합니다.
SiteSetting.backup_location='local'

```

하지만 S3 백업과 이 문제가 무관하고 디스크 용량이 가득 차 있는 것이 우연일 수도 있습니다.

---

<div class="post-metadata">

### Author: ![ufukayyildiz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ufukayyildiz/32/217157_2.png) [@ufukayyildiz](https://meta.discourse.org/u/ufukayyildiz)
#### Post date: [3월 5, 2020, 6:37오전 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/3 "2020-03-05T06:37:56Z")

</div>

감사합니다. 시도해 보았지만 해결하지 못했습니다. 에러 로그는 아래와 같습니다.

```
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'

```

---

<div class="post-metadata">

### Author: ![ufukayyildiz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ufukayyildiz/32/217157_2.png) [@ufukayyildiz](https://meta.discourse.org/u/ufukayyildiz)
#### Post date: [3월 5, 2020, 7:19오전 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/4 "2020-03-05T07:19:38Z")

</div>

> [@pfaffman](#):
>
> 디스크가 가득 찼습니다.

공백 공간이 5GB 있습니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [3월 5, 2020, 12:58오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/5 "2020-03-05T12:58:13Z")

</div>

rails 콘솔에서 S3 설정을 비활성화하겠습니다. 위에서 예시를 하나 보여드렸는데, 더 많은 예시를 여기에서 검색해 보실 수 있습니다.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [3월 5, 2020, 1:17오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/6 "2020-03-05T13:17:18Z")

</div>

> [@ufukayyildiz](#):
>
> ```plaintext
> /var/www/discourse/lib/file_store/s3_store.rb:153:in `s3_bucket'
> 
> ```

`s3_upload_bucket` 매개변수를 설정하지 않았습니다.  
아래와 같이 실행하세요.

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

```

마지막 줄을 수정하여 실제 S3 버킷 이름을 입력하면 됩니다.

---

<div class="post-metadata">

### Author: ![ufukayyildiz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ufukayyildiz/32/217157_2.png) [@ufukayyildiz](https://meta.discourse.org/u/ufukayyildiz)
#### Post date: [3월 5, 2020, 1:32오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/7 "2020-03-05T13:32:07Z")

</div>

감사합니다. 그 방법으로 문제가 해결되었습니다. 그런데 왜 이런 일이 발생했을까요? 저는 S3를 백업 용도로만 사용하려고 했기 때문에 **uploads** 에 버킷을 입력하지 않았습니다. 이게 정상적인 동작인가요, 아니면 버그인가요?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [3월 5, 2020, 1:48오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/8 "2020-03-05T13:48:27Z")

</div>

`enable_s3_uploads`를 활성화할 때만 이 문제를 재현할 수 있습니다.

아래와 같은 상황이 발생하면 Oops 화면이 표시되는 것으로 보입니다:

- `s3 access key id`와 `s3 secret access key`를 추가했습니다.
- `s3_upload_bucket`을 구성했습니다.
- `enable_3s_uploads`를 활성화했습니다.
- `backup_location`을 s3로 설정했습니다.
- `s3_backup_bucket`을 설정해야 했고, 동일한 버킷으로 설정했습니다.
- \*\*'s3\_upload\_bucket’과 's3\_backup\_bucket’에 동일한 버킷을 사용할 수 없습니다. 다른 버킷을 선택하거나 각 버킷에 다른 경로를 사용하세요.\*\*라는 오류 메시지가 표시됩니다.
- `s3_backup_bucket`을 사용할 수 있도록 `s3_upload_bucket`을 비웠습니다.
- `enable_s3_uploads`를 비활성화하지 않았습니다.

버그의 원인은 `enabling_s3_uploads`가 `s3_upload_bucket`을 요구하는데, s3 업로드가 여전히 활성화된 상태에서 해당 설정을 비우면 포럼이 충돌하기 때문입니다.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 5, 2020, 6:30오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/9 "2020-03-05T18:30:22Z")

</div>

위 문제를 해결할 수 있는 방법이 있을까요 @eviltrout?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [3월 5, 2020, 8:51오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/10 "2020-03-05T20:51:52Z")

</div>

이미 이를 방지하기 위한 유효성 검사가 존재합니다:

> <https://github.com/discourse/discourse/blob/e7bd288/lib/site_settings/validations.rb#L120-L124>

하지만 업로드가 활성화된 상태에서 버킷을 비우는 경우를 다루지 않습니다.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [3월 5, 2020, 9:05오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/11 "2020-03-05T21:05:14Z")

</div>

이렇게 하면 됩니다:

> <https://github.com/discourse/discourse/commit/4bb8db024c247f20af9245723ebea4c474eeb16a>

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [4월 4, 2020, 9:05오후 UTC](https://meta.discourse.org/t/no-access-to-site-after-set-s3-credentials/143344/12 "2020-04-04T21:05:36Z")

</div>

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