Skip to main content
This guide shows you how to replace Action Cable with AnyCable. Both provide similar functionality, but have different scaling characteristics. While AnyCable has the potential to reduce RAM requirements on large deployments, the need to run multiple processes makes it impossible to run AnyCable alongside even a tiny Rails application on a 256MB machine. A minimum of 512MB is required. The configuration below also runs nginx as a reverse proxy to avoid any firewall issues. It also runs everything on one VM, which has a number of downsides including dropping socket connections every time a new version of your application is deployed. For another take on configuring AnyCable to run on fly.io, see Fly.io Deployment on the anycable site.

Prepare your application

If you haven’t already dones so, perform the steps described in the Provisioning Redis section of the Getting Started guide. Also be sure that the pg gem is listed in your Gemfile. Now add the anycable-rails gem:
Edit config/cable.yml thus:

Update your image

Modify Dockerfile to install foreman, anycable-go and nginx:
Edit fly.toml to run foreman::
Add Procfile.fly to start the four processes required:
Add config/nginx.conf to reverse proxy cable traffic to anycable-go and send the remainder to your Rails application::

Deployment

If you haven’t already done so, scale your machine:
Now you are ready to deploy: