我试图在AWS Elastic Beanstalk上部署来自DHH的聊天演示。我已按照此处的教程进行操作:https://keithpblog.wordpress.com/2015/12/30/rails-5-tutorial-chat-app-can-we-deploy-it我已设法在单个实例中部署解决方案,并且Redis也已启动并运行。但是当我尝试发布内容时,消息将保存在数据库中,但不会被WebSocket返回。我已经检查了production.log,我可以看到此错误消息:
E,[2016-05-20T20:33:52.676577#24281]错误 - :有一个例外 - Gem :: LoadError(指定' redis'用于Action Cable pubsub适配器,但是gem未加载。将gem 'redis'
添加到您的Gemfile中(并确保其版本符合Action Cable所需的最低版本)。)
E,[2016-05-20T20:33:52.676826#24281]错误 - :/opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.0 .rc1 / lib / action_cable / server / configuration.rb:37:在pubsub_adapter中的`rescue'
/opt/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.0.rc1/lib/action_cable/server/configuration.rb:34:in`pubsub_adapter 39;
我的Gemfile中也有: gem' redis','〜> 3.2'
任何想法?谢谢!
答案 0 :(得分:2)
我通过添加到我的Gemfile修复了错误:
gem 'em-hiredis'
gem 'redis'
我必须做的另一项改变是在/environments/production.rb
config.action_cable.url = 'ws://url.com/cable'
config.action_cable.allowed_request_origins = ['http://url.com']
然后,我在Elastic Beanstalk
上启动并运行了actioncable