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:
(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
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...13 Replies
Project ID:
5bfbaa81-648f-4407-b75c-e9d1c2cb5841
youre builing with a dockerfile right? is it based on an alpine image?
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 quoso sorry, i meant dockerfile
so its FROM ghcr.io/railwayapp/nixpacks:ubuntu-1695686596@sha256:863c9103f1ec289f4d8d56a656945c673b2d580080b96738e966e52e49463387
okay, you are building with nixpacks, got it
Solution
can you add a 2 second sleep before you start your app?
will try! will suffice in the nix startcmd I reckon β trying
just wherever you currently have your start command set
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 !no problem!
make sure to use a health check now that you are delaying app start so that railway knows when your app actually has started
thanks, will look into that!