kandanapp / kandan

Kandan is an Open Source Alternative to HipChat
GNU Affero General Public License v3.0
2.72k stars 408 forks source link

Faye Troubleshooting #355

Open johnjelinek opened 10 years ago

johnjelinek commented 10 years ago

I'm using Phusion Passenger + nginx instead of thin. Almost everything works right out of the box, except I need to add therubyracer gem and faye constantly has to reconnect. Do you have any recommendations on getting faye to work?

Comm link is up! application.js?body=1:29
XHR finished loading: POST "http://localhost:3000/remote/faye". faye.js:2
XHR finished loading: POST "http://localhost:3000/remote/faye". faye.js:2
Comm link to Cybertron is down! application.js?body=1:29
XHR finished loading: POST "http://localhost:3000/remote/faye". faye.js:2
Comm link is up! application.js?body=1:29

I see a lot of this repeated in the console.

alexhulbert commented 10 years ago

Could this be linked to issue #327? I know faye was freaking out there.

johnjelinek commented 10 years ago

It's different though, in the issue you referenced, faye is returning 404s, in mine it successfully connects and dies. It seems like maybe Passenger or nginx aren't handling the websockets so well perhaps. Any suggestions? On May 9, 2014 8:54 AM, "Taconut" notifications@github.com wrote:

Could this be linked to issue #327https://github.com/kandanapp/kandan/issues/327? I know faye was freaking out there.

— Reply to this email directly or view it on GitHubhttps://github.com/kandanapp/kandan/issues/355#issuecomment-42668259 .

scouttyg commented 10 years ago

I notice Cybertron goes down a bit in the console, but it usually comes right back up. Are you experiencing dropped messages? IE If you post a message are you still seeing things like:

XHR finished loading: POST "https:/yourapp.com/channels/1/activities". 
scouttyg commented 10 years ago

What version of Phusion Passenger + nginx are you using for the app? From faye-websocket's documentation:

(supported environments)

Phusion Passenger >= 4.0 with nginx >= 1.4
johnjelinek commented 10 years ago

I'm not noticing dropped messages, but the account menu in the top right isn't responding to clicks. POSTs are successful. I'm using the latest passenger/nginx mentioned in this docker container: https://github.com/phusion/passenger-docker.

I created a kandan dockerfile to spin up kandan instances on demand, I wanted to depend on the phusion ruby container because the default kandan install instructions weren't working for me (had problems with building the json native gem) and their container had that fixed. On May 10, 2014 10:39 AM, "scouttyg" notifications@github.com wrote:

What version of Phusion Passenger + nginx are you using for the app? From faye-websocket's documentation:

(supported environments)

Phusion Passenger >= 4.0 with nginx >= 1.4

— Reply to this email directly or view it on GitHubhttps://github.com/kandanapp/kandan/issues/355#issuecomment-42745190 .

johnjelinek commented 10 years ago

I now have both nginx serving through passenger on port 8080 and thin serving simultaneously on port 3000. I'm noticing that the thin server is having the loading messages problem and the passenger server is getting a popup after I login saying it cannot connect (but it does seem to send messages and load previous messages).

johnjelinek commented 10 years ago

This is the message through phusion passenger:

screenshot_5_13_14__5_32_pm

johnjelinek commented 10 years ago

lol, I have no idea how to debug this ... it's intermittent. After a few reloads, both load previous messages ... even though passenger is still saying that message on page refresh.

johnjelinek commented 10 years ago

Perhaps I need to upgrade the connection to support websockets in nginx 1.6, but it's not proxying the connection to passenger, it's running passenger through custom nginx commands.

johnjelinek commented 10 years ago

currently, only in the 3000 (thin) server do multiple users display in the chat list.

johnjelinek commented 10 years ago

I'm using vagrant/docker for all this ... so please let me know if you'd like a copy of my files to spin this up yourself for further analysis.

johnjelinek commented 10 years ago

Note: you can see an on-going discussion here https://github.com/phusion/passenger-docker/issues/22 as well.

miurahr commented 9 years ago

Here is my (partially) working snippet for nginx/faye configuration for nginx-1.9.2.

        map $http_upgrade $connection_upgrade {
            default Upgrade;
            ''      close;
        }
    location /remote/ {
                proxy_pass http://kandanserver;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection $connection_upgrade;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                add_header Front-End-Https on;
                proxy_connect_timeout 90;
                proxy_read_timeout 86400;
                proxy_send_timeout 90;
                proxy_buffering off;
                proxy_redirect off;
        }
    location / {
                proxy_pass http://kandanserver;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https;
     }

One big point is http protocol upgrade option to support WebSocket. It has an issue not to make desktop notification working. I've used kandan with https, it may be an issue with https support.