Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

Chat app using ActionCable and Elasticache on Ruby on Rails

$
0
0

First of all, Thank you for paying attention to my question.And sorry for my broken English as I am not a native English speaker.Please let me know if you ever need more informations or codes.

What I am trying

I am currently working on a chat app using Action Cable on Ruby on RailsI am using AWS as infrastructure, and EC2 and Elasticache(Redis) and ALB.

Error which I have got

There is no showing error on console.

This is log from production.log

Could not execute command from ({"command"=>"message", "identifier"=>"{\"channel\":\"ChatRoomChannel\",\"chat_id\":1}", "data"=>"{\"text\":\"test\",\"chat_id\":1,\"user_id\":7,\"action\":\"chat\"}"}) [ArgumentError - invalid uri scheme '']: /var/www/myapp/shared/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:438:in `_parse_options' | /var/www/myapp/shared/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis/client.rb:83:in `initialize' | /var/www/myapp/shared/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:45:in `new' | /var/www/myapp/shared/bundle/ruby/2.6.0/gems/redis-4.1.3/lib/redis.rb:45:in `initialize' | /var/www/myapp/shared/bundle/ruby/2.6.0/gems/actioncable-5.2.4.1/lib/action_cable/subscription_adapter/redis.rb:16:in `new'

Codes

environment/production.rb

  config.action_cable.allowed_request_origins = [ 'https://myapp.com', /https:\/\/myapp.com.*/,'http://myapp.com', /http:\/\/myapp.com.*/ ]  config.action_cable.disable_request_forgery_protection = true

routes.rb

mount ActionCable.server => '/cable'

cable.yml

production:  adapter: redis  port: 6379  url: <%= ENV['REDIS_URL'] %>

ENV['REDIS_URL'] is primary endpoint for Elasticache(redis)

location /cable {        proxy_pass http://app_server;        proxy_http_version 1.1;        proxy_set_header Upgrade websocket;        proxy_set_header Connection Upgrade;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }

What I have tried

Elasticache has been connected with EC2

Other Info

Ruby 2.6.3Rails 5.2.4.1AWS(EC2, Elasticache, ALB)


Viewing all articles
Browse latest Browse all 873

Trending Articles