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
Related
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)
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
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/
I'm having trouble changing an existing app with SQLite3 to postgreSQL. I'm following this tutorial to convert SQLite3 to postgreSQL and deploy it to heroku: https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres.
I removed gem 'sqlite3' and replaced with gem 'pg'.
After modifying config/database.yml, I ran migration.
$rake db:create and $rake db:migrate resulted this error:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Gemfile used in production:
gem 'rails_12factor'
gem 'thin'
gem 'pg'
Following is the errors I get when I run with the local server:
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
It looks like you have not added a Heroku Postgres database to your Heroku account. When a database is configured, your application will connect to it. Without a database configured, it's falling back to looking for one locally.
If you do have a database configured, something is wrong with your Heroku environment preventing your database connection settings from being found.
Making lots of progress in a rails 3.1 to 3.2.6 upgrade for a Heroku app.
I use asset_sync and precompile assets onto S3. I use the asset_sync.rb initialiser to config my S3 connection details.
Getting an error when I attempt to run
RAILS_ENV=production bundle exec rake assets:precompile
AssetSync: using /Users/bob/work/myapp/config/initializers/asset_sync.rb
rake aborted!
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/bob/.rvm/rubies/ruby-1.9.3-p...]
That's very strange. I checked that it is listening as per Postgres permission denied on MAC OS X that question and related comments.
this isn't an error with asset_sync, but the asset precompile process itself (specifically on heroku) try config.assets.initialize_on_precompile = false in your production or application.rb
What this will do is make sure your application code does not get initialized unnecessarily, which at precompile time, your heroku database my not be available.
Also it's not an issue with just Rails 3.2.6 but 3.2.x I believe.