لنفترض أنك تستخدم AWS RDS، أو خادم PostgreSQL موجود مُدار في مكان آخر. من السهل جدًا جعل Discourse يستخدم هذا الإعداد، دون الحاجة إلى منح امتيازات المستخدم الخارق (superuser) لأي شيء يقوم به Discourse نفسه. إليك الطريقة.
المتطلبات الأساسية
يتطلب Discourse أن يتطابق الإصدار الرئيسي لـ PostgreSQL مع ما نوزعه في صور Docker الخاصة بنا؛ إذا حاولت التشغيل على إصدار أحدث أو أقدم، فقد يعمل الأمر، ولكننا لا نضمن ذلك، وإذا تعطل شيء ما في المستقبل، فستحتفظ بالقطعتين. نطلب أيضًا بعض الإضافات (extensions) الموزعة في حزمة postgresql-contrib (أو ما يعادلها).
قم بإنشاء كلمة مرور عشوائية للاتصال (20 حرفًا أو أكثر). في هذا الدليل، سنستخدم s3kr1t كعنصر نائب.
إعداد قاعدة البيانات (DB)
بصفتك مستخدمًا خارقًا لقاعدة البيانات، قم بتشغيل ما يلي:
This isn’t supposed to be a comprehensive description of every possible way you can configure your database connection, rather it’s a quick howto to make things a bit easier.
Hi, first thanks for this guide. I try to setup external postgresql on the same machine, where docker installed. Do I need to bind port of my external postgresql 5432 to docker? Could anybody assist how to do it, using Discourse configuration file?
I follow the instruction a the top. First I set up an ordinary docker, it works. Then I want to switch the application to external postgres. When I rebuild the app, I get an error
Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
My server has not a FQDN yet, I use 127.0.0.1 as a DB host. The database is listening on 127.0.0.1:5432, I am able to connect with psql. Where am I wrong? I tried to play with pg_hba.conf but no success, of course.
Hi guys, possible of my personal server configuration or what else… But I found a solution by running a docker in hosted mode (not bridged as default):
After that the discourse engine could connect to external postgres database, run at 127.0.0.1:5432. Default bridged mode does not allow docker to access ports listening at the host without tricks.
When I run ./launcher rebuild app, I get this error PG::ConnectionBad: timeout expired during the bundle exec rake db:migrate. Has anyone comes across this issue? I can successfully access the database with a postgres client.
That variable should go into the file where you declared postgres variables. Just be warned that exposing redis for a production environment is lethal. (Because of poor security practices of redis itself)