在cloudControl上启动faye

时间:2014-11-21 08:53:48

标签: ruby-on-rails faye cloudcontrol

问题:

问题类似于Faye setup in production。无法在CloudControl的舞台上开始Faye。 这是faye.ru

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

以下是Procfile

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

暂存日志:

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)

myapp.cloudcontrolapp.com没问题,但我无法获取myapp.cloudcontrolapp.com:9292/faye.js

如果我用faye启动rails server localy,我就把它搞定了: 导轨 2. if Rails.env.development? Thread.new do system("rackup faye.ru -s thin -E production") end end 在初始化程序中。 本地日志是:

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

localhost:9292 / faye.js没关系,localhost:3000还可以

有人能指出我如何在cloudControl上启动faye吗?谢谢。

1 个答案:

答案 0 :(得分:0)

只能从外部访问Web类型进程,并且它们必须侦听$ port中指定的端口。就像你在Procfile中的第一行一样。如果您希望第二个进程监听端口并可从外部访问,则必须将其放入第二个应用程序。