start faye on cloudControl

228 views Asked by At

Question:

Problem is similar to Faye setup in production. Can't start Faye in staging on CloudControl. Here is faye.ru:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
Faye::WebSocket.load_adapter('thin')
run faye_server

Here is Procfile:

web: bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORT
faye: bundle exec thin start -R faye.ru -p 9292

Staging log:

11/21/14 12:27 PM Deploy ***** Deployed 09c2174cba4b14375779a5160ab7348a62a570b4 *****
11/21/14 12:27 PM Info Started GET "/" for 10.99.3.169 at 2014-11-21 10:27:02 +0000
11/21/14 12:27 PM Info Listening on 0.0.0.0:25143, CTRL+C to stop
11/21/14 12:27 PM Info Maximum connections set to 1024
11/21/14 12:27 PM Info Thin web server (v1.6.3 codename Protein Powder)
11/21/14 12:27 PM Deploy ***** Deployed 09c2174cba4b14375779a5160ab7348a62a570b4 *****
11/21/14 12:27 PM Info Started GET "/" for 10.94.134.23 at 2014-11-21 10:27:01 +0000
11/21/14 12:27 PM Info Listening on 0.0.0.0:12103, CTRL+C to stop
11/21/14 12:27 PM Info Maximum connections set to 1024
11/21/14 12:27 PM Info Thin web server (v1.6.3 codename Protein Powder)

And myapp.cloudcontrolapp.com is ok, but I can't get myapp.cloudcontrolapp.com:9292/faye.js

If I do start rails server localy with faye I got it ok: 1. rails s 2. if Rails.env.development? Thread.new do system("rackup faye.ru -s thin -E production") end end in initializer. The local log is:

Thin web server
Maximum connections set to 1024
Listening on 0.0.0.0:9292, CTRL+C to stop
Thin web server 
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop

And localhost:9292/faye.js is ok, localhost:3000 is ok

Can someone point me how to start faye on cloudControl? Thank you.

1

There are 1 answers

1
pst On BEST ANSWER

Only web type processes are accessible from the outside and they have to listen on the port specified in $port. Just like your first line in the Procfile. If you want a second process to listen on a port and be accessible from the outside, you have to put that into a second app.