Make s3_region a string value

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

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.

You can set different values via ENV variables as per Configure an S3-compatible Object Storage provider for uploads

1 Like

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?

Yes, Iā€™m sure because I wrote the Scaleway guide at Configure an S3 compatible object storage provider for uploads and tested it working with a production install.

1 Like

Cool! Try it on 2.9.0.Beta9 :slight_smile: 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?

You shouldnā€™t change it on the console, because you should follow Configure an S3 compatible object storage provider for uploads and set it as environment variables :slightly_smiling_face:

2 Likes

You say strange things :exploding_head:

  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 :smiling_face_with_three_hearts: :kissing_heart:

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

Obviously - the suggested settings do not work

fr2

Just set the endpoint.

Using Scaleway s3-compatible object storage - #19 by Falco.

EDIT: Oh, somehow Iā€™d missed the whole beginning of this topic. . .

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

1 Like

nano /var/discourse/containers/app.yml

  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

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

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

It doesnā€™t work still

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, what happens when you try to upload a picture to a post? Anything interesting in the /logs page?

1 Like

Hello.

ŠžŠŗ. 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?

Please excuse me. Now it works :smiling_face_with_three_hearts: :kissing_heart:

  • 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 :wink: