Unik6065
Unik6065

Reputation: 103

Problem while trying to connect my database with jelastic cloud and ruby on rails

I am currently trying to create a small web app, where you can connect and disconnect yourself.

I am using ruby on rails with a postgresql node on jelastic cloud. When I run the command "rails db:create" in order to create the database, the following error message appears :

"PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?"

I do not know what to do, because of course the server is not running locally, but on another node. I do not know how to say to ruby that it has to create the database on this separated node, and not on the local node.

I have tried to change the host, username and password variables on the .env file, but it still does not seem to work...

I am pretty sure that the problem must be a config mistake or an oversight, but I do not have any clue where it may occurs...

If any one could help me, it would be great

Thanks

Upvotes: 0

Views: 145

Answers (1)

Franck Perrin
Franck Perrin

Reputation: 30

I had the exact same problem until yesterday evening.

The issue was that database url need to start with 'postgresql://'.

Hence, defining DATABASE_URL env var to 'postgresql://node??????' (put your own host reference) solves it.

Hope this helps.. Regards,

Upvotes: 0

Related Questions