ryanb / private_pub

Handle pub/sub messaging through private channels in Rails using Faye.
MIT License
864 stars 228 forks source link

Don't work in production mode #120

Open aabse opened 8 years ago

aabse commented 8 years ago

Hi. I can't work with the gem in production mode. In local mode it works fine. In the page, when i try to put a message in the chat, nothing happens.

I'm using nginx, passenger, thin.

Below it includes information that can be useful for support:

My private_pub.yml:

development: server: "http://192.168.1.48:9292/faye" secret_token: "secret" test: server: "http://192.168.1.48:9292/faye" secret_token: "secret" production: server: "http://181.160.190.149/faye" secret_token:"79301c39f07005f5e0ba58a4387c316c028d8c573fa3032b18c24d5ac35645935a64b93189eb19c514cfe34e0851a479b808041d32cd29735cfadd05f1a6f5c4" signature_expiration: 3600 # one hour

In the nginx config I added a proxy:

location /faye { proxy_pass http://127.0.0.1:9292; proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_buffering off; proxy_redirect off; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_set_header X-Forwarded-Proto https; break; }

Information about errors (when I try to put a message in the chat):

In the browser console:

Failed to load resource the server responded with a status of 500 (Internal Server Error).

In the file production.log:

Started POST "/messages" for 201.220.243.237 at 2015-11-03 18:57:02 -0300 Processing by MessagesController#create as JS Parameters: {"utf8"=>"✓", "authenticity_token"=>"rEH4anhuP4jYUphNo458aKNIi77nDABavy/JgW7tSGQ=", "message"=>{"query"=>"1", "body"=>"asd"}, "commit"=>"Enviar"} Completed 500 Internal Server Error in 109ms EOFError (end of file reached): app/controllers/messages_controller.rb:18:in `create'

app/controllers/messages_controller.rb:18 : PrivatePub.publish_to("/messages/new/#{params[:message][:query]}", message: @message, lecture: @lecture)

jjs1233 commented 7 years ago

hey man Do you have solved your problem? I using the this gem on the local model worked fine but on the vps server when I start the private_pub by rackup private_pub.rb -E production -s thin the nginx report wrong (111: Connection refused) while connecting to upstream but after stop the thin server ,it worked no problem