R
Railway12mo ago
Jack

Postgres database, "Can't reach database server"

Checked old posts, of which suggested sleeping the project before start, and/or adding ?connect_timeout=300 to the end of the DATABASE_URL variable would resolve the issue, did not, the project is continuing to erorr with the following console output.
yarn run v1.22.19

$ yarn database:migrate && yarn database:seed && node main

$ prisma migrate deploy

Prisma schema loaded from prisma/schema.prisma

Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"

Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comman
yarn run v1.22.19

$ yarn database:migrate && yarn database:seed && node main

$ prisma migrate deploy

Prisma schema loaded from prisma/schema.prisma

Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"

Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comman
repo: https://github.com/ghostfolio/ghostfolio/tree/main Image: https://hub.docker.com/r/ghostfolio/ghostfolio (used)
GitHub
GitHub - ghostfolio/ghostfolio: Open Source Wealth Management Softw...
Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍 - GitHub - ghostfolio/ghostfolio: Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + Type...
37 Replies
Percy
Percy12mo ago
Project ID: e35c6535-fa60-4402-b954-796421cb36c3
Jack
JackOP12mo ago
e35c6535-fa60-4402-b954-796421cb36c3
Brody
Brody12mo ago
are you running migrate in the build stage?
thomas
thomas12mo ago
It is possible that this is related to our current incident, please see updates here #🚨|incidents I will also circle back and update threads when it's resolved
Brody
Brody12mo ago
true true
Jack
JackOP12mo ago
Still doesn't work, and not sure.
Brody
Brody12mo ago
same Can't reach database server?
Jack
JackOP12mo ago
Yeah. Not sure, it may be but idk.
Brody
Brody12mo ago
can you add a 3 second sleep to the beginning of the start command
Jack
JackOP12mo ago
Not sure what the rest of the start command is but I can see
Brody
Brody12mo ago
sleep 3 && <whatever the current start command is>
Jack
JackOP12mo ago
No description
Jack
JackOP12mo ago
Should I set the start command to yarn database:setup first? after the sleep
Brody
Brody12mo ago
is this a ghost docker image?
Jack
JackOP12mo ago
Ghostfolio
Jack
JackOP12mo ago
GitHub
GitHub - ghostfolio/ghostfolio: Open Source Wealth Management Softw...
Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍 - GitHub - ghostfolio/ghostfolio: Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + Type...
Brody
Brody12mo ago
are you deploying from its docker image?
Jack
JackOP12mo ago
Yes.
Brody
Brody12mo ago
https://github.com/ghostfolio/ghostfolio/blob/main/Dockerfile#L61 so your new start command should be sleep 3 && yarn start:production
Jack
JackOP12mo ago
Got it, thank you, let me try it Marked deployment completed but no logs
Brody
Brody12mo ago
and it has been more than 3 seconds right
Jack
JackOP12mo ago
Yeah
Brody
Brody12mo ago
try this instead /bin/sh -c "sleep 3 && yarn start:production"
Jack
JackOP12mo ago
Worked, now this
[Nest] 172 - 12/14/2023, 9:02:49 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +28ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
[Nest] 172 - 12/14/2023, 9:02:49 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +28ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
Brody
Brody12mo ago
redeploy?
Jack
JackOP12mo ago
[Nest] 172 - 12/14/2023, 9:02:49 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +28ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
[Nest] 172 - 12/14/2023, 9:02:49 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +28ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
Oops didn’t copy
Brody
Brody12mo ago
okay going to try to deploy it myself
Jack
JackOP12mo ago
[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [RedisCacheService] Error: Redis connection to redis.railway.internal:6379 failed - getaddrinfo ENOTFOUND redis.railway.internal

[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [RedisCacheService] Error: Redis connection to redis.railway.internal:6379 failed - getaddrinfo ENOTFOUND redis.railway.internal

[Nest] 171 - 12/14/2023, 9:07:53 PM LOG [NestApplication] Nest application successfully started +94ms

[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +25ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [RedisCacheService] Error: Redis connection to redis.railway.internal:6379 failed - getaddrinfo ENOTFOUND redis.railway.internal

[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [RedisCacheService] Error: Redis connection to redis.railway.internal:6379 failed - getaddrinfo ENOTFOUND redis.railway.internal

[Nest] 171 - 12/14/2023, 9:07:53 PM LOG [NestApplication] Nest application successfully started +94ms

[Nest] 171 - 12/14/2023, 9:07:53 PM ERROR [NestApplication] Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080 +25ms

node:internal/errors:496

ErrorCaptureStackTrace(err);

^

Error: listen EADDRNOTAVAIL: address not available 104.196.232.237:8080

at Server.setupListenHandle [as _listen2] (node:net:1800:21)

at listenInCluster (node:net:1865:12)

at GetAddrInfoReqWrap.doListen [as callback] (node:net:2014:7)

at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:8) {

code: 'EADDRNOTAVAIL',

errno: -99,

syscall: 'listen',

address: '104.196.232.237',

port: 8080

}

Node.js v18.19.0

error Command failed with exit code 1.
Brody
Brody12mo ago
im setting up the project and ill get back to you
Jack
JackOP12mo ago
Okay, thank you
Brody
Brody12mo ago
might make a template too
Jack
JackOP12mo ago
Nooo I was gonna 😭
Brody
Brody12mo ago
okay, ill make the template and give it to you
Jack
JackOP12mo ago
I have tons I wanna make templates for, we can share a list if u want And work em out on free time
Brody
Brody12mo ago
sounds cool it uses redis for cache, and the underlying redis package it uses for that is from 4 years ago, it doesnt support ipv6 that will make two of your templates that cant use the private network for redis haha i hereby give you permission to fork and publish this template https://railway.app/button?code=6g5rX1
Jack
JackOP12mo ago
thank you 😘 😭 😭
Brody
Brody12mo ago
haha no problem!
Want results from more Discord servers?
Add your server