简体   繁体   English

使用AWS Elastic Beanstalk部署Rails ActionCable

[英]Deploying Rails ActionCable using AWS Elastic Beanstalk

I'm trying to deploy the chat demo from DHH on AWS Elastic Beanstalk. 我正在尝试在AWS Elastic Beanstalk上部署来自DHH的聊天演示。 I've followed the tutorial here: https://keithpblog.wordpress.com/2015/12/30/rails-5-tutorial-chat-app-can-we-deploy-it And I've managed to get the solution deployed in a single instance and Redis up and running too. 我按照这里的教程: https//keithpblog.wordpress.com/2015/12/30/rails-5-tutorial-chat-app-can-we-deploy-it我已经设法得到了解决方案部署在单个实例中,Redis也启动并运行。 But when I try to post something, the message is saved in the db, but not returned by the WebSocket. 但是当我尝试发布内容时,消息将保存在数据库中,但不会被WebSocket返回。 I've checked the production.log and I can see this error message: 我检查了production.log,我可以看到此错误消息:

E, [2016-05-20T20:33:52.676577 #24281] ERROR -- : There was an exception - Gem::LoadError(Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded. Add gem 'redis' to your Gemfile (and ensure its version is at the minimum required by Action Cable).) E,[2016-05-20T20:33:52.676577#24281]错误 - :有一个例外 - Gem :: LoadError(为Action Cable pubsub适配器指定'redis',但没有加载gem 'redis' 。添加gem 'redis'到您的Gemfile(并确保其版本是Action Cable所要求的最低版本)。)

E, [2016-05-20T20:33:52.676826 #24281] ERROR -- : /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:in `rescue in pubsub_adapter' 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中的救援'中

/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' /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'

I also have in my Gemfile: gem 'redis', '~>3.2' 我也有我的Gemfile:gem'redis','〜> 3.2'

Any Ideas? 有任何想法吗? Thanks! 谢谢!

I fixed the error by adding to my Gemfile: 我通过添加到我的Gemfile修复了错误:

gem 'em-hiredis'
gem 'redis'

The other change that I had to make was on /environments/production.rb 我必须做的另一个改变是在/environments/production.rb上

config.action_cable.url = 'ws://url.com/cable'
config.action_cable.allowed_request_origins = ['http://url.com']

And with that, I have actioncable up and running on Elastic Beanstalk 有了这个,我就可以在Elastic Beanstalk上运行并运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM