简体   繁体   中英

Deploying Rails ActionCable using 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] 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] 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/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'

Any Ideas? Thanks!

I fixed the error by adding to my Gemfile:

gem 'em-hiredis'
gem 'redis'

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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