Run a Plug on Roadrunner.
Add it to a supervision tree with the plug to serve:
children = [
{Roadrunner.Plug, plug: MyApp.Router, port: 4000}
]Options:
:plug- the plug to run, asModuleor{Module, opts}. Itsinit/1runs once, when the listener starts.:port- the TCP port to listen on (default4000for:httpand4040for:https, as Phoenix's other adapters;0lets the system pick one, seeport/1). A string such as"4000"is accepted.:ip- the local address to bind (default: all interfaces).:scheme-:http(default) or:https.:name- the listener's registered name (default derived from the plug module).:roadrunner- any other:roadrunner_listeneroption, as a map (protocols,ws,max_clients, ...). Request bodies are read on demand (body_buffering: :manual) with no listener-wide size cap, soPlug.Parsers(or the plug reading the body) sets their limits; setmax_content_lengthhere to cap every request anyway.
With scheme: :https, the TLS options are either :tls (:ssl server
options as given) or Plug's (:keyfile, :certfile, :key, :cert,
:cacertfile, :password, :cipher_suite, :otp_app, ...), resolved by
Plug.SSL.configure/1 the way Phoenix's :https endpoint config expects.
Summary
Functions
A child spec that starts the listener under a supervisor.
The port the listener named name bound.
Start the listener, linked to the caller.
Functions
@spec child_spec(keyword()) :: Supervisor.child_spec()
A child spec that starts the listener under a supervisor.
@spec port(atom()) :: :inet.port_number()
The port the listener named name bound.
Start the listener, linked to the caller.