16 days ago
Hi,
I can somehow get the Rails app to deploy by setting DATABASE_URL to a dummy value like something, but setting it to the PostgreSQL connection string given by Supabase gives the following error in the deploy logs (build logs seem to succeed):
Tasks: TOP => db:prepare
(See full trace by running task with --trace)
bin/rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (ActiveRecord::ConnectionNotEstablished)
Is the server running locally and accepting connections on that socket?
connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting connections on that socket?
connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?The app is the stock Rails 8.1.2 app generated by rails new my_app -d postgresql --api; the only weirdness is that the files aren't at the root of the Git repo, but I specified the “Root Directory” setting for the app on Railway. I'm using the IPv4 connection string from Supabase.
2 Replies
Status changed to Awaiting Railway Response Railway • 16 days ago
15 days ago
I didn't specify a $10 bounty, I don't know why that's there.
15 days ago
>With the nested primary: key in Rails 8, the merge behavior can break.
Thank you. I'd read this comment before:
# Connection URLs for non-primary databases can also be configured using
# environment variables. The variable name is formed by concatenating the
# connection name with `_DATABASE_URL`. For example:
#
# CACHE_DATABASE_URL="postgres://cacheuser:cachepass@localhost/cachedatabase"but somehow didn't connect that with having to specify the non-primary URLs if there's a primary: key; I thought they would just default to inheriting from the primary URL.
I was able to fix production by specifying all of DATABASE_URL, CACHE_DATABASE_URL, QUEUE_DATABASE_URL, CABLE_DATABASE_URL (setting all to duplicates of the same value). Staging is trickier, as I don't want to use the same Supabase DB, but separate DBs is a paid addon which I can't justify yet; in the end, this means I'll probably just have to use Railway's built-in databases, anyway.
But this was informative. Thanks again!
Status changed to Solved habibalamin • 15 days ago