使用AWS Elastic Beanstalk部署Rails ActionCable [英] Deploying Rails ActionCable using AWS Elastic Beanstalk

查看:107
本文介绍了使用AWS Elastic Beanstalk部署Rails ActionCable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从DHH在AWS Elastic Beanstalk上部署聊天演示.我在这里遵循了该教程:

I'm trying to deploy the chat demo from DHH on AWS Elastic Beanstalk. 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. But when I try to post something, the message is saved in the db, but not returned by the WebSocket. I've checked the production.log and I can see this error message:

E,[2016-05-20T20:33:52.676577#24281]错误-:发生异常-Gem :: LoadError(动作电缆pubsub适配器指定为'redis',但未加载gem.添加gem 'redis'到您的Gemfile(并确保其版本为Action Cable要求的最低版本).

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.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中的救援中

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'

/opt/rubys/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.0.rc1/lib/action_cable/server/configuration.rb:34:在"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'

我的Gemfile中也有: 宝石'redis','〜> 3.2'

I also have in my Gemfile: gem 'redis', '~>3.2'

有什么想法吗?谢谢!

推荐答案

我通过添加到我的Gemfile中修复了该错误:

I fixed the error by adding to my Gemfile:

gem 'em-hiredis'
gem 'redis'

我必须进行的另一项更改是在/environments/production.rb

The other change that I had to make was on /environments/production.rb

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

有了这个,我就可以在ActionsCable上运行并在Elastic Beanstalk上运行

And with that, I have actioncable up and running on Elastic Beanstalk

这篇关于使用AWS Elastic Beanstalk部署Rails ActionCable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