إعداد خادم عالي التوفر 3

هل يدعم Discourse تشغيل عدة آلات (كل منها يحتوي على حاوية Docker واحدة) خلف موزع أحمال مستقل؟

أحتاج إلى إعداد Discourse يتحمل فشل أحد الخوادم، لذا فإن ردي القياسي هو تكوين 3 خوادم خلف موزع أحمال (حيث يتولى موزع الأحمال إدارة شهادة SSL).

لقد قمت بتكوين خوادم PostgreSQL و Redis خارجية مستقلة لـ Discourse. (يتم ذلك كله على منصة Google Cloud). أستخدم أداة تشغيل Discourse لتكوين حاوية Docker مخصصة للويب فقط.

  1. هل يدعم Discourse تشغيل حاويات متعددة عندما تكون كل حاوية على آلة مختلفة؟
  2. هل يجب أن أنسخ حاوية Docker المنشأة من الآلة الأولى إلى الآلات الأخرى؟
  3. كيف يتم التعامل مع الشعارات المرفوعة؟
  4. هل تُخزن الشعارات المرفوعة وأيقونات المفضلة (favicons) وما شابه ذلك في قاعدة البيانات؟

شكرًا جزيلاً على المساعدة.

5 إعجابات

Yes, that how we run it at our hosting service.

  1. Yes
  2. Yes
  3. You should configure Using Object Storage for Uploads (S3 & Clones)
  4. No, they go to object storage as said in 3.
7 إعجابات

Thanks Rafael. Much appreciated.

I have run into an issue with the SSL terminated on the load balancer. Discourse specifies all it’s links as HTTP.

Is there a way to make Discourse aware that it’s links should be https?

Yes, drop to a rails console and set it to https with:

cd /var/discourse
./launcher enter app
rails c
SiteSetting.force_https = true
إعجابَين (2)

Excellent. Thanks again.

I presume that I could to the app.yml
- exec: rails c "SiteSetting.force_https = true"

I have no idea about rails. In my command above, should it be ‘rails c’ or ‘rails r’?

إعجابَين (2)

We do have an example of changing site settings on bootstrap in our sample file:

3 إعجابات

Yep, that is where I copied my command from.

One last question. Is the docker container monitored? If the docker container stops for any reason, has launcher setup anything to restart it?

Yup, launcher asks Docker to autorestart the containers.

إعجابَين (2)

Okay. So I have now have a working discourse on a single machine. I have two other machines. The docker guest /shared volume is pointed to an NFS directory to allow all machines to access the uploads (esp. logos, etc).

I have copied the docker images to the machines 2 and 3 (docker save -o app-image local_discourse/app and then docker load -i app-image.

I was under the impression that a simple ./launcher start app would work, but it attempts to check containers/app.yml.

Will I run into problems if I allow the app.yml to be checked (and changes made) to the DB from machine 2 and 3?

Is there a better way to have three machines running a single setup?

إعجاب واحد (1)

You have two options:

  • Use – I think it’s ./launcher start-command app – on the fully set up machine (the “build machine”) to obtain a complete Docker command line
  • Copy the app.yml over, and do what you just attempted (launcher start).
5 إعجابات

I’d set ENV DISCOURSE_FORCE_HTTPS: true

6 إعجابات