# Fazer s3\_region um valor string

**URL:** https://meta.discourse.org/t/make-s3-region-a-string-value/239324
**Category:** Self-hosting
**Created:** [September 18, 2022, 11:35am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324 "2022-09-18T11:35:45Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 18, 2022, 11:35am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/1 "2022-09-18T11:35:45Z")

</div>

What could be the reasons for making this variable a limited list. For what?

```plaintext
irb(main):007:0> SiteSetting.s3_region='fr-par'
Traceback (most recent call last):
        5: from (irb):7
        4: from lib/site_setting_extension.rb:548:in `block in setup_methods'
        3: from lib/site_setting_extension.rb:368:in `add_override!'
        2: from lib/site_settings/type_supervisor.rb:149:in `to_db_value'
        1: from lib/site_settings/type_supervisor.rb:207:in `validate_value'
Discourse::InvalidParameters (Invalid value `fr-par` for `s3_region`)

```

Scaleway has its own regions.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 18, 2022, 1:42pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/2 "2022-09-18T13:42:58Z")

</div>

You can set different values via ENV variables as per [Configure an S3-compatible Object Storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916)

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 19, 2022, 3:05am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/3 "2022-09-19T03:05:52Z")

</div>

Do you think I didn’t?

> If the allowed value of a variable is strictly limited in the script according to the list of possible ones, are you sure that this will help?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 19, 2022, 1:48pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/4 "2022-09-19T13:48:20Z")

</div>

> [@zowyle](#):
>
> are you sure that this will help?

Yes, I’m sure because I wrote the Scaleway guide at [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916) and tested it working with a production install.

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 19, 2022, 10:27pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/5 "2022-09-19T22:27:57Z")

</div>

Cool! Try it on 2.9.0.Beta9 🙂 Please explain why you can’t change the variable through the console?

> Discourse::InvalidParameters (Invalid value `fr-par` for `s3_region`)

InvalidParameters

Understand? Invalid value `fr-par` for `s3_region` - Invalid Parameters! Ok?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 19, 2022, 10:42pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/6 "2022-09-19T22:42:40Z")

</div>

> [@zowyle](#):
>
> Cool! Try it on 2.9.0.Beta9 🙂 Please explain why you can’t change the variable through the console?

You shouldn’t change it on the console, because you should follow [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916) and set it as environment variables 🙂

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 19, 2022, 11:51pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/7 "2022-09-19T23:51:03Z")

</div>

> [@Falco](#):
>
> You shouldn’t change it on the console, because you should follow

You say strange things 🤯

1. I did this before posting here originally.
2. This does not work
3. I tried DIRECTLY through the console
4. This does not work

* * *

@Falco I will provide you with a bucket and an access token on Scaleway. I’ll create a server now and set up a forum there and give you access. If I succeed, I’ll apologize 🥰 😘

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 20, 2022, 10:21pm UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/8 "2022-09-20T22:21:05Z")

</div>

In the middle of the day I will delete the server. Until then, access is maintained.

