Supponiamo che tu stia utilizzando AWS RDS o un server PostgreSQL esistente gestito altrove. È abbastanza semplice configurare Discourse per utilizzare una tale configurazione, senza la necessità di concedere privilegi di superutente a qualsiasi cosa Discourse stesso esegua. Ecco come.
Prerequisiti
Discourse richiede che la versione principale di PostgreSQL corrisponda a quella che forniamo nelle nostre immagini docker; se si tenta di eseguire su una versione più recente o precedente, potrebbe funzionare, ma non lo garantiamo, e se qualcosa si rompe in futuro, ti terrai entrambi i pezzi. Richiediamo anche alcune estensioni distribuite nel pacchetto postgresql-contrib (o il suo equivalente).
Genera casualmente una password per la connessione (più di 20 caratteri). In questa guida, useremo s3kr1t come segnaposto.
Configurazione del DB
Come superutente del database, esegui quanto segue:
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)