R
Railwayβ€’13mo ago
meta_leap

DB: Services gets the right env var value, private networking enabled on both, still not reachable

Both my postgres:latest instance and my service have private networking enabled, and are in the same project. My service also receives correctly the DATABASE_PRIVATE_URL env var, because its connection error message reads: failed to connect to 'host=postgres.railway.internal user=postgres database=railway': hostname resolving error (lookup postgres.railway.internal on 8.8.8.8:53: no such host) What might I be missing still? That's all the setup I have for DB and all I thought necessary =)
(For whoever is curious and has access, that project is railway.app/project/5bfbaa81-648f-4407-b75c-e9d1c2cb5841 ) Probably very related: right now I'm pushing a pre-built binary without a Dockerfile (so nix buildCmd just chmod+x) so I'm not sure about the resolv.conf situation pertaining to the container that Railway's server-side redeploy run then seemingly generates...
Solution:
can you add a 2 second sleep before you start your app?
Jump to solution
13 Replies
Percy
Percyβ€’13mo ago
Project ID: 5bfbaa81-648f-4407-b75c-e9d1c2cb5841
Brody
Brodyβ€’13mo ago
youre builing with a dockerfile right? is it based on an alpine image?
meta_leap
meta_leapOPβ€’13mo ago
I just added a para addressing this very question β€” it's just a binary and railway.toml and the server-side deploy runner seems to make a container image anyway, so that's the current status quo
Brody
Brodyβ€’13mo ago
so sorry, i meant dockerfile
meta_leap
meta_leapOPβ€’13mo ago
so its FROM ghcr.io/railwayapp/nixpacks:ubuntu-1695686596@sha256:863c9103f1ec289f4d8d56a656945c673b2d580080b96738e966e52e49463387
Brody
Brodyβ€’13mo ago
okay, you are building with nixpacks, got it
Solution
Brody
Brodyβ€’13mo ago
can you add a 2 second sleep before you start your app?
meta_leap
meta_leapOPβ€’13mo ago
will try! will suffice in the nix startcmd I reckon β€” trying
Brody
Brodyβ€’13mo ago
just wherever you currently have your start command set
meta_leap
meta_leapOPβ€’13mo ago
on it πŸ‘ sleep 2s && ./my_exec didnt do it, now upping to 4s and put it right in the codebase, out of startcmd, waiting... that works better, now we're further in into the startup phase. oddly, table creation of table2 referring to successfully previously created table1 fails with "does not exist" (not a prob in local dev), but that's a different issue... thanks once again for now @Brody !
Brody
Brodyβ€’13mo ago
no problem!
Brody
Brodyβ€’13mo ago
make sure to use a health check now that you are delaying app start so that railway knows when your app actually has started
meta_leap
meta_leapOPβ€’13mo ago
thanks, will look into that!
Want results from more Discord servers?
Add your server