Hi everyone,
I’m trying to configure Cairn in Tutor to use an external PostgreSQL database instead of the built-in one. I’m following the instructions from the Tutor Cairn repository, but I haven’t been able to get it working properly.
Goal:
The goal is to connect Cairn Superset to an external PostgreSQL database.
Steps Followed:
-
Disabled the built-in PostgreSQL in Tutor:
tutor config save --set CAIRN_RUN_POSTGRESQL=false
-
Set the connection details for the external PostgreSQL database:
tutor config save --set CAIRN_POSTGRESQL_HOST=<external_db_host> tutor config save --set CAIRN_POSTGRESQL_PORT=5432 tutor config save --set CAIRN_POSTGRESQL_DATABASE=<db_name> tutor config save --set CAIRN_POSTGRESQL_USERNAME=<db_user> tutor config save --set CAIRN_POSTGRESQL_PASSWORD="<db_password>"
-
Launched an external PostgreSQL container:
docker run -d --name <external_db_container> \ -e POSTGRES_USER=<db_user> \ -e POSTGRES_PASSWORD=<db_password> \ -e POSTGRES_DB=<db_name> \ -v <external_db_volume>:/var/lib/postgresql/data \ --network=tutor_default \ postgres:14
-
Verified that the container is running and the database is accessible:
docker exec <external_db_container> bash -c "psql -U <db_user> -d <db_name> -c 'SELECT datname FROM pg_database;'"
- Output:
datname ----------- postgres <db_name> template1 template0 (4 rows)
- Output:
-
Rebuilt the Tutor environment and restarted services:
rm -rf "$(tutor config printroot)/env" tutor config save tutor local stop tutor local start -d
Issue:
Even though all configurations are set, Cairn Superset continues to look for cairn-postgresql
instead of the new external database. The error message I receive is:
service "cairn-superset" depends on undefined service "cairn-postgresql": invalid compose project
Running:
grep -r "cairn-postgresql" "$(tutor config printroot)/env"
I found references to cairn-postgresql
in the following files:
superset_config.py
docker-compose.yml
docker-compose.jobs.yml
I manually replaced all occurrences of cairn-postgresql
with <external_db_host>
, but when I restart Tutor, it seems to overwrite these files and revert to the default settings.
System Details:
- Tutor version: (19.0.0)
- OS: macOS (MacBook with M3 chip)
- Docker version: (28.0.1)
- PostgreSQL version: 14 (running as a Docker container)
- Cairn plugin version: (19.0.0)
Questions:
- Is there an additional step needed to make Cairn recognise the new PostgreSQL database?
- Do I need to modify any additional files that I might have missed?
- Has anyone successfully configured Cairn to use an external PostgreSQL instance instead of the default one?
Any help would be greatly appreciated! Thanks in advance!