Open schowdhury opened 9 years ago
+1 Same here.
try this
in config/initializers/octopus.rb
add
if Octopus.enabled?
Octopus.config[Rails.env.to_s]['master'] = ActiveRecord::Base.connection.config
ActiveRecord::Base.connection.initialize_shards(Octopus.config)
end
I had the same problem and this fixed it. Thanks @velles Is this compatible with the unicorn config (same lines in the after_fork)?
thanks again @velles, It worked for me as well, but I'd like to understand why it happened any clues?
I used this too. I had the same ActiveRecord::ConnectionNotEstablished problem occurring when the first ever query was routed through Octopus. However, if there were regular queries prior to a query through Octopus everything was hunky dory.
I have this problem too. PG::ConnectionBad: could not connect to server: Connection timed out
Sorry for the bump on an old thread, but I recently just encountered the same issue on a project I'm working on. Is this simply an issue with rails 4? @velles trick also worked to fix it for me.
I am getting this error in production with Octopus 0.9.0, with Rails 4.2.7.1, on Ruby 2.2.6.
Notably we do have spring installed on the production machine, and we shouldn't. (https://github.com/rails/spring#deployment)
You must not install Spring on your production environment.
The error occurs directly following Spring loading:
Running via Spring preloader in process 33615
rake aborted!
ActiveRecord::ConnectionNotEstablished: ActiveRecord::ConnectionNotEstablished
.../activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in `checkout_new_connection'
So it seems this issue may be related to, or the same as: https://github.com/thiagopradi/octopus/issues/303
I am on rails 4. v 0.8.5 version of octopus
when I run rake, specifically rake db:migrate, I get the following error
Any ideas about how I can fix this?