Async::ServiceSourceAsyncServiceContainerEnvironment

module ContainerEnvironment

Default configuration for container-based services.

This is provided not because it is required, but to offer a sensible default for containerized applications, and to expose a consistent interface for service configuration.

Definitions

def count

Number of instances to start. By default, when nil, uses Etc.nprocessors.

Signature

returns Integer | nil

The number of instances to start, or nil to use the default.

Implementation

def count
	nil
end

def health_check_timeout

The timeout duration for the health check. Set to nil to disable the health check.

Signature

returns Numeric | nil

The health check timeout in seconds.

Implementation

def health_check_timeout
	30
end

def container_options

Options to use when creating the container, including restart, count, and health_check_timeout.

Signature

returns Hash

The options for the container.

Implementation

def container_options
	{
		restart: true,
		count: self.count,
		health_check_timeout: self.health_check_timeout,
	}.compact
end

def preload

Any scripts to preload before starting the server.

Signature

returns Array(String)

The list of scripts to preload.

Implementation

def preload
	[]
end