I’m trying to set up discourse in my local development environment with only a small difference: I’m running Postgres in docker.
The database is accessible using psql from the OS, but when I tried to create the database using rake or rails, it doesn’t work. I followed these steps:
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?
Couldn't create 'discourse_development' database. Please check your configuration.
rails aborted!
ActiveRecord::NoDatabaseError: 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?
Caused by:
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?
Tasks: TOP => db:create
(See full trace by running task with --trace)
I’m not certain, but I think the problem is probably that discourse is running inside a docker container, and so can’t by default access your separate postgres container.
Discourse is not running inside a docker container, it’s running in my OS. Postgres is running inside a container, and I exposed its port to the OS -p 5432:5432.
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?
Couldn't create 'discourse_development' database. Please check your configuration.
rails aborted!
ActiveRecord::NoDatabaseError: 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?
Caused by:
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?
Tasks: TOP => db:create
(See full trace by running task with --trace)
No it just means the the default socket takes priority of the port declaration. One way to get around that is using the url key, but you can check Rails code to see other ways.