Skip to content

Instantly share code, notes, and snippets.

@palkan
Last active November 21, 2018 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palkan/45509365fe3f7bc449e07c10e1753534 to your computer and use it in GitHub Desktop.
Save palkan/45509365fe3f7bc449e07c10e1753534 to your computer and use it in GitHub Desktop.
AnyCable 0.6.0 releases

Ref: https://github.com/anycable/anycable/releases/tag/v0.6.0

0.6.0 "Lost in Hollywood" 🌆

RubyConf 2018 special.

tl;dr anycable CLI; redis gem is no longer a runtime dependency (but still required for Redis broadcast adapter); health checkers; middlewares support and more flexible configuration.

📝 Check out a new documentation website.

Features

CLI

AnyCable now ships with a CLI–anycable.

Use it to run a gRPC server:

# run anycable and load app from app.rb
bundle exec anycable -r app.rb
# or
bundle exec anycable --require app.rb

All configuration options are also supported as CLI options (see anycable -h for more information).

The only required options is the application file to load (-r/--require).

You can omit it if you want to load an app form ./config/environment.rb (e.g. with Rails) or ./config/anycable.rb.

AnyCable CLI also allows you to run a separate command (process) from within a RPC server:

$ bundle exec anycable --server-command "anycable-go -p 3334"

Configuration

  • Default server host is changed from localhost:50051 to 0.0.0.0:50051
  • Expose gRPC server parameters via rpc_* config params:
AnyCable.configure do |config|
  config.rpc_pool_size = 120
  config.rpc_max_waiting_requests = 10
  # etc
end
  • REDIS_URL env is used by default if present (and no ANYCABLE_REDIS_URL specified)
  • Make HTTP health check url configurable
  • Add ability to pass Redis Sentinel config as array of string.

Now it's possible to pass Sentinel configuration via env vars:

ANYCABLE_REDIS_SENTINELS=127.0.0.1:26380,127.0.0.1:26381 bundle exec anycable

Broadcast adapters

AnyCable allows you to use custom broadcasting adapters (Redis is used by default):

# Specify by name (tries to load `AnyCable::BroadcastAdapters::MyAdapter` from
# "anycable/broadcast_adapters/my_adapter")
AnyCable.broadcast_adapter = :my_adapter, { option: "value" }
# or provide an instance (should respond_to #broadcast)
AnyCable.broadcast_adapter = MyAdapter.new

Breaking: to use Redis adapter you must ensure that it is present in your Gemfile; AnyCable gem doesn't have redis as a dependency anymore.

Other

  • Added middlewares support

See docs.

  • Added gRPC health checker.

See docs.

Changes

NOTE: the old API is still working but deprecated (you'll see a notice).

  • Use AnyCable instead of Anycable

  • New API for registering error handlers:

AnyCable.capture_exception do |ex|
  Honeybadger.notify(ex)
end
  • AnyCable::Server.start is deprecated and will be removed in the next version

Ref: https://github.com/anycable/anycable-go/releases/tag/v0.6.0

0.6.0 "Around the World" 🗺

The main goal of 0.6.0 release was a codebase refactoring and reorganization (for better flexibility and extensibility).

tl;dr changed CLI interface and configuration options, instrumentation, better logging, graceful termination, bug fixes.

Documentation now lives at https://docs.anycable.io/#/go_getting_started.

See also upgrade notes.

Changes

  • [Breaking] New configuration and CLI options.

See upgrade notes for more information.

  • New logging format.

Now we use structured logging with the help if apex/log. For example:

INFO 2018-03-05T08:44:57.684Z context=main Starting AnyCable unknown
INFO 2018-03-05T08:44:57.684Z context=main Handle WebSocket connections at /cable
INFO 2018-03-05T08:44:57.684Z context=http Starting HTTP server at 0.0.0.0:8080
INFO 2018-03-05T08:44:57.685Z context=rpc RPC pool initialized: 0.0.0.0:50051
INFO 2018-03-05T08:44:57.695Z context=pubsub Subscribed to Redis channel: __anycable__

Also, json format is supported out-of-the-box (--log_format=json or ANYCABLE_LOG_FORMAT=json).

Features

  • Added instrumentation (metrics) support (including out-of-the-box Prometheus exporter)

See documentation.

  • Added signal handling and graceful shutdown.

When receiving SIGINT or SIGTERM we:

  • Stop the server (to not accept new connections)
  • Close all registered sessions (authenticated clients)
  • Wait for pending Disconnect requests to complete
  • Wait for active RPC calls to finish.

Misc

  • Reduced binary size (thanks to @sponomarev)

See anycable/anycable-go#45.

Ref: https://github.com/anycable/anycable-rails/releases/tag/v0.6.0

0.6.0 "Old School Hollywood" 🎥

RubyConf 2018 special.

tl;dr use anycable CLI instead of generator; use :any_cable subscription adapter for Action Cable to activate AnyCable.

NOTE: this version has been yanked from RubyGems due to the regression bug. Use 0.6.1.

This release requires anycable gem >= 0.6.0. See release notes for anycable 0.6.0.

See also upgrade notes.

Changes

  • No more generators.

No need to generate AnyCable runner script since anycable gem ships with the CLI.

Scripts generated by the previous version should work (unless have a non-generated code).

  • [Breaking] Added :any_cable subscription adapter for Action Cable.

Use :any_cable adapter for Action Cable to broadcast data to AnyCable.

Action Cable monkey-patches are only loaded in the context of AnyCable CLI. ([@palkan][])

No need to think about require and group for anycable-rails, just add it to Gemfile.

Features

  • Added support for request verification based on ActionCable config (disable_forgery_protection, allow_same_origin_as_host and allowed_request_origins)

  • Add compatibility checks.

See documentation.

  • Add WS server session ID to log tags if present.

Session ID feature is supported by anycable-go >= 0.6.0.

Improvements

  • Tagged logging is supported (was ignored previously).

  • Added Rails executor/reloader support.

Now code changes are handled by RPC server (in development).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment