I'm trying to setup a rails environment development on a Windows 10.
I follow the tutorial of 'go_rails' (https://gorails.com/setup/windows/10)
Most of the installation seems to worked fine (when i type rby -v or rails -v in the bash it's return the expected result).
My issue is with postresql which is used for the project i work on it.
Following the instructions of the tutorial i install Postgresql (10) directly on Windows. It's seems to work since in can login using the pgadmin on windows or by typing 'psql -p 5432 -h localhost -U postgres' in the bash.
So it's look like postgresql is working, but when i do a rake db:create in bash, i got an error : could not connect to the server: No such file or directory. Is the server running locally and accepting connections on Unix domain socket '/var/run/postgresql/.s.PGSQL.5432'
In the postgresql.conf (C:/Programms/.../Data/postgresql.conf) the listen_addresses is set to '*'.
A bit after there is a line named '#unix_socket_directoris = ''', do you thing i should set something in there?
I really need to get that project work.
Thanks for your help
The problem is likely that you've installed the Windows binary for PostgreSQL, but you're trying to connect to it from Windows Subsystem for Linux using a Unix socket, which doesn't exist.
You need to use TCP/IP to connect rather than a Unix socket. When typing psql on the command line, add the option --host=127.0.0.1 to connect via TCP/IP.
I just went through the entire Go Rails tutorial and I also had trouble at the rake db:create step. All you need to do is add host: 127.0.0.1 to your database.yml as shown below. Make sure to Start PostgreSQL before you run rake db:create.
default: &default
host: 127.0.0.1
adapter: postgresql
encoding: unicode
username: postgres
password: ENV['POSTGRESQL_PASSWORD']
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: app_development
test:
<<: *default
database: app_test
production:
<<: *default
database: app_production
username: app_username
password: <%= ENV['APP_DATABASE_PASSWORD'] %>
Add host: localhost to your default: in database.yml. Without something telling rails where to look for the host, it looks for the process in linux, which, of course, won't work, since windows processes are not exposed to the wsl layer.
Related
This is my 3rd day in a row trying to start a new app using Postgresql w/ Ruby on rails with wsl ubuntu.....(i'm on windows)
I'm a beginner. I've learned the basic syntax, but getting a practice app running on Postgres i just cant seem to do it. ill literally pay for help if someone can help me out.
Everytime i try to start the database i get
chronokross#DESKTOP-V7DS5HD:/mnt/c/code/nathantest$ rake db:create
Database 'chrono_development' already exists
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create 'chrono_test' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Caused by:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Tasks: TOP => db:create
(See full trace by running task with --trace)
chronokross#DESKTOP-V7DS5HD:/mnt/c/code/nathantest
I've followed millions of guides. I dont know how to connect postgresql on windows to my ubunix server ROR app.
my discord is ChronoKross#1560.
They say to edit my databse yml file. This is how i did it
# PostgreSQL. Versions 9.3 and up are supported.
#
# Install the pg driver:
# gem install pg
# On macOS with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On macOS with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: chrono_development
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user running Rails.
username: chronokross
# The password associated with the postgres role (username).
password: *****
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
host: localhost
# The TCP port the server listens on. Defaults to 5432.
# If your server runs on a different port number, change accordingly.
#port: 5432
# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# Defaults to warning.
#min_messages: notice
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: chrono_test
# As with config/credentials.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password or a full connection URL as an environment
# variable when you boot the app. For example:
#
# DATABASE_URL="postgres://myuser:mypass#localhost/somedatabase"
#
# If the connection URL is provided in the special DATABASE_URL environment
# variable, Rails will automatically merge its configuration values on top of
# the values provided in this file. Alternatively, you can specify a connection
# URL environment variable explicitly:
#
# production:
# url: <%= ENV['MY_APP_DATABASE_URL'] %>
#
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full overview on how database connection configuration can be specified.
#
production:
<<: *default
database: chrono_production
username: chronokross
password: *****
PLEASE PLEASE I BEG FOR HELP. I've been studying 8hrs a day but this is a HUGE road block, i need someone to tell me what to do in noob terms or screenshare with me.
again my discord is ChronoKross#1560
I installed odoo_11.0.latest.exe on win 10 from http://nightly.odoocdn.com/11.0/nightly/exe/odoo_11.0.latest.exe
I installed http://get.enterprisedb.com/postgresql/postgresql-9.6.1-1-windows-x64.exe, in pgAdmin I can see server in localhost:5432 (User openpg, PW openpgpwd)
I run the odoo installer with default values and when I clicked finish the browser open http://localhost:8069/ with msg This site can’t be reached, localhost refused to connect.
The same msg in http://localhost:8069/web/database/manager
BTW the enterprise edition was installed smoothly, but it also installed postgresql with DB odoo_tst.
How to debug this?
I faced the same problem, finally I get success wit these following steps (odoo11):
Make sure you have run odoo service
Check you postgres
Look at you config file C:\Program Files (x86)\Odoo 11.0\server\odoo.conf
....
db_name = False
db_password = openpgpwd
db_port = 5432
db_sslmode = prefer
db_template = template1
db_user = openpg
....
Access to http://localhost:8069 and process your installation by follow the screen, and enjoy.
Here is how I was able to run odoo 10 on win:
install vagrant and it's dependency virtualbox
in the cmd to: vagrant init ubuntu/xenial32
add line in Vagrantfile
config.vm.network "private_network", ip: "55.55.55.7"
vagrant reload
vagrant up
vagrant ssh
follow this install https://www.getopenerp.com/install-odoo-10-on-ubuntu-16-04/
sudo su - postgres
cd /opt/odoo/odoo-10
odoo-bin
site should be reachable at http://55.55.55.7:8069/
Running psql gets me this:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
I installed Postgres 9.3.3 using Homebrew.
which psql gives /usr/local/bin/psql
This seems to be a common issue. I'm terribly sorry to ask again, but I've gone through at least a dozen Q&As here and can't resolve the issue. A few posts I've gone through include:
Why am I getting a could not connect to server error for postgres in Mac OS Lion?
Postgres cannot connect to server on Unix domain socket 5432
Can not connect to local PostgreSQL
Many thanks,
Justin
Have you modified postgresql.conf to accept incoming TCP/IP connections? You should uncomment the listen_addresses parameter and set it to an appropriate subnet mask. Then in pg_hba.conf you have to add a line to enable connections to databases over TCP/IP. Both configuration files are in your data directory (don't know where that is on OSX).
Ruby 1.9.3 on Mac OS X Lion
Followed several posts on SO about this topic. Neither helped.
Trying to run my first rails and postgreSQL app here.
Following this:
http://guides.rubyonrails.org/getting_started.html
When I do:
"rake db:create"
I get:
could not connect to server: No such file or directory Is the server
running locally and accepting connections on Unix domain socket
"/tmp/.s.PGSQL.5432"?
Some facts:
Not sure what /tmp/ is it referring to but, if it is the one from root, then:
1)
Permissions:
drwxrwxrwx 11 root wheel 374B Jan 4 17:33 tmp
2)
Also, I see no file .s.PGSQL.5432.
3)
I've tried to force the socket location by adding to database.yml the following:
development:
adapter: postgresql
encoding: unicode
database: testblog_development
pool: 5
username: blog
password:
socket: /var/pgsql_socket # <-- this line
(it stills shows me the same error with the /tmp/ path).
4) When I do, which postgres I get:
/usr/local/bin/postgres
(I've used homebrew installation)
5) When I do: brew info postgres I get:
postgresql: stable 9.2.2 http://www.postgresql.org/ Depends on:
readline, ossp-uuid Conflicts with: postgres-xc
/usr/local/Cellar/postgresql/9.2.2 (2819 files, 39M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb
and other bunch of information.
That seems to me like the server isn't running. Do you see anything when you run ps aux | grep postgres from the command line? If all you see is something along the lines of grep postgres in the output, it's not running.
Since you installed PostgreSQL with Homebrew, try brew info postgres for information on how to start up the server if that is indeed the case.
You don't need to specify a socket. Here's a configuration that works for Postgres. You only need to change the database password.
development:
adapter: postgresql
host: localhost
pool: 5
timeout: 5000
username: postgres
password: postgres
database: testblog_development
template: template0
I've installed PostgreSQL 9 on my local mac and it installed the "SQL Shell (psql).app" which I assume is the command shell for the server. I've opened it up but it asks for a Username [postgres]:. I type in postgres and then it asks for a password. I press enter and it gives the following error:
psql: fe_sendauth: no password supplied
How do I log in and more importantly how do I run commands like createdb? I tried the createdb command in my normal Terminal window but the command is not recognized.
Should I be using Homebrew or Macports? I haven't used either of these being new to the Mac OS
Thanks for your help!
I had this problem and removing the host and port parameters from database.yml fixed it for me:
development:
adapter: postgresql
encoding: unicode
database: my_db
pool: 5
host: localhost # remove this line
port: 5432 # and this one
If your postgres user doesn't have a password, set this env variable:
export PGPASSWORD=