Portals.Ruby (portals_ruby v0.1.0)

Copy Markdown View Source

Run Ruby workers under Portals.

This package bundles the dependency-free Ruby worker SDK and puts it on the worker's RUBYLIB, so a worker script can simply require 'portals' — no gem is installed.

children = [
  {Portals.Pool,
   Portals.Ruby.worker_opts(
     script: Application.app_dir(:my_app, "priv/ruby/worker.rb"),
     name: MyApp.Ruby,
     size: 4
   )}
]

See the Ruby guide for a full walkthrough.

Summary

Functions

Build Portals.start_worker/1 / Portals.start_pool/1 options for a Ruby worker script.

Functions

worker_opts(opts)

Build Portals.start_worker/1 / Portals.start_pool/1 options for a Ruby worker script.

Options

  • :script (required) — path to the worker entry script, which calls Portals::Worker.new(...).run.
  • :ruby — the interpreter, as a name looked up on PATH or a path. Defaults to "ruby".
  • :ruby_args — interpreter flags placed before the script, e.g. ["-W0"].
  • :args — arguments passed to the script. Portals appends the socket path after these, as the last argument.
  • :env — extra {name, value} environment entries; these win over the ones set here.

Every other option is passed through unchanged. The SDK directory is prepended to any RUBYLIB already set in the BEAM's environment.