I'm trying to configure CI on Gitlab CI and get this error
$ rake db:create
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
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 database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"runner", "database"=>"ems"}
rake aborted!
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"?
A service defined in .gitlab-ci.yml is a seperate docker instance not a local service. You need to update your db configuration to point to a host named postgres
Related
I'm trying create a app with ruby on rails in termux, I already installed the necessary gems and packages for the setup, but when doing rails db:create. I get this error
rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/data/data/com.termux/files/usr/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 "/data/data/com.termux/files/usr/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
You need to start a PostgreSQL server manually for your app to be able to connect to.
Install postgresql via pkg install postgresql
See the wiki for sample setup instructions https://wiki.termux.com/wiki/Postgresql
I am in no way a code developer. Our code developer quit, and I was just given the project. So I am trying to learn code while fixing what ever issues happen. This is the issue that I am currently facing. I need to add new columns into two different tables, I did three separate Active Record Migrations, following the direction. When I tried to update the schema.rb with
$ rake db:migrate
I got the following.
[pcms -update to 4.4 (master)]$ rake db:migrate
WARNING: Nokogiri was built against LibXML version 2.9.2, but has
dynamically loaded 2.8.0
I, [2017-07-20T08:57:20.436515 #64621] INFO -- : ** [Raven] Raven 0.13.0
configured not to send errors.
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
database.yml
development:
adapter: postgresql
database: pcms_development
host: localhost
test:
adapter: postgresql
database: pcms_test
host: localhost
I've always been confused on how you can executive rake db actions from the terminal. Does it go through rails and then change the db? Or does it go through some environment variable you have on your computer to find the db and then changes it?
I'm asking this because I want to run bundle exec rake db:drop but I keep getting
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
even though my bundle exec rails s connects me to a server correctly.
You can run the rake db commands with the rails server running
The error says there is no connection happening with the database and solution for this is either restart the db server
(if its postgres)
sudo service postgres restart
or may be you are providing wrong user name and password in database.yml file(this should match with the db user name and password)
When I try to connect server to create database. I am getting this error.
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "host"=>"localhost", "socket"=>"/var/run/postgresql/.s.PGSQL.5432", "pool"=>5, "min_messages"=>"error", "database"=>"rails_contributors_test"}
-- enable_extension("plpgsql")
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
I tried a lot but didn't get success. Looking for help.
Postgres version I have as
which postgres
=> /usr/local/bin/postgres
postgres --version
=> postgres (PostgreSQL) 9.4.4
Try installing Postgres.app on your Mac OSX.
and start the postgres i.e. click on Open psql.
Then, restart the rails server.
After this, it should fix your issue.
Update (If the above does not work)
To fix the issue, remove the PID file. Find the postgres data directory. On Mac OSX using homebrew it is /usr/local/var/postgres/.
To make sure this is the problem, look at the log file (server.log). On the last lines you will see: FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 347) running in data directory "/usr/local/var/postgres"?
If so, rm postmaster.pid
Restart your server. On Mac OSX, do:
launchctl unload homebrew.mxcl.postgresql.plist
launchctl load -w homebrew.mxcl.postgresql.plist
When I run the command: rake db:migrate RAILS_ENV=production I get the following error:
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "93.188.167.2" and accepting
TCP/IP connections on port 5432?
So I guess my server is not listening on port 5432. So how do I solve this?
I know I have to edit some file so in addition to the instructions on how to actually edit the file (I guess it is the file named postgresql.conf?) please also tell me where I should find it.
My web application is on this directory at the server: /home/admin/www/webstudio
EDIT: I have already tried my best to follow the instructions given here: http://alexbachuk.com/launch-rails-4-application-with-passenger-and-nginx/