# Obviously - the suggested settings do not work

 ![fr2](https://global.discourse-cdn.com/meta/original/4X/5/6/a/56af0888d65e7dda383511ca0bd6cd50af6846cd.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: [September 21, 2022, 9:57am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/9 "2022-09-21T09:57:39Z")

</div>

Just set the endpoint.

[Using Scaleway s3-compatible object storage - #19 by Falco](https://meta.discourse.org/t/using-scaleway-s3-compatible-object-storage/140603/19).

EDIT: Oh, somehow I’d missed the whole beginning of this topic. . .

Lots of other people have followed the guide and it does work.

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 22, 2022, 12:26am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/10 "2022-09-22T00:26:01Z")

</div>

### nano /var/discourse/containers/app.yml

```plaintext
  DISCOURSE_S3_REGION: "fr-par"
  DISCOURSE_S3_ACCESS_KEY_ID: "SCW ******* WYCGN"
  DISCOURSE_S3_SECRET_ACCESS_KEY: " ***************"
  DISCOURSE_BACKUP_LOCATION: "s3"
  DISCOURSE_S3_BACKUP_BUCKET: "test-forum-falco-discourse-s3-region"
  DISCOURSE_S3_ENDPOINT: "https://s3.fr-par.scw.cloud"

```

### ./launcher rebuild app

```plaintext
Removing old container
+ /usr/bin/docker rm app
app

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_FORCE_HTTPS=true -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_S3_REGION=fr-par -e DISCOURSE_S3_ACCESS_KEY_ID=SCWDM ************GN -e DISCOURSE_S3_SECRET_ACCESS_KEY=*********************** -e DISCOURSE_BACKUP_LOCATION=s3 -e DISCOURSE_S3_BACKUP_BUCKET=test-forum-falco-discourse-s3-region -e DISCOURSE_S3_ENDPOINT=https://s3.fr-par.scw.cloud -e DISCOURSE_HOSTNAME= **********-e DISCOURSE_DEVELOPER_EMAILS=***************** -e DISCOURSE_SMTP_ADDRESS=in-v3.mailjet.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME= ************************-e DISCOURSE_SMTP_PASSWORD=**************************** -e DISCOURSE_NOTIFICATION_EMAIL= ************************* -e LETSENCRYPT_ACCOUNT_EMAIL=me@example.com -h scw-jolly-merkle-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:53:96:b4:7e:e7 local_discourse/app /sbin/boot
e558fe6dbde62177ae4f4171fd1099f1844321c80f59cf4c3c0d4c56abfa9412

```

\*\*\* - secrets

### ./launcher enter app

### rake site\_settings:export

```plaintext
---
title: Discourse1
contact_email: *************************
default_dark_mode_color_scheme_id: '1'
invite_only: 'true'
login_required: 'true'
default_trust_level: '1'
allowed_iframes: https://www.google.com/maps/embed?|https://www.openstreetmap.org/export/embed.html?|https://calendar.google.com/calendar/embed?|https://codepen.io/|https://www.instagram.com|https:// ************************* /discobot/certificate.svg
default_email_digest_frequency: '1440'

```

> [@pfaffman](#):
>
> Lots of other people have followed the guide and it does work.

It doesn’t work still

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 22, 2022, 12:53am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/11 "2022-09-22T00:53:40Z")

</div>

The ENV variables set at the app.yaml won’t necessarily reflect on the `rake site_settings:export`, no idea why did you assume that.

Now that it looks like you got all the ENV variables set per the guide at [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916), what happens when you try to upload a picture to a post? Anything interesting in the `/logs` page?

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 22, 2022, 1:18am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/12 "2022-09-22T01:18:42Z")

</div>

Hello.

> [@Falco](#):
>
> не обязательно будут отражаться на файле `rake site_settings:export` ,

Ок. Shouldn’t they be displayed in the forum settings too? You obviously have some interesting and special approach to programming. Shouldn’t they really be there?

 ![fr3](https://global.discourse-cdn.com/meta/original/4X/9/f/d/9fd0397a8b8d0b3d6db9364f5e422ea1c96c0ea9.png)

---

<div class="post-metadata">

### Author: ![zowyle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zowyle/32/274340_2.png) [@zowyle](https://meta.discourse.org/u/zowyle)
#### Post date: [September 22, 2022, 1:27am UTC](https://meta.discourse.org/t/make-s3-region-a-string-value/239324/13 "2022-09-22T01:27:27Z")

</div>

> [@Falco](#):
>
> Now that it looks like you got all the ENV variables set

Please excuse me. Now it works 🥰 😘

- Settings fields are missing in the web interface
- site\_settings:export - fields are missing
- SiteSetting.s3\_region=‘fr-par’ - Error “Invalid value `fr-par` for `s3_region`”

But

- it works
- I don’t understand why I decided that

Thank you. Sorry 😉
