يجب اعتبار هذه التعليمات تجريبية وللأشخاص المعتادين على الإعداد القياسي
ولكن في الوقت الحالي (2023.02.11) هذه التعليمات لا تعمل!! (انظر Set up Let’s Encrypt with multiple domains / redirects لكيفية تحديث إعداد letsencrypt لإضافة جزء fullpath. سأقوم بتحديث هذا ليعكس تلك التغييرات قريبًا جدًا.)
لقد طورت هذا الدليل قبل أسبوعين ولكني بحاجة إلى شخص لاختباره ومعرفة ما إذا كان يعمل لشخص آخر. يرجى الرد إذا جربته وإخباري بما إذا كان يعمل وما إذا كان هناك أي شيء غير واضح.
ونستمر في العرض. . .
يوثق هذا الدليل بشكل عام كيفية إعداد إعداد متعدد المواقع مع مضيفين إضافيين (3 إجمالاً).
كلمة مرور قاعدة البيانات (نفس كلمة مرور DISCOURSE_DB_PASSWORD) أو discourse في app.yml
لأغراض التبسيط، هذا للموقع الرئيسي المسمى =domain=، مع موقعين إضافيين هما =two=.=domain= و =three=.=domain=. يمكنك استخدام أي أسماء تريدها، ولكن من أجل هذا القالب، فإن عدم وجود اسم مختصر مختلف (لاسم قاعدة البيانات وعنوان المنتدى الفرعي) و اسم المضيف الكامل أسهل قليلاً.
أضف في hooks بعد الإضافات (plugins) في app.yml أو web_only.yml
before_bundle_exec:
- file:
path: $home/config/multisite.yml
contents: |
=two=:
adapter: postgresql
database: =two=
pool: 25
timeout: 5000
host: data
password: NThmZTNjZjZhOTczNmVj
host_names:
- =two=.=domain=
=three=:
adapter: postgresql
database: =three=
pool: 25
timeout: 5000
host: data
password: NThmZTNjZjZhOTczNmVj
host_names:
- =three=.=domain=
after_db_migrate:
- exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
after_ssl:
# أخبر letsencrypt بالشهادات الإضافية التي يجب الحصول عليها
- replace:
filename: "/etc/runit/1.d/letsencrypt"
from: /-d =domain= /
to: "-d =domain= -d =two=.=domain= -d =three=.=domain="
global: true
# لا تقم بإعادة توجيه جميع المضيفين مرة أخرى إلى اسم النطاق الرئيسي
- replace:
filename: "/etc/nginx/conf.d/discourse.conf"
from: /if \\(\\$http_host[^\\}]*\\}/m
to: ""
أضف إلى قسم after_postgres في app.yml أو data.yml
- exec: sudo -u postgres createdb =two= || exit 0
- exec:
stdin: |
grant all privileges on database =two= to discourse;
cmd: sudo -u postgres psql =two=
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql =two= <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql =two= <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql =two= <<< "create extension if not exists pg_trgm;"'
- exec: sudo -u postgres createdb =three= || exit 0
- exec:
stdin: |
grant all privileges on database =three= to discourse;
cmd: sudo -u postgres psql =three=
raise_on_fail: false
- exec: /bin/bash -c 'sudo -u postgres psql =three= <<< "alter schema public owner to discourse;"'
- exec: /bin/bash -c 'sudo -u postgres psql =three= <<< "create extension if not exists hstore;"'
- exec: /bin/bash -c 'sudo -u postgres psql =three= <<< "create extension if not exists pg_trgm;"'
بعد ذلك،
./launcher rebuild app
أو
./launcher rebuild data
./launcher rebuild web_only
I just tried it out, in fact I tried it twice because I couldn’t believe it just worked without any problems the first time already All I did was copying, adjusting the domains and password and then pasting into the respective files of a fresh installation with 2 containers.
Regards feedback whether anything is unclear, I only had to mull a bit over this paragraph:
It seems to suggest a 2-container setup is necessary to follow along, but then it isn’t. And I didn’t understand why it links to post 48 of the topic, rather than the initial post.
Thanks! I’ll take a look. Those both seem like the kind of careless things I was hoping you’d let me know about!
EDIT: Thanks! I’d carelessly copied my current location in the 2-container topic, so I fixed that, and changed the language to say that it’ll work with any working installation.
Hi
I started with a standard Discourse install (at DigitalOcean), then setup nginx (using these instructions) because I wanted a couple of Drupal sites on the same droplet
If I want to have another instance of Discourse should I follow the above?
These instructions are for not using a reverse proxy. I’d recommend that you follow Multisite configuration with Docker. The instructions that you linked might work, but I’d recommend that you first follow what’s here.
Thanks; I notice that with that both sites would use the same SMTP config
is there a way to bypass that?
or would the other guide be better (looks like it might require some work to put the existing site on the docker network)
alternately, is it possible to install another codebase, say /var/discourse2 ?
(it will cost me ~500MB but worth it if it saves me the brain damage)
Yes, but you just need to create a 2-container installation and then have a web_only2.yml. (I think that you can have 2 app.yml-style files, but then you’re needlessly running two postgres instances). I think, though, that you do need two redis instances.
Thanks; because I am not too familiar with splitting the data and web container I just created another standalone container following these guidelines (and certificates created by certbot seem to be working). However currently there seems to be an issue with mailgun config - it sends activation emails to gmail but anything mail hosted at my registrar (dreamhost) is failing
How much of a extra load would the extra Postgres instance causing?
I looked at your post about splitting and will try it if the savings were significant.
Recently I’ve been giving this a try, but I’m having trouble with a couple of things in the guide:
I can’t seem to find the Database password (or what it is even used for in the file)
My app.yml file did not originally contain an after_postgres section, so I added one under hooks to match the others (after_ssl, after_db_migrate, etc.). If this is placed in the wrong section, please let me know, I’m completely new to working with this type of stuff.
When I check the syntax of the YAML file on http://www.yamllint.com/ I get (<unknown>): did not find expected key while parsing a block mapping on the line where I put the after_postgres section under the hooks section.
If you could clarify the steps for editing the app.yml file, that would be greatly appreciated.
أفكر في إعداد هذا، حيث أرغب أنا وصديقي في اختبار العديد من المنتديات المختلفة قبل أن نقرر ما إذا كنا نريد استثمار المزيد فيها، وربما الحصول على استضافة منفصلة وما إلى ذلك.
كنت أفكر في وضعها على نطاقات مختلفة، وأتفهم أن هذا قد يسبب بعض الارتباك حيث سيتلقى الأشخاص رسائل البريد الإلكتروني من عنوان SMTP الرئيسي فقط، ومع ذلك، هل تعرف ما إذا كانت النطاقات المنفصلة ستسبب أي مشاكل أخرى؟
لدى Discourse نطاق واحد لجميع عملائه من الشركات والعملاء القياسيين. يمكنك جعل عنوان البريد الإلكتروني للإشعارات أي شيء تريده مثل shortname@whatevermail.com.
للأسف، لدي مشكلة في تشغيل منتديات ديسكورس إضافية على نفس الخادم/عنوان IP.
أولاً، اتبعت الوثائق لإنشاء موقع مستقل ونجح الأمر.
(على سبيل المثال: test.john.com - نطاق فرعي يعيد التوجيه إلى عنوان IP الفردي)
الآن عندما حاولت إضافة المزيد من منتديات ديسكورس (على سبيل المثال: test.joe.com و test.doe.com - نطاقات فرعية أخرى من مواقع مختلفة).
حاولت اتباع خطواتك ولكنها لم تنجح وأنا الآن تائه.
بعض الأسئلة:
كيف سيتم تثبيت هذين الموقعين الإضافيين؟ مثل نسخ /standalone.yml إلى دليل containers وإعادة تسميته؟ ثم القيام بالتثبيت العادي؟ (على سبيل المثال: ./launcher rebuild joe)
تشير تعليماتك إلى أن التغييرات يجب أن تكون في app.yml، وإلحاق كل التعليمات البرمجية أعلاه - والتي أفترض أنها ستضاف في الملف المثبت بنجاح أولاً (test.john.com)؟
بخلاف تلك الموجودة في دليل container، قمت بإنشاء config/multisite.yml وهذا ما تبدو عليه التعليمات البرمجية الخاصة بي:
لا. أنت تضيف الأشياء إلى app.yml كما هو موضح. سيؤدي ذلك إلى إنشاء mutlisite.yml داخل الحاوية. سيكون هناك مثيل واحد وسيعمل لجميع المجالات، نظرًا لأن نظام أسماء النطاقات (DNS) لجميعها يشير إلى هناك. هذا ليس لامتلاك حاويات Discourse متعددة، واحدة لكل اسم نطاق.
آخر مرة تحققت فيها، نجحت تلك التعليمات كما هي مكتوبة. فقط أضف الأسطر إلى ملف app.yml الخاص بك ويجب أن يعمل. لست بحاجة إلى لمس أي ملفات أخرى.
فيما يتعلق بجزء الترحيل، فشلت جميع التوليفات دائمًا… >> bundle exec rake multisite:migrate
********************** الجزء الأخير من العملية**************************
2023-02-11 17:50:43.853 UTC [61] LOG: إيقاف التشغيل
162:M 11 Feb 2023 17:50:43.866 # طلب المستخدم الإيقاف...
162:M 11 Feb 2023 17:50:43.866 * حفظ لقطة RDB النهائية قبل الخروج.
162:M 11 Feb 2023 17:50:43.881 * تم حفظ قاعدة البيانات على القرص
162:M 11 Feb 2023 17:50:43.882 # Redis جاهز الآن للخروج، وداعًا...
2023-02-11 17:50:44.007 UTC [57] LOG: تم إيقاف تشغيل نظام قاعدة البيانات
فشل
--------------------
Pups::ExecError: cd /var/www/discourse & sudo -E -u discourse bundle exec rake multisite:migrate فشل مع العودة #<Process::Status: pid 582 exit 1>
موقع الفشل: /usr/local/lib/ruby/gems/3.1.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
فشل التنفيذ مع المعلمات "cd /var/www/discourse & sudo -E -u discourse bundle exec rake multisite:migrate"
فشل التمهيد برمز خروج 1
** فشل التمهيد ** يرجى التمرير لأعلى والبحث عن رسائل خطأ سابقة، قد يكون هناك أكثر من واحدة.
قد يساعد ./discourse-doctor في تشخيص المشكلة.
لقد تحققت مما تم إنشاؤه وما لم يتم إنشاؤه حتى الفشل.
تم إنشاء قواعد بيانات النطاقات الفرعية ولكن الترحيل فشل. لم يتم إنشاء تكوينات nginx للنطاقات الفرعية أو multisite.yml عندما تحققت من مجلدات overlay2 أو في أي مكان.
./launcher bootstrap، destroy، start، stop، rebuild أو إعداد جديد عدة مرات… جربت جميع الأوامر ولكن لم يحدث شيء…
هل هذا البرنامج التعليمي لا يزال صالحًا لـ v3.1.0.beta 2 أم ماذا يمكن أن أكون قد فاتني؟
أي فكرة، من فضلك؟
لقد كنت أستخدم هذا الإعداد لسنوات مع خوادم الاختبار الخاصة بي. ومع ذلك، منذ التحديث إلى 3.5.0.beta5-dev، يتم الآن إعادة توجيهي إلى الموقع الأساسي كلما أدخلت نطاقًا فرعيًا.
لقد كنت سعيدًا جدًا لعدم الاضطرار إلى الدخول في كل أمور الشهادات. ولكن الآن أنا تائه تمامًا، هل هناك أدوات لتصحيح ما يحدث؟