R
Railwayβ€’13mo ago
yrnsmth

New deploy crashing on pg_dump

I'm attempting to deploy a rails 6 app from GitLab into Railway. It's in api-only mode, and is backed with postgres. It also makes use of a structure.sql instead of the default schema.rb I keep getting this fatal error after the initial migrate task:
rake aborted!
failed to execute:
pg_dump --schema-only --no-privileges --no-owner --file /app/db/structure.sql railway
Please check the output above for any errors and make sure that `pg_dump` is installed in your PATH and has proper permissions.
rake aborted!
failed to execute:
pg_dump --schema-only --no-privileges --no-owner --file /app/db/structure.sql railway
Please check the output above for any errors and make sure that `pg_dump` is installed in your PATH and has proper permissions.
I'm also getting the following error directly below:
rake aborted!
ActiveRecord::NoDatabaseError: could not translate host name "postgres.railway.internal" to address: Name or service not known
...trace...
Caused by:
PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known
rake aborted!
ActiveRecord::NoDatabaseError: could not translate host name "postgres.railway.internal" to address: Name or service not known
...trace...
Caused by:
PG::ConnectionBad: could not translate host name "postgres.railway.internal" to address: Name or service not known
What I don't understand is that the initial table migration worked. All my tables have been built out in the postgres service. So the two services are talking to each other. Do I need to add a build command in the procfile to put pg_dump in the path? Am I missing anything simple? I'm happy to post the full traces - but they were turning my code blocks into attachments πŸ™ƒ.
13 Replies
Percy
Percyβ€’13mo ago
Project ID: 1e4b0651-0174-42a1-aac8-4081f16bb807
yrnsmth
yrnsmthOPβ€’13mo ago
1e4b0651-0174-42a1-aac8-4081f16bb807
Brody
Brodyβ€’13mo ago
are these errors coming from the build logs on railway?
yrnsmth
yrnsmthOPβ€’13mo ago
They're coming from the deploy logs, but yes, on railway
Brody
Brodyβ€’13mo ago
are you installing pg_dump?
yrnsmth
yrnsmthOPβ€’13mo ago
Not intentionally? I presumed it was a postgres extension? That's the impression I got trying to google the errors
Brody
Brodyβ€’13mo ago
haha railway isnt going to magically install pg_dump for you
yrnsmth
yrnsmthOPβ€’13mo ago
Right. Thing is, I don't recall installing into my local (though I could have - it was aaages ago that I switched to the schedule.sql) And I'm not sure how to install things into the environment - in Heroku I could access the dyno directly from my local terminal So do I do this as a build step?
Brody
Brodyβ€’13mo ago
add a nixpacks.toml to your project with this in it
[phases.setup]
nixPkgs = ['...', 'postgresql']
[phases.setup]
nixPkgs = ['...', 'postgresql']
yrnsmth
yrnsmthOPβ€’13mo ago
Oooh, righton. I'll lookup the documentation for nixpacks then. Thanks for your help!
Brody
Brodyβ€’13mo ago
https://nixpacks.com/docs/configuration/file but for now, just add that file as i have provided
yrnsmth
yrnsmthOPβ€’13mo ago
Thanks mate, much appreciated! Gotta get back to the day job (sorry, wasn't expecting a reply straight away πŸ˜† )
Brody
Brodyβ€’13mo ago
haha no problem!
Want results from more Discord servers?
Add your server