#Docker container on local dev system does not connect to DB

1 messages · Page 1 of 1 (latest)

leaden eagle
#

Hi Trigger Dev team,
I am writing an application usinhg supabase and came across trigger.dev for running jobs. Seemed like a perfect fit, since I may need to deploy both on prem and on cloud. I followed the instruction given at https://github.com/triggerdotdev/docker . However the trigger.dev server is unable to connect to postgres db. I tried using both supabase DB as well as a standalone db for trigger.dev and but in both cases this error keeps coming 'Can't reach database server at 127.0.0.1:5432' . have tried different combination of ports and url but it just wont connect. However I can connect to the DB using a SQL client such as HeidiSQL . Detailed logs are attached. In the logs at some places there is a message 'prisma client connected' , 'app ready: http://localhost:3030' but then again the same 'Cant reach database server...' starts coming.

Have searched the net and all around but to no avail. Would really appreciate your help on this .. Thanks in advance

GitHub

Docker templates for self-hosting and running the Trigger.dev platform locally - GitHub - triggerdotdev/docker: Docker templates for self-hosting and running the Trigger.dev platform locally

hushed trellis
#

Hi @leaden eagle,

Did you modify the default Docker compose file from our Docker repo? If so, can you share it here.

By default the db is exposed on 5432 internally, and 5433 externally. My guess is that you're trying to use an external postgres DB that isn't part of the same docker network so can't be connected to using that address.

leaden eagle
#

Hi @hushed trellis , i tried with both internal as well as external DBs and in both cases, the outcome was the same . Here are my env and docker-compose files and I still get the same error.

hushed trellis
#

The DB host should be triggerdotdev-database not 127.0.0.1.

DATABASE_URL=postgresql://postgres:postgres@triggerdotdev-database:5432/postgres?schema=triggerdotdev&connect_timeout=300 should work, if not, just use the .env file from the docker repo:

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
DATABASE_HOST=triggerdotdev-database:5432
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
leaden eagle
#

Thanks a lot !! Its working now. Much appreciated ..