Deployment crashed due to server connection not established (postgresql)

bhekisileTRIAL

10 months ago

It's my first time using this service to deploy a Rails application. I don't know what I'm doing wrong because it's building successfully, but when it comes to deployment, it's failed. The error I got is related to the database. The Postgresql database is open. I can run the application on the browser using the 'rails s' command.

Here is the log:
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?

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?

Tasks: TOP => db:prepare

(See full trace by running task with --trace)

Thank you for your assistance in advance.

Bhekisile

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

7 Replies

10 months ago

/var/run/postgresql/.s.PGSQL.5432 would be where the database client looks to connect to the database by default, it's safe to say that's now how you can access databases on Railway, you will need to properly configure your database client to connect to the database with environment variables.


bhekisileTRIAL

10 months ago

Thank you for your response. The deploy logs are alright now, having touched anything. However, the application failed to respond. I've got two errors under the production logs, as attached.

Which I thought was still a server error, and I added into the variables environment (HOST: 0.0.0.0) and the PORT number that I got from the database environment. The Postgres deploy logs error is attached.

Thank you

Attachments


10 months ago

Please show me the config for your database client in code, you still have something misconfigured.


bhekisileTRIAL

10 months ago

Please find as requested.

Attachments


10 months ago

Have you specified a DATABASE_URL service variable in Railway, and are you running your app in production mode when on Railway?


Status changed to Solved railway[bot] 10 months ago


bhekisileTRIAL

10 months ago

The DATABASE_URL I used is from Railway Postgres. I've attached both service variables because I'm getting confused about which one I should have used.

Attachments


bhekisileTRIAL

10 months ago

Thank you, Brody, for your assistance. I've changed to CDN bootstrapping, and since then it's been working.