Solr on heroku does not work - ruby-on-rails

I have just deployed my app on Heroku. I have access to home however when I create an account I have the error "we're sorry but something were wrong". In the heroku console there are the following lines :
2013-07-25T14:43:57.205734+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]: app/controllers/users_controller.rb:36:in `create'
2013-07-25T14:43:57.326077+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - {:data=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?><add><doc><field name=\"id\">User 23</field><field name=\"type\">User</field><field name=\"type\">ActiveRecord::Base</field><field name=\"class_name\">User</field><field name=\"nom_text\">julien</field><field name=\"email_text\">julien#resenders.com</field></doc></add>", :headers=>{"Content-Type"=>"text/xml"}, :method=>:post, :params=>{:wt=>:ruby}, :query=>"wt=ruby", :path=>"update", :uri=>#<URI::HTTP:0x007f987b4c48a0 URL:http://localhost:8080/solr/update?wt=ruby>, :open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil, :retry_after_limit=>nil}):
2013-07-25T14:43:57.337273+00:00 app[web.1]: Processing by UsersController#create as HTML
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.326077+00:00 app[web.1]:
2013-07-25T14:43:57.337273+00:00 app[web.1]: Completed 500 Internal Server Error in 850ms
2013-07-25T14:43:57.337273+00:00 app[web.1]: Parameters: {"utf8"=>"???", "authenticity_token"=>"gdLt0F1TJi+GaFCe8sFFKRikXgAEEnW6DmIyPbLeCa4=", "user"=>{"nom"=>"julien", "email"=>"julien#resenders.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "resender"=>"0", "gang_id"=>"1", "addresses_attributes"=>{"0"=>{"first_name"=>"L", "last_name"=>"L"}}}, "commit"=>"Inscription"}
2013-07-25T14:43:57.337273+00:00 app[web.1]: Rendered devise/mailer/confirmation_instructions.html.erb (1.3ms)
2013-07-25T14:43:57.344954+00:00 heroku[router]: at=info method=POST path=/users host=www.resenders.com fwd="37.58.138.20" dyno=web.1 connect=4ms service=930ms status=500 bytes=643
I figured out the problem in local with "rake sunspot:solr:run" but even if "heroku run rake sunspot:solr:run" seems to work, it does not sort out this trouble on Heroku. How can I do ? Maybe with Websolr ? Thank you in advance guys !

4 Suggestions:
Be sure that your server is running
Be sure that your routes are set correctly
Add the websolr add on to your heroku stack --> https://devcenter.heroku.com/articles/websolr
Be sure to always remove personal data when pasting code to the internet

Related

wkhtmltopdf rendering twice?

I'm using wicked_pdf, working fine. However, the server seems to render/execute wicked twice for only one call, resulting in one pdf-file. Can anyone tell me why? The server log looks like this:
2016-03-16T21:53:11.659341+00:00 app[web.1]: Started GET "/wpdf" for 99.99.99.99 at 2016-03-16 21:53:11 +0000
2016-03-16T21:53:11.661184+00:00 app[web.1]: Processing by SomeStoriesController#wpdf as HTML
2016-03-16T21:53:11.661632+00:00 app[web.1]: ***************WICKED***************
2016-03-16T21:53:11.663620+00:00 app[web.1]: Rendered some_stories/wpdf.html.erb (1.1ms)
2016-03-16T21:53:13.128754+00:00 heroku[router]: at=info method=GET path="/wpdf" host=xxxx.herokuapp.com request_id=3ca3a32a-2c40-4052-b7fb-8d333b7277c6 fwd="99.99.99" dyno=web.1 connect=0ms service=1477ms status=200 bytes=18490
2016-03-16T21:53:13.132369+00:00 app[web.1]: Rendered text template (0.0ms)
2016-03-16T21:53:13.132480+00:00 app[web.1]: Sent data file_name.pdf (0.5ms)
2016-03-16T21:53:13.132673+00:00 app[web.1]: Completed 200 OK in 1471ms (Views: 0.4ms | ActiveRecord: 0.0ms)
2016-03-16T21:53:13.362617+00:00 app[web.1]: Started GET "/wpdf" for 99.99.99.99 at 2016-03-16 21:53:13 +0000
2016-03-16T21:53:13.363827+00:00 app[web.1]: Processing by SomeStoriesController#wpdf as HTML
2016-03-16T21:53:13.364250+00:00 app[web.1]: ***************WICKED***************
2016-03-16T21:53:13.365987+00:00 app[web.1]: Rendered some_stories/wpdf.html.erb (1.1ms)
2016-03-16T21:53:14.468550+00:00 heroku[router]: at=info method=GET path="/wpdf" host=xxxx.herokuapp.com request_id=5b70cf38-bc29-45fd-8287-3a01b0b1372a fwd="99.99.99.99" dyno=web.1 connect=0ms service=1114ms status=200 bytes=18490
2016-03-16T21:53:14.472015+00:00 app[web.1]: Rendered text template (0.0ms)
2016-03-16T21:53:14.472110+00:00 app[web.1]: Sent data file_name.pdf (0.4ms)
2016-03-16T21:53:14.472271+00:00 app[web.1]: Completed 200 OK in 1108ms (Views: 0.3ms | ActiveRecord: 0.0ms)
I am also experiencing the same issue. It is only occurring in Chrome and is not happening in Firefox or IE.
Looks like a bug in Chrome - Chrome sends two requests when downloading a PDF (and cancels one of them)
Looks like it will be fixed in v54 of Chrome.

failed to connect with bonsai and elastic search and search kick on heroku

Trying to run elastic search with bonsai and search kick on heroku. it says it is starting but i keep getting a Faraday::ConnectionFailed (Connection refused - connect(2)):
i am almost positive the bonsai URL is being set right.
any idea how to fix? been trying to dive into this but I'm stuck.
user.rb
require 'elasticsearch/model'
class User < ActiveRecord::Base
Elasticsearch::Model.client = Elasticsearch::Client.new url: ENV['BONSAI_URL'], log: true
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
search kick autocomplete: ['name']
gem file
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'searchkick'
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'puma', '2.11.1'
gem 'bonsai-elasticsearch-rails', '~> 0.0.4'
end
Full logs
2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
2016-03-12T04:23:16.495563+00:00 app[web.1]: Starting up a new ElasticSearch client with https://xxxxxxx.us-east-1.bonsai.io
2016-03-12T04:23:17.157002+00:00 app[web.1]: [1m[36mUser Load (1.8ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
2016-03-12T04:23:17.246641+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-03-12T04:23:17.250874+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
2016-03-12T04:23:17.252056+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
2016-03-12T04:23:17.600616+00:00 heroku[web.1]: State changed from starting to up
2016-03-12T04:23:56.953781+00:00 heroku[api]: Starting process with command `bash` by testtest#me.com
2016-03-12T04:24:03.284922+00:00 heroku[run.2718]: Starting process with command `bash`
2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
2016-03-12T04:27:46.959226+00:00 heroku[slug-compiler]: Slug compilation started
2016-03-12T04:23:17.246505+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:3243
2016-03-12T04:23:17.246641+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-03-12T04:23:17.250874+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
2016-03-12T04:23:17.600616+00:00 heroku[web.1]: State changed from starting to up
2016-03-12T04:24:03.264844+00:00 heroku[run.2718]: Awaiting client
2016-03-12T04:24:03.284922+00:00 heroku[run.2718]: Starting process with command `bash`
2016-03-12T04:24:03.741737+00:00 heroku[run.2718]: State changed from starting to up
2016-03-12T04:27:46.959233+00:00 heroku[slug-compiler]: Slug compilation failed: unrecognized error 3e521316-8b6b-44bd-b313-e8b62d9f15b1
2016-03-12T04:29:39.843924+00:00 heroku[api]: Deploy 5c0b4bd by testtest#me.com
2016-03-12T04:29:39.843924+00:00 heroku[api]: Release v35 created by testtest#me.com
2016-03-12T04:29:39.972973+00:00 heroku[slug-compiler]: Slug compilation started
2016-03-12T04:29:40.048027+00:00 heroku[web.1]: Restarting
2016-03-12T04:29:40.049299+00:00 heroku[web.1]: State changed from up to starting
2016-03-12T04:29:42.417672+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-03-12T04:29:43.086852+00:00 app[web.1]: [3] - Gracefully shutting down workers...
2016-03-12T04:29:43.176481+00:00 app[web.1]: [3] === puma shutdown: 2016-03-12 04:29:43 +0000 ===
2016-03-12T04:29:43.176488+00:00 app[web.1]: [3] - Goodbye!
2016-03-12T04:29:43.816757+00:00 heroku[web.1]: Process exited with status 0
2016-03-12T04:29:46.716295+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
2016-03-12T04:29:49.157324+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-03-12T04:29:49.157437+00:00 app[web.1]: [3] * Version 2.11.1 (ruby 2.0.0-p648), codename: Intrepid Squirrel
2016-03-12T04:29:49.157472+00:00 app[web.1]: [3] * Environment: production
2016-03-12T04:29:49.157473+00:00 app[web.1]: [3] * Process workers: 2
2016-03-12T04:29:49.157474+00:00 app[web.1]: [3] * Preloading application
2016-03-12T04:29:50.759011+00:00 app[web.1]: Starting up a new ElasticSearch client with https://xxxxxx.us-east-1.bonsai.io
2016-03-12T04:29:51.430834+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: HEAD https://xxxxxx.bonsai.io:443/users [status:200, request:0.017s, query:n/a]
2016-03-12T04:29:51.516765+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: POST https://xxxxxxx.bonsai.io:443/users/user/_bulk [status:200, request:0.016s, query:0.005s]
2016-03-12T04:29:51.516810+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: > {"index":{"_id":1}}
2016-03-12T04:29:51.516811+00:00 app[web.1]: {"id":1,"name":"Example User","email":"example#railstutorial.org","created_at":"2016-03-10T03:09:45.898Z","updated_at":"2016-03-10T03:09:45.898Z","password_digest":"$2a$10$/VQEZljtG.nQRuB20.UG1uSIQjtgk9KfzoXdUL4kGETwbZm/XPOma","remember_digest":null,"admin":true,"activation_digest":"$2a$10$jZpCLV4k2H5nuMCPVuZt7OzlUQjykQ0e7uwADb9AJ0vbrzHDw55La","activated":true,"activated_at":"2016-03-10T03:09:45.691Z","reset_digest":null,"reset_sent_at":null,"location":"New York","discipline":"Actor","slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516812+00:00 app[web.1]: {"index":{"_id":2}}
2016-03-12T04:29:51.516813+00:00 app[web.1]: {"id":2,"name":"test","email":"testtest#me.com","created_at":"2016-03-10T03:13:19.990Z","updated_at":"2016-03-10T03:13:19.990Z","password_digest":"$2a$10$LWDYy6Ek1zR925kLvHHP.uRSnL7hAFOiYcdPkHCdBdiHGjuC8fDTC","remember_digest":null,"admin":false,"activation_digest":"$2a$10$k1jFVFe4lZlI5ktt7RcJx.hxdjwGEQIEnsMnwCnxLS1lpBaXbsFUu","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516813+00:00 app[web.1]: {"index":{"_id":3}}
2016-03-12T04:29:51.516814+00:00 app[web.1]: {"id":3,"name":"test","email":"testtest#icloud.com","created_at":"2016-03-10T22:55:37.757Z","updated_at":"2016-03-10T22:55:37.757Z","password_digest":"$2a$10$06QP.eB.Srx2TvejUscyyOIuOnzGmEPewAvfxwE4pS9mm/jtpeyZ.","remember_digest":null,"admin":false,"activation_digest":"$2a$10$JdaYMdl8VQlFg7bkN2nClec/ZN49w5cno78LTj.vupqKN9.JOoSaa","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516814+00:00 app[web.1]: {"index":{"_id":4}}
2016-03-12T04:29:51.516815+00:00 app[web.1]: {"id":4,"name":"test","email":"test.test#gmail.com","created_at":"2016-03-11T17:38:17.019Z","updated_at":"2016-03-11T17:38:17.019Z","password_digest":"$2a$10$3EGEVSC1PmX03YMH7bBt7erWXu7ssVT0KdcVfD99.mwJ7oAdax7MS","remember_digest":null,"admin":false,"activation_digest":"$2a$10$MtJkJQMQ25tH6PIuZEjka.mtPitSbODwjJ8qkorAwrWhfdbGl5ZQ.","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516815+00:00 app[web.1]: {"index":{"_id":5}}
2016-03-12T04:29:51.516816+00:00 app[web.1]: {"id":5,"name":"test","email":"test#gioventunyc.com","created_at":"2016-03-11T17:41:22.759Z","updated_at":"2016-03-11T17:41:22.759Z","password_digest":"$2a$10$pj2f6Sw7Lk5Q/J6alKT.4.0XPIgqEV8BMAgars6WQbfXNqBPRBEZ2","remember_digest":null,"admin":false,"activation_digest":"$2a$10$dxECrTuI0/R7cZe69TVWSuvjrz7phhLQh22ZBfg7l9OG9yUm4QJGy","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516816+00:00 app[web.1]: {"index":{"_id":6}}
2016-03-12T04:29:51.516817+00:00 app[web.1]: {"id":6,"name":"test","email":"test#gioventu.nyc","created_at":"2016-03-11T17:45:29.749Z","updated_at":"2016-03-11T17:45:29.749Z","password_digest":"$2a$10$gZM6tMEnO1K2JU.J7Nlm9.Vl5JH4RE6px1F5N5KcbGB7GsoRXhSXG","remember_digest":null,"admin":false,"activation_digest":"$2a$10$Erg4aoSYbKaC9HB78O1yXO1Dw0K11sQ4IHYIp595etw2eMBIsiliq","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516817+00:00 app[web.1]: {"index":{"_id":7}}
2016-03-12T04:29:51.516818+00:00 app[web.1]: {"id":7,"name":"test","email":"rs#rrrr.nyc","created_at":"2016-03-12T04:06:14.603Z","updated_at":"2016-03-12T04:06:14.603Z","password_digest":"$2a$10$lKwxQS5Ff9eOti.YauPn8.y2JjHocgwWpJk8sWjtwJFtRxnjhEr1C","remember_digest":null,"admin":false,"activation_digest":"$2a$10$Z78l8dtLU5tJgbv70cdgU.dWvfR7zd1riskj59anTePdnBv7H/4IW","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516819+00:00 app[web.1]: {"index":{"_id":8}}
2016-03-12T04:29:51.516821+00:00 app[web.1]: {"id":8,"name":"test","email":"rrrr#nyu.edu","created_at":"2016-03-12T04:19:22.961Z","updated_at":"2016-03-12T04:19:22.961Z","password_digest":"$2a$10$eXku5S8nLGXkxYnfeMARgesXNG76qMnIsrmLrTdIngT4t8L.uqQy.","remember_digest":null,"admin":false,"activation_digest":"$2a$10$7m4IKtrQ4WDfXmElvI9./OfeqpJS1guGK.X31mM0DPoRCcfscbrwK","activated":false,"activated_at":null,"reset_digest":null,"reset_sent_at":null,"location":null,"discipline":null,"slack":null,"experiences":null,"portfolio":null,"card_token":null}
2016-03-12T04:29:51.516903+00:00 app[web.1]: 2016-03-12 04:29:51 +0000: < {"took":5,"errors":false,"items":[{"index":{"_index":"users","_type":"user","_id":"1","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"2","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"3","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"4","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"5","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"6","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"7","_version":4,"status":200}},{"index":{"_index":"users","_type":"user","_id":"8","_version":3,"status":200}}]}
2016-03-12T04:29:51.554058+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:56115
2016-03-12T04:29:51.815153+00:00 heroku[web.1]: State changed from starting to up
2016-03-12T04:30:09.854889+00:00 app[web.1]: Started POST "/users" for 71.125.40.81 at 2016-03-12 04:30:09 +0000
2016-03-12T04:30:09.891335+00:00 app[web.1]: Processing by UsersController#create as HTML
2016-03-12T04:30:09.981602+00:00 app[web.1]: [1m[36mUser Exists (1.6ms)[0m [1mSELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('testtest#me.com') LIMIT 1[0m
2016-03-12T04:30:10.384702+00:00 heroku[router]: at=info method=POST path="/users" host=xxxx.herokuapp.com request_id=c95e17ca-3eb3-4dfb-9337-b393ad6826b4 fwd="71.125.40.81" dyno=web.1 connect=0ms service=526ms status=200 bytes=5915
2016-03-12T04:30:10.354983+00:00 app[web.1]: [1m[35m (0.9ms)[0m ROLLBACK
2016-03-12T04:30:10.360982+00:00 app[web.1]: Rendered shared/_error_messages.html.erb (1.1ms)
2016-03-12T04:30:10.363072+00:00 app[web.1]: Rendered users/new.html.erb within layouts/application (5.1ms)
2016-03-12T04:30:10.365694+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.3ms)
2016-03-12T04:30:10.369943+00:00 app[web.1]: Rendered layouts/_header.html.erb (3.7ms)
2016-03-12T04:30:10.370911+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.3ms)
2016-03-12T04:30:10.371340+00:00 app[web.1]: Completed 200 OK in 480ms (Views: 15.5ms | ActiveRecord: 3.3ms)
2016-03-12T04:30:14.904181+00:00 app[web.1]: Started GET "/login" for 71.125.40.81 at 2016-03-12 04:30:14 +0000
2016-03-12T04:30:14.958240+00:00 app[web.1]: Processing by SessionsController#new as HTML
2016-03-12T04:30:15.544900+00:00 heroku[router]: at=info method=GET path="/login" host=xxxx.herokuapp.com request_id=71f94b8f-7543-439e-833f-bf1161c1d37a fwd="71.125.40.81" dyno=web.1 connect=1ms service=633ms status=200 bytes=5561
2016-03-12T04:30:15.608618+00:00 heroku[router]: at=info method=GET path="/assets/application-6f5ae546d40366770d3a61453503cef12cb1811b5cf39fb0a67a1322f96873d9.css" host=xxxxx.herokuapp.com request_id=a2c69f95-d377-47a9-b1c7-5c4fb8594766 fwd="71.125.40.81" dyno=web.1 connect=0ms service=2ms status=200 bytes=29104
2016-03-12T04:30:15.518580+00:00 app[web.1]: Rendered sessions/new.html.erb within layouts/application (544.6ms)
2016-03-12T04:30:15.522546+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.3ms)
2016-03-12T04:30:15.529268+00:00 app[web.1]: Rendered layouts/_header.html.erb (6.1ms)
2016-03-12T04:30:15.530501+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.4ms)
2016-03-12T04:30:15.531077+00:00 app[web.1]: Completed 200 OK in 573ms (Views: 559.4ms | ActiveRecord: 0.0ms)
2016-03-12T04:30:15.645644+00:00 heroku[router]: at=info method=GET path="/assets/application-44f9363a0510d929eca5abc71e6baff54884aadab1c158713bd34869de9bf38c.js" host=xxxx.herokuapp.com request_id=3535b08a-2406-4d83-9e4e-22046b0e0db7 fwd="71.125.40.81" dyno=web.1 connect=0ms service=6ms status=200 bytes=123671
2016-03-12T04:30:17.308712+00:00 heroku[router]: at=info method=GET path="/password_resets/new" host=ancient-tor-3622.herokuapp.com request_id=9e49778c-5546-43d7-8990-fd543ad298b9 fwd="71.125.40.81" dyno=web.1 connect=0ms service=29ms status=200 bytes=5044
2016-03-12T04:30:17.269613+00:00 app[web.1]: Started GET "/password_resets/new" for 71.125.40.81 at 2016-03-12 04:30:17 +0000
2016-03-12T04:30:17.277696+00:00 app[web.1]: Processing by PasswordResetsController#new as HTML
2016-03-12T04:30:17.284988+00:00 app[web.1]: Rendered password_resets/new.html.erb within layouts/application (2.1ms)
2016-03-12T04:30:17.289052+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.4ms)
2016-03-12T04:30:17.292766+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.5ms)
2016-03-12T04:30:17.294115+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.4ms)
2016-03-12T04:30:21.643797+00:00 app[web.1]: Started POST "/password_resets" for 71.125.40.81 at 2016-03-12 04:30:21 +0000
2016-03-12T04:30:21.745309+00:00 app[web.1]: [1m[33mUser Store (7.7ms)[0m {"id":2,"exception":["Faraday::ConnectionFailed","Connection refused - connect(2)"]}
2016-03-12T04:30:21.746719+00:00 app[web.1]: Completed 500 Internal Server Error in 100ms (Searchkick: 7.7ms | ActiveRecord: 9.8ms)
2016-03-12T04:30:21.751092+00:00 app[web.1]: Faraday::ConnectionFailed (Connection refused - connect(2)):
2016-03-12T04:30:21.751092+00:00 app[web.1]: app/models/user.rb:83:in `create_reset_digest'
2016-03-12T04:30:21.751093+00:00 app[web.1]: app/controllers/password_resets_controller.rb:13:in `create'
2016-03-12T04:30:21.836029+00:00 heroku[router]: at=info method=POST path="/password_resets" host=xxxxx.herokuapp.com request_id=69de3b2a-9f18-4a28-be0a-706a5dc9a341 fwd="71.125.40.81" dyno=web.1 connect=0ms service=181ms status=500 bytes=1714
I had to run heroku run rake search kick:reindex CLASS=User and it fixed it.
I remake my index and it works;
bundle exec rake searchkick:reindex:all
or if you want you could reindex item by item
Products.reindex
User.reindex

Cant get MongoLab database to work on heroku

I have deployed my app to heroku but and I can see the app but the app is NOT accessing the mongolab database. I have tried resetting the database in console with
$ heroku run rake db:reset
but I get this error.
failed with error 13: "not authorized on ENV['MONGOID_DATABASE'] to execute command { dropDatabase: 1 }"
See https://github.com/mongodb/mongo/blob/master/docs/errors.md
Not sure what I am doing wrong, I have not setup an app with mongoid on heroku before, this is my first time
-UPDATE-
Here is the end of the log I have that seems to show the post is not working.
$ heroku logs
2015-09-25T16:20:15.770927+00:00 heroku[router]: at=info method=POST path="/managers" host=beta.herokuapp.com request_id=95709038-02e9-45b1-8300-0aebc287f6c1 fwd="162.239.42.196" dyno=web.1 connect=0ms service=178ms status=500 bytes=1480
2015-09-25T16:20:15.770408+00:00 app[web.1]: D, [2015-09-25T16:20:15.770342 #3] DEBUG -- : MOPED: 10.152.165.9:29821 QUERY database=ENV['MONGOID_DATABASE'] collection=managers selector={"email"=>"sample#email.com"} flags=[] limit=-1 skip=0 batch_size=nil fields={:_id=>1} runtime: 1.0352ms
Here are the router logs...
$ heroku logs --ps router
2015-09-25T20:40:46.935184+00:00 heroku[router]: at=info method=POST path="/managers" host=beta.herokuapp.com request_id=c1673463-a69f-4111-bd4d-01fdb5516ad0 fwd="162.239.42.196" dyno=web.1 connect=2ms service=109ms status=500 bytes=1480
2015-09-25T20:40:47.285029+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=beta.herokuapp.com request_id=1e998283-b02b-4cc5-83f6-7996a6991531 fwd="162.239.42.196" dyno=web.1 connect=1ms service=2ms status=200 bytes=143
2015-09-26T04:45:32.833599+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=beta.herokuapp.com request_id=59ccc2e7-18d4-4c08-8b08-a653f5d11714 fwd="2602:30a:2ef2:ac40:acb1:9144:79b4:affb,66.249.88.51" dyno=web.1 connect=1ms service=4ms status=200 bytes=143
I also see it failing to query the database
2015-09-26T05:03:39.852170+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"WVGY+XLD...A=", "manager"=>{"name"=>"Blah Blah", "company"=>"Blah Blah CO.", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
2015-09-26T05:03:40.138442+00:00 app[web.1]: D, [2015-09-26T05:03:40.138321 #3] DEBUG -- : MOPED: 10.152.165.9:29821 COMMAND database=admin command={:ismaster=>1} runtime: 23.5306ms
2015-09-26T05:03:40.146776+00:00 app[web.1]: Completed 500 Internal Server Error in 294ms
2015-09-26T05:03:40.146782+00:00 app[web.1]: Completed 500 Internal Server Error in 294ms
2015-09-26T05:03:40.152205+00:00 app[web.1]:
2015-09-26T05:03:40.152208+00:00 app[web.1]: Moped::Errors::QueryFailure (The operation: #<Moped::Protocol::Query
2015-09-26T05:03:40.152209+00:00 app[web.1]: #length=112
2015-09-26T05:03:40.152211+00:00 app[web.1]: #request_id=4
2015-09-26T05:03:40.152212+00:00 app[web.1]: #response_to=0
2015-09-26T05:03:40.152214+00:00 app[web.1]: #op_code=2004
2015-09-26T05:03:40.152215+00:00 app[web.1]: #flags=[]
2015-09-26T05:03:40.152216+00:00 app[web.1]: #full_collection_name="ENV['MONGOID_DATABASE'].managers"
2015-09-26T05:03:40.152218+00:00 app[web.1]: #skip=0
2015-09-26T05:03:40.152219+00:00 app[web.1]: #limit=-1
2015-09-26T05:03:40.152222+00:00 app[web.1]: #selector={"email"=>"sample#email.com"}
2015-09-26T05:03:40.152224+00:00 app[web.1]: #fields={:_id=>1}>
2015-09-26T05:03:40.152225+00:00 app[web.1]: failed with error 13: "not authorized for query on ENV['MONGOID_DATABASE'].managers"
2015-09-26T05:03:40.152227+00:00 app[web.1]:
2015-09-26T05:03:40.152228+00:00 app[web.1]: See https://github.com/mongodb/mongo/blob/master/docs/errors.md
I figured it out. The db was not connecting because the mongoid.yml file was incorrect. I tweaked the yml file and added the URI to the heroku variables and it worked correctly.

Config Tire to work with Bonsai ElasticSearch Heroku add-on

So I have a rails 3.2 app. I created an index.
I followed this guide: https://gist.github.com/nz/2041121 to create an bonsai.rb file in config/initializers/bonsai.rb
It looks like this:
ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
# Optional, but recommended: use a single index per application per environment.
# Caveat: This convention not be entirely supported throughout Tire's API.
app_name = Rails.application.class.parent_name.underscore.dasherize
app_env = Rails.env
INDEX_NAME = "#{app_name}-#{app_env}"
But I dosent work, this outprint from the heroku logs:
2013-03-06T17:04:54+00:00 app[web.1]: Processing by SchoolsController#index as HTML
2013-03-06T17:04:54+00:00 app[web.1]: Started GET "/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6" for 192.165.96.102 at 2013-03-06 17:04:54 +0000
2013-03-06T17:04:54+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "query"=>"Malmö"}
2013-03-06T17:04:58+00:00 heroku[router]: at=info method=GET path=/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6 host=stormy-escarpment-2346.herokuapp.com fwd="192.165.96.102" dyno=web.1 queue=0 wait=0ms connect=1ms service=3106ms status=500 bytes=643
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]: app/models/school.rb:19:in `search'
2013-03-06T17:04:58+00:00 app[web.1]: app/controllers/schools_controller.rb:10:in `index'
2013-03-06T17:04:58+00:00 app[web.1]: Completed 500 Internal Server Error in 3073ms
2013-03-06T17:04:58+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]:
My questions:
Should I put somehting in the ELASTICSEARCH_URL in the bonsai.rb file? If yes, then what?
I have created a local index to, does that mean something?
Or is it something else?
The config/initializers/bonsai.rb was right and the problem was I had to index it in production mode also.
So I did this:
heroku rake environment tire:import CLASS=School FORCE=true
And it worked.

Heroku breaks when devise attempts to send confirmation email

2011-10-24T05:54:00+00:00 app[web.1]: Started POST "/users" for 69.136.182.141 at 2011-10-23 22:54:00 -0700
2011-10-24T05:54:00+00:00 app[web.1]: Processing by Devise::RegistrationsController#create as HTML
2011-10-24T05:54:00+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"ts2MkJf472PHTEcKjdD3P5YjBr/sWX3jTDZKjPZNYj0=", "user"=>{"username"=>"DerNalia", "email"=>"[not_telling]#gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Register"}
2011-10-24T05:54:00+00:00 app[web.1]: Rendered devise/mailer/confirmation_instructions.html.erb (0.4ms)
2011-10-24T05:54:03+00:00 app[web.1]:
2011-10-24T05:54:03+00:00 app[web.1]: Sent mail to [not_telling]#gmail.com (3003ms)
2011-10-24T05:54:03+00:00 app[web.1]: Completed 500 Internal Server Error in 3137ms
2011-10-24T05:54:03+00:00 app[web.1]:
2011-10-24T05:54:03+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2011-10-24T05:54:03+00:00 app[web.1]:
2011-10-24T05:54:03+00:00 heroku[router]: POST swinglx.heroku.com/users dyno=web.1 queue=0 wait=0ms service=3147ms status=500 bytes=728
2011-10-24T05:54:03+00:00 app[web.1]:
2011-10-24T05:54:03+00:00 app[web.1]:
2011-10-24T05:54:03+00:00 app[web.1]: cache: [POST /users] invalidate, pass
Any idea what is causing the problem?
Does heroku run in production?
my production URL is SwingLX.com which hasn't registered yet with the DNS name server switch.
Heroku does not provide any way of sending email by default - such as local sendmail or similar. Consequently you need to use an external provider such as their SendGrid addon http://devcenter.heroku.com/articles/sendgrid which you would send email through.

Resources