R
Railway11mo 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
Percy11mo ago
Project ID: e35c6535-fa60-4402-b954-796421cb36c3
Jack
Jack11mo ago
e35c6535-fa60-4402-b954-796421cb36c3
Brody
Brody11mo ago
are you running migrate in the build stage?
thomas
thomas11mo 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
Brody11mo ago
true true
Jack
Jack11mo ago
Still doesn't work, and not sure.
Brody
Brody11mo ago
same Can't reach database server?
Jack
Jack11mo ago
Yeah. Not sure, it may be but idk.
Brody
Brody11mo ago
can you add a 3 second sleep to the beginning of the start command
Jack
Jack11mo ago
Not sure what the rest of the start command is but I can see
Brody
Brody11mo ago
sleep 3 && <whatever the current start command is>
Jack
Jack11mo ago
No description
Jack
Jack11mo ago
Should I set the start command to yarn database:setup first? after the sleep
Brody
Brody11mo ago
is this a ghost docker image?
Jack
Jack11mo ago
Ghostfolio
Jack
Jack11mo 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
Brody11mo ago
are you deploying from its docker image?
Jack
Jack11mo ago
Yes.
Brody
Brody11mo ago
https://github.com/ghostfolio/ghostfolio/blob/main/Dockerfile#L61 so your new start command should be sleep 3 && yarn start:production
Jack
Jack11mo ago
Got it, thank you, let me try it Marked deployment completed but no logs
Brody
Brody11mo ago
and it has been more than 3 seconds right
Jack
Jack11mo ago
Yeah
Brody
Brody11mo ago
try this instead /bin/sh -c "sleep 3 && yarn start:production"
Jack
Jack11mo 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
Brody11mo ago
redeploy?
Jack
Jack11mo 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
Brody11mo ago
okay going to try to deploy it myself
Jack
Jack11mo 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
Brody11mo ago
im setting up the project and ill get back to you
Jack
Jack11mo ago
Okay, thank you
Brody
Brody11mo ago
might make a template too
Jack
Jack11mo ago
Nooo I was gonna 😭
Brody
Brody11mo ago
okay, ill make the template and give it to you
Jack
Jack11mo 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
Brody11mo 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
Jack11mo ago
thank you 😘 😭 😭
Brody
Brody11mo ago
haha no problem!
Want results from more Discord servers?
Add your server