External Postgresql Connection

I am trying to connect my Mayan App container to an externally hosted Postgres database. I am getting the following error:

port postgresql:5432; [Errno -2] Name or service not known

.env has the following for the Host:
MAYAN_DATABASE_HOST=mayan-server-database.cigoklwsywib.us-east-1.rds.amazonaws.com

I have also added Docker DNS configuration settings to assist in name resolution. This change from Error no -3 to Errorno -2.

I am able to connect to the postgres database from the system hosting the docker containers.

Please follow the process in the tutorial:

Connecting Mayan EDMS to an external PostgreSQL database

This will connect Mayan EDMS to an external database only. If there is existing content, it needs to be imported over from the existing database to the new one before proceeding with the change.

Thanks. That got me past the container startup. The database now has a connection error:

django.db.utils.OperationalError: connection to server at “mayan-server-database.cigoklwsywib.us-east-1.rds.amazonaws.com” (10.255.165.18), port 5432 failed: could not open certificate file “/root/.postgresql/postgresql.crt”: Permission denied

I have determined a work around for the issue. It appears that the SSL connection is forcing the Client Certificate and Key files as well as the Root Cert file to be read even if they are not needed (PGSSLMODE=require) does not need these files. After several attempts to include the files, I set options in the docker-compose.yml to bogus names and now it is able to connect:

MAYAN_DATABASES: "{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'${MAYAN_DATABASE_NAME:-mayan}','PASSWORD':'${MAYAN_DATABASE_PASSWORD:-mayandbpass}','USER':'${MAYAN_DATABASE_USER:-mayan}','HOST':'${MAYAN_DATABASE_HOST:-postgresql}','OPTIONS':{'sslmode': 'require', 'sslcert': 'cert', 'sslkey': 'key'},'CONN_MAX_AGE':${MAYAN_DATABASE_CONN_MAX_AGE:-0}}}"
1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.