Replies: 2 comments
-
What database environment variables are set in the running CKAN container? |
Beta Was this translation helpful? Give feedback.
0 replies
-
is the Postgres port on your external server open to outside (firewall)? This usually happens when either the port is closed or the Postgres service is down. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I built my docker ckan with the official ckan-docker repo from github (CKAN Version 2.10.1). But I removed the database container from the docker-compose.yml, because I need to use an external database on another server.
So in .env I edited the CKAN_SQLALCHEMY_URL to the external database, e.g:
CKAN_SQLALCHEMY_URL='postgresql://my_db_user:my_db_password@external_host/my_db_name'
.When I start the container with docker compose up -d,
the prerun.py will be executed.
The first function
check_main_db_connection()
inside prerun.py works correctly,but during second one it returns errors and the ckan Container gets the status unhealthy
from the container logs:
I don't unterstand, where it gets the "db" host name, but I tried a few things:
in my .env file I realized, that there is also an entry
CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db/datastore
with the host name "db", so I changed it to
CKAN_DATASTORE_READ_URL=postgresql://datastore_ro:datastore@db3/datastore
and after a restart of the docker container the error also changed from
psycopg2.OperationalError: could not translate host name "db" to address: Name does not resolve
to
psycopg2.OperationalError: could not translate host name "db3" to address: Name does not resolve
After that i removed the entries for the ckan datastore from the .env file (I don't need them in my ckan instance)
and after that the error changed to:
psycopg2.OperationalError: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
The same error happens when I manually try to use the command
ckan -c ckan.ini db init
.I know that the ckan container can connect to the external database, because the first function in prerun.py works fine and I could also connect to the database with psql and pg_isready from within the ckan container.
Why does ckan not use the db from sqlalchemy.url within the env file?
What can I change, so that the ckan container uses the correct db when I use
ckan -c ckan.ini db init
?Beta Was this translation helpful? Give feedback.
All reactions