anycable / anycable-rails

AnyCable for Ruby on Rails applications
https://anycable.io
MIT License
495 stars 35 forks source link

Nearly Complete Deployment w/Anycable #163

Closed RailsCod3rFuture closed 3 years ago

RailsCod3rFuture commented 3 years ago

Gemfile ruby '2.7.1' gem 'anycable-rails', '~> 1.1', '>= 1.1.2' gem 'redis', '~> 4.0' gem 'rails', '~> 6.1.0'

Server Specs EC2 Ubuntu 20 Server Nginx/Phusion Passenger/Redis 8GB of RAM

cable.yml

development: adapter: any_cable

production: adapter: any_cable

environment/production.rb

config.action_cable.url = "ws://127.0.0.1:8080/cable" # should this be server public ip address? config.action_cable.allowed_request_origins = [/http:\/\//, /https:\/\//]

anycable.yml

default: &default rpc_host: "127.0.0.1:50051" log_grpc: false broadcast_adapter: redis redis_channel: "anycable"

development: redis_url: redis://localhost:6379/1 access_logs_disabled: false

test: <<: *default

production: redis_url: redis://127.0.0.1:6379/0 access_logs_disabled: false

anycable-capistrano command output

03:01 anycable:restart 01 RBENV_ROOT=/home/deploy_user/.rbenv RBENV_VERSION=2.7.1 /home/deploy_user/.rbenv/bin/rbenv exec bundle exec anycab… 01 anycable: trying to stop process with pid 19676... 01 anycable: process with pid 19676 successfully stopped. 01 anycable: process with pid 25186 started. ✔ 01 ubuntu@3.132.124.33 2.142s

I am running anycable/nginx/passenger/redis the on the same server.....redis is configured using ip 127.0.0.1... I don't know exactly why I can't receive incoming request from the websockets on my ubuntu server. I followed the guide....plus, I'm using anycable-capistrano instead of homebaked scripts/deployment tactics. Given that you guys have more knowledge than I do with anycable. What am I missing on the Ubuntu 20 server, that is stopping the websockets from interacting with the application correctly? Do I have to install the anycable-go server or add something else to the configurations here? I'll give outputs of commands/various things to quickly get this resolved.

WebSocket connection to 'ws://127.0.0.1:8080/cable' failed:

Envek commented 3 years ago

config.action_cable.url = "ws://127.0.0.1:8080/cable" # should this be server public ip address?

Yes, exactly. Or DNS name pointing to this addres (where anycable-go is running)

Do I have to install the anycable-go server

Yes. anycable-go handles websocket connections, so it must be installed and running on the server. See AnyCable architecture for details on which part communicates with which.

RailsCod3rFuture commented 3 years ago

Alright, I will try now and give you the output.

RailsCod3rFuture commented 3 years ago

Its working now