What config.action_cable.url should be configured for websockets / Rails / Kubernetes ?
When running “docker-compose” with a Rails process (not API only, but with SSR) and a standalone Cable process (the Rails container is run with
bundle exec puma -p 28080 ./cable/config.ru as per the guides), the websockets work fine by passing server-side, in say “/config/application.rb”, the following (with the
action_cable_meta_tag set in the layouts):
config.action_cable.url = 'ws://localhost:28080'
I am targetting Kubernetes: I run a Rails deployment along with a Cable deployment but I can’t make it work. The Cable service is of type “ClusterIP”. I tried several variations; from setting
ws://cable-svc:28080/cable where “cable-svc” is the name of the cable service.
Note that I use LB -> Nginx -> Rails + Cable on Minikube, and passed:
proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.