module Environment
An environment mixin for supervisor services.
Provides configuration and setup for supervisor processes that monitor workers.
Definitions
def service_class
The service class to use for the supervisor.
Signature
-
returns
Class
Implementation
def service_class
Supervisor::Service
end
def name
The name of the supervisor
Signature
-
returns
String
Implementation
def name
"supervisor"
end
def ipc_path
The IPC path to use for communication with the supervisor.
Signature
-
returns
String
Implementation
def ipc_path
::File.expand_path("supervisor.ipc", root)
end
def endpoint
The endpoint the supervisor will bind to.
Signature
-
returns
::IO::Endpoint::Generic
Implementation
def endpoint
::IO::Endpoint.unix(ipc_path)
end
def container_options
Options to use when creating the container.
Implementation
def container_options
{restart: true, count: 1, health_check_timeout: 30}
end
def monitors
Get the list of monitors to run in the supervisor.
Override this method to provide custom monitors.
Signature
-
returns
Array The list of monitor instances.
Implementation
def monitors
[]
end
def make_server(endpoint)
Create the supervisor server instance.
Signature
-
returns
Server The supervisor server.
Implementation
def make_server(endpoint)
Server.new(endpoint: endpoint, monitors: self.monitors)
end