but I am getting this error in logs post deployment while trying to run he service:
[Nest] 9 - 09/07/2024, 7:31:25 PM ERROR ;5;3m[ExceptionHandler] Error: getaddrinfo EAI_AGAIN j4g44okskok04cks4kwogkkg
Error: Error: getaddrinfo EAI_AGAIN j4g44okskok04cks4kwogkkg
at NcConfig.create (/usr/src/app/docker/main.js:2:2228217)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async InstanceWrapper.useFactory [as metatype] (/usr/src/app/docker/main.js:2:1830025)
at async Injector.instantiateClass (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:369:37)
at async callback (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:65:34)
at async Injector.resolveConstructorParams (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:144:24)
at async Injector.loadInstance (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:70:13)
at async Injector.loadProvider (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:97:9)
at async /usr/src/app/node_modules/@nestjs/core/injector/instance-loader.js:56:13
at async Promise.all (index 3)
Which means postgres client is unable to resolve the hostname of the pg service. To ensure this is not a coolify issue I created a simple nodejs application and added it to the same project. It was able to access pg service using the same hostname.
It doesn’t. All numbers and letters. The error is caused by hostname resolution before even trying to connect. Also the hostname in the error message is correct which means the env variable was read properly.
I only figured out that knex is able to resolve the db container hostname inside my application, hence theoretically everything should work accordingly in nocodb. But it still doesn’t work in nocodb. I used the same knex json in NC_DB_JSON and I tried both methods: a connection object and a connection string url for the connection key. Both methods worked inside my application, and didn’t work inside nocodb
I only figured out that knex is able to resolve the db container hostname inside my application
Can you give more details on this, Is your application running as a container ? If not then it looks like the host name not avail inside the nocodb container.
If you are using docker compose then can you share the compose file ? Although from where the j4g44okskok04cks4kwogkkg hostname is derived? Is it a container id or did you added it in hosts file ?
Coolify uses nixpacks to run my application inside a container. This container is part of the same project that also has pg container and nocodb container. They are connected together with a docker network also managed by coolify.
j4g44okskok04cks4kwogkkg is the pg container name which should be resolved by the docker network to point to the correct container. Inside my application this resolution happens and my application is able to connect to pg using knex.
What is auto-upstall ?
Auto-upstall is the fastest way to install NocoDB with SSL, auto-upgrades with every release, and auto-renews your SSL — all within just 2 minutes!
How it works when we run it ? :
First it automatically installs all pre-requisites on your linux based server (docker, docker-compose)
Then automatically installs
🇳 NocoDB,
PostgreSQL,
Redis,
Minio,
Traefik gateway.
Also automatically upgrades NocoDB when new versions are available.
And finally automatically sets up SSL that auto-renews!
Thank you for your suggestion and time, but this does not solve the case of installing NocoDB on coolify which is what I am trying to achieve. I am sure installing NocoDB directly on the server will work but this is not what I’m trying to do. It needs to be installed on coolify.
Coolify allows you to run commands inside the container. I am able to ping the container name from inside my app container but not nocodb container. I got the IP address of the PG container from my application. I am able to ping it from inside nocodb container. I used the IP address as the hostname in NC_DB_JSON but received the new exception:
[Nest] 8 - 09/10/2024, 6:43:53 PM ERROR ;5;3m[ExceptionHandler] KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
Error: KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
at NcConfig.create (/usr/src/app/docker/main.js:2:2228217)
at async InstanceWrapper.useFactory [as metatype] (/usr/src/app/docker/main.js:2:1830025)
at async Injector.instantiateClass (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:369:37)
at async callback (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:65:34)
at async Injector.resolveConstructorParams (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:144:24)
at async Injector.loadInstance (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:70:13)
at async Injector.loadProvider (/usr/src/app/node_modules/@nestjs/core/injector/injector.js:97:9)
at async /usr/src/app/node_modules/@nestjs/core/injector/instance-loader.js:56:13
at async Promise.all (index 3)
at async InstanceLoader.createInstancesOfProviders (/usr/src/app/node_modules/@nestjs/core/injector/instance-loader.js:55:9)
Hey @shady, at this juncture - I would like you to urge to figure it out by running a bare minimal docker compose on a VPS with postgres to check how it works. And there are like 1000s of installations running like this. It will help you figure the missing parts with coolify. Its beyond us to support / figure what is going wrong specially at coolify.
I am using coolify application installation which pulls nocodb/nocodb docker image and deploys it. I do not make any changes to the docker-compose file. It’s just a setting in coolify that forces containers in docker-compose deployments to use the coolify network and not its own.
I was able to reach PG container from NocoDB instance, but for some reason this deployment wont even read the env variables directly from coolify, I had to edit docker-compose in coolify under service stack and add those: