Kuby AnyCable

This plugin allows you to install all the required AnyCable components to a Kubernetes cluster.


Here is the minimal configuration:

# kuby.rb

require "kuby-anycable"

# ...

Kuby.define("my-app") do
  environment(:production) do

    kubernetes do
      add_plugin :rails_app do
        # ...

      add_plugin :anycable_rpc
      add_plugin :anycable_go

What happens under the hood:

  • RPC service definitions are created:
    • The current rails_app image is used for the container.
    • The rails_app Config Map is attached to the RPC container.
  • AnyCable-Go service definitions are created:
    • The latest stable image is used for anycable-go.
    • Connected to the RPC service (using DNS load balancing by default).
    • Redis URL is inferred from the RPC service ANYCABLE_REDIS_URL or REDIS_URL.
    • Concurrency settings are adjusted according to the number of RPC servers and their concurrency settings.

Of course, you can customize the resources:

add_plugin :anycable_rpc do
  replicas 2
  # Provide Redis URL explicitly.
  redis_url "redis://custom_url"
  # Override gRPC server port (but why?)
  port 50051
  # Expose additional port named 'metrics'
  # (e.g., if you use Prometheus exporter).
  # Disabled by default.
  metrics_port 3030
  max_connection_age 300000
  # Shortcut for ENV['ANYCABLE_RPC_POOL_SIZE']
  rpc_pool_size 30

add_plugin :anycable_go do
  replicas 2
  # Provide Redis URL explicitly.
  redis_url "redis://custom_url"
  # Override web server port (but why?)
  port 8081
  # Metrics port (enabled by default and exposed as "metrics")
  metric_port 5001
  # Provide path to RPC server explicitly
  rpc_host "my-app-rpc:50051"
  # WebSocket endpoint path
  ws_path "/cable"
  # AnyCable-Go Dockerimage
  image "anycable/anycable-go:1.1"
  # Specify ENV['ANYCABLE_RPC_CONCURRENCY'] explicitly
  rpc_concurrency nil
  # Use a separate hostname for AnyCable-Go
  # (disabled by default)
  hostname nil

Further reading

In the same orbit

Explore more open source projects

Contact us

We’d love to hear from you! We’re not really all that evil, and we love discussing potential projects, intriguing ideas, and new opportunities. Complete the form below or drop us a line at surrender@evilmartians.com. Alternatively, schedule a Calendly appointment with us right now!

Martians at a glance
years in business

A product development consultancy that works with startups and established businesses, while also creating open source-based products and services