Temporary failure in name resolution (PG::ConnectionBad) - ruby-on-rails

I have Rails 4 application hosted in Heroku EU.
Sice 2 days it's almost impossible for me to start Heroku console. 90 out of 100 tries ends with error like below:
scaryguy#ubuntu:~/Sites/xxxxx.com$ heroku run console
Running `console` attached to terminal... up, run.9208
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not translate host name "ec2-54-221-224-138.compute-1.amazonaws.com" to address: Temporary failure in name resolution (PG::ConnectionBad)
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `new'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `connect'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:542:in `initialize'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:53:in `connection'
from /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/model_schema.rb:203:in `table_exists?'
from /app/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb:5:in `included'
from /app/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:98:in `include'
from /app/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:98:in `taggable_on'
from /app/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:39:in `acts_as_taggable_on'
from /app/vendor/bundle/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1/lib/acts_as_taggable_on/taggable.rb:15:in `acts_as_taggable'
from /app/app/models/article.rb:6:in `<class:Article>'
from /app/app/models/article.rb:1:in `<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:329:in `require_or_load'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:288:in `depend_on'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:206:in `require_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:63:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I wonder if this depends on me? Or is this a wide error which Heroku dosn't think to put a notice to their status page, again. I'm not sure because I've been having difficulties with my new installed Ubuntu. Some CA cart issues... But I can connect to anywere at this time... Well, I'm not sure.
I opened a ticket at Heroku yesterday and after 7 hours their answer was "Does problem persist?".

After me changing my virtual machines and physical OS's DNS settings to use Google DNS, everthing was FIXED!!!!!!
ALL was a DNS issue...
I DON'T know who is responsible of this situation? Is it my ISP provider? Who I have to be angry with??
Here is that regular Google DNS settings:
8.8.8.8
8.8.4.4

This is a problem with DNS resolution of an EC2 server hostname from within a dyno on Heroku.
Unless you've configured some kind of crazy, custom buildpack on your dyno this is likely an ephemeral problem on their end.

Related

How do I find what port my rails server is running on and how do I change it?

I'm new to coding and working on a team project where I've just set up rspec from a Github repository and I can't seem to set up my server. I've run db migrate and db drop to see if there were any errors there as seen below. The rails s command is starting the server but it isn't able to connect on localhost:3000
rails db:drop
/Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environments/development.rb:4:in `block in <main>': uninitialized constant Rails::Server
Did you mean? TCPServer (NameError)
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `instance_eval'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `configure'
from /Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environments/development.rb:3:in `<main>'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `each'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `call'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
from /Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environment.rb:5:in `<main>'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:108:in `preload'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:162:in `serve'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:144:in `block in run'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `loop'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `run'
from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from <internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'
Rails db migrate below
rails db:migrate
Running via Spring preloader in process 70800
rake aborted!
ActiveRecord::ConnectionNotEstablished: connection to server at "localhost" (::1), port 5433 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5433 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:283:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
-e:1:in `<main>'
Caused by:
PG::ConnectionBad: connection to server at "localhost" (::1), port 5433 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5433 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:283:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/command_wrapper.rb:40:in `call'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:217:in `block in serve'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:181:in `serve'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:144:in `block in run'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `loop'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `run'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
If anyone could help or give me some pointers, I'd really appreciate it. I am just learning so I would really appreciate help in layman's terms if possible. It will mean the world.
You can find process ID with this
#=> ps aux | grep rails
#=> username 27436 0.0 0.0 408497296 1424 s002 R+ 6:01pm 0:00.00 grep .... rails
Then use to process ID(ID next to username) to find the port it is running on
#=> ps -p 25785 -o comm=
#=> puma 5.5.2 (tcp://localhost:3000) [MyRailsApp]

Rails could not translate host name "postgres" to address: Name or service not known (PG::ConnectionBad)

I'm working on a Rails 4.2.3 project with ruby 2.2.2 (Running ubuntu 16.04). It was working ok but after revisiting it after a while I can't serve. I've tried searching but all situations don't seem to be of help.
Here's the error log:
bigzoo#bigzoo:~/Documents/projects/proj$ rs
=> Booting Puma
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in `initialize': could not translate host name "postgres" to address: Name or service not known (PG::ConnectionBad)
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in `new'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:655:in `connect'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:87:in `connection'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/querying.rb:39:in `find_by_sql'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/relation.rb:638:in `exec_queries'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/relation.rb:514:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/relation.rb:243:in `to_a'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/relation/delegation.rb:46:in `map'
from /home/bigzoo/Documents/projects/proj/app/admin/product.rb:62:in `block in <top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/dsl.rb:15:in `instance_exec'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/dsl.rb:15:in `run_registration_block'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/namespace.rb:223:in `parse_registration_block'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/namespace.rb:48:in `register'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:154:in `register'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin.rb:75:in `register'
from /home/bigzoo/Documents/projects/proj/app/admin/product.rb:1:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:212:in `block in load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/error.rb:41:in `capture'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:212:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:204:in `block in load!'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:204:in `each'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:204:in `load!'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin/application.rb:226:in `routes'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/bundler/gems/activeadmin-21f76b1faf65/lib/active_admin.rb:79:in `routes'
from /home/bigzoo/Documents/projects/proj/config/routes.rb:20:in `block in <top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:434:in `instance_exec'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:434:in `eval_block'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:412:in `draw'
from /home/bigzoo/Documents/projects/proj/config/routes.rb:1:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/file_update_checker.rb:75:in `call'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
from /home/bigzoo/Documents/projects/proj/config/environment.rb:5:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /home/bigzoo/Documents/projects/proj/config.ru:3:in `block in <main>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `instance_eval'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/builder.rb:55:in `initialize'
from /home/bigzoo/Documents/projects/proj/config.ru:in `new'
from /home/bigzoo/Documents/projects/proj/config.ru:in `<main>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `eval'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/builder.rb:49:in `new_from_string'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/builder.rb:40:in `parse_file'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/server.rb:208:in `app'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:61:in `app'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/server.rb:336:in `wrapped_app'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:78:in `start'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/bin/rails:8:in `require'
from /home/bigzoo/Documents/projects/proj/bin/rails:8:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
from /home/bigzoo/Documents/projects/proj/.bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/bigzoo/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/bigzoo/Documents/projects/proj/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
The only issue seems to be connecting to postgres.
PS. I've already tried running unset DATABASE_URL if anyone is feeling compelled to suggest that.
Extra info:
bigzoo#bigzoo:~/Documents/projects/proj$ sudo netstat -atpn | grep 5432
[sudo] password for bigzoo:
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1744/postgres
Adding the line below to /etc/hosts did the trick.
127.0.0.1 postgres
did the trick.
Rails uses the host name postgres and leaves it up to the system to direct postgres to the host and port as required. The line above allows the mapping to take place if it doesn't work for some reason.
Credits #mudasobwa.
PS.
To edit /etc/hosts just type (in your console)
sudo nano /etc/hosts
To open it and add the line.
This happened to me on a container that I had been using regularly. It just randomly started throwing this error and not resolving.
I eventually solved it with
docker system prune --volumes
running it without the volumes flag didn't resolve it.
if you run with docker add :
services:
postgres:
image: postgres
environment:
POSTGRES_HOST_AUTH_METHOD: trust

The production mode ruby app doesn't run, unicorn and nginx

I'm going to deploy my ruby on rails app on my own server. So i decided to follow this tutorial that is from degital ocean:
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-unicorn-and-nginx-on-ubuntu-14-04
I configured my database.yml which i add host:localhost and configured rben-var in my app directory and Migrate the production database very well.
I couldn't start the rails with this command
RAILS_ENV=production rails server
And i thought maybe it is because of my last time that I set the unicorn as default for my another app(you know i have two other app which i deploy them on the server well but i removed their path from the nginx)
then I create config/unicorn.rb
finally when I started
sudo vi /etc/init.d/unicorn_drug it gives me this error:
master failed to start, check stderr log for details
When i see the log which Is in /shared/log/unicorn.stderr.log i see following error lines.
You know i spend two days on this case but I really can't understand what is the error is:
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `call'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `build_app!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:129:in `start'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
/root/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
/root/.rbenv/versions/2.2.3/bin/unicorn:23:in `<top (required)>'
I, [2017-02-27T13:38:21.860366 #1848] INFO -- : Refreshing Gem list
NameError: uninitialized constant RegistrationController
/root/drug_api/app/controllers/RegistrationController/confirmations_controller.rb:1:in `<top (required)>'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `each'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `each'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `eager_load!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:354:in `eager_load!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `each'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `instance_exec'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `run'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `call'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
/root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/initializable.rb:54:in `run_initializers'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.0.1/lib/rails/application.rb:352:in `initialize!'
/root/drug_api/config/environment.rb:5:in `<top (required)>'
config.ru:4:in `require_relative'
config.ru:4:in `block in <main>'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn.rb:56:in `eval'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn.rb:56:in `block in builder'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `call'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:752:in `build_app!'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:129:in `start'
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
/root/.rbenv/versions/2.2.3/bin/unicorn:23:in `load'
/root/.rbenv/versions/2.2.3/bin/unicorn:23:in `<top (required)>'
The problem is uninitialized constant RegistrationController, your RegistrationController is missing. Also seems that you have named directory to RegistrationController and under that you have placed confirmation_controller. Rename the directory to registration_controller, cause you can not name path or directory with first letter capital, that is only for class name.
Check line no. 8 of your error log:
NameError: uninitialized constant RegistrationController
/root/drug_api/app/controllers/RegistrationController/confirmations_controller.rb:1:in `<top (required)>'

Elastic Beanstalk Rails deploy mystery initialize error

I am trying to deploy an existing heroku app to EC2 using Beanstalk.
So far I have all the Environment variables moved over and the database setup.. etc. It seems to work and deploy correct except for Puma.
The puma.log file has the following in it over and over;
/opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/pathname.rb:397:in `initialize': no implicit conversion of nil into String (TypeError)
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/pathname.rb:397:in `new'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/pathname.rb:397:in `join'
from /var/app/current/config/initializers/cloudfront-signer.rb:2:in `block in <top (required)>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/cloudfront-signer-2.2.0/lib/cloudfront-signer.rb:108:in `configure'
from /var/app/current/config/initializers/cloudfront-signer.rb:1:in `<top (required)>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:413:in `call'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
from /var/app/current/config/environment.rb:5:in `<top (required)>'
from config.ru:3:in `require'
from config.ru:3:in `block in <main>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from config.ru:in `new'
from config.ru:in `<main>'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/configuration.rb:102:in `load_rackup'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/configuration.rb:69:in `app'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/runner.rb:123:in `app'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/runner.rb:130:in `start_server'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:213:in `worker'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:109:in `block (2 levels) in spawn_workers'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:109:in `fork'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:109:in `block in spawn_workers'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:105:in `times'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:105:in `spawn_workers'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:157:in `check_workers'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cluster.rb:421:in `run'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/lib/puma/cli.rb:216:in `run'
from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/puma-2.11.2/bin/puma:10:in `<top (required)>'
from /opt/rubies/ruby-2.2.2/bin/puma:23:in `load'
from /opt/rubies/ruby-2.2.2/bin/puma:23:in `<main>'
I have no clue what this is or why its happening and am at a complete loss..
Line 5 of config/environment is Rails.application.initialize!
Line 3 of config.ru is run Rails.application
So does this mean that Rails.application hasn't been defined? I'm a tad confused.
Again this app works perfectly on Heroku.
Suggestions?

Rails app crashes on Heroku after implementing ElasticSearch

I just implemented ElasticSearch to my Rails App. Everything is working localy, but when I deployed my changes to Heroku, the app crashes.
When I run
heroku run rails c
in the Heroku cli, I get this error message:
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Faraday::ConnectionFailed)
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from /app/vendor/bundle/ruby/2.0.0/gems/faraday- 0.9.0/lib/faraday/adapter/net_http.rb:80:in `perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/faraday- 0.9.0/lib/faraday/adapter/net_http.rb:39:in `call'
from /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
from /app/vendor/bundle/ruby/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.4/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.4/lib/elasticsearch/transport/transport/base.rb:187:in `call'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.4/lib/elasticsearch/transport/transport/base.rb:187:in `perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.4/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-transport-1.0.4/lib/elasticsearch/transport/client.rb:102:in `perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-api-1.0.4/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request'
from /app/vendor/bundle/ruby/2.0.0/gems/elasticsearch-api-1.0.4/lib/elasticsearch/api/actions/indices/create.rb:77:in `create'
from /app/app/models/publication.rb:67:in `<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:348:in `require_or_load'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:307:in `depend_on'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:225:in `require_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:467:in `block in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:465:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/engine.rb:346:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/application/finisher.rb:58:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/application.rb:264:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/application.rb:264:in `require_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:147:in `require_application_and_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require'
from /app/bin/rails:8:in `<main>'
On Heroku I installed the Bonsai ElasticSearch, but that didn't solve the problem.
I'm not that confident with ElasticSearch, did I forgot some configuration or something?
my repository is at:
https://github.com/acandael/posplus-rails
thanks for your help,
Anthony
The errors imply the app can't connect to Elasticsearch to create an index, so I would check if you can do that locally:
$ heroku config | grep BONSAI_URL
$ curl -XPUT '<your-bonsai-url>/myindex/'
If this fails, then the problem is with the Elasticsearch cluster. If it succeeds, then you're probably not pointing the app at the correct URL.

Resources