Digamos que estás utilizando AWS RDS o un servidor PostgreSQL existente gestionado en otro lugar. Es bastante sencillo hacer que Discourse utilice dicha configuración, sin necesidad de otorgar privilegios de superusuario a nada que Discourse ejecute. A continuación, te explicamos cómo.
Prerrequisitos
Discourse requiere que la versión principal de PostgreSQL coincida con la que incluimos en nuestras imágenes de docker; si intentas ejecutarlo en una versión más nueva o más antigua, podría funcionar, pero no lo garantizamos, y si algo se rompe en el futuro, te quedas con ambas piezas. También requerimos algunas extensiones que se distribuyen en el paquete postgresql-contrib (o su equivalente).
Genera aleatoriamente una contraseña para la conexión (más de 20 caracteres). En esta guía, usaremos s3kr1t como marcador de posición.
Configuración de la DB
Como superusuario de la base de datos, ejecuta lo siguiente:
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)