Module: Async::Service::ManagedEnvironment
- Defined in:
- lib/async/service/managed_environment.rb
Overview
Default configuration for managed services.
This is provided not because it is required, but to offer a sensible default for production services, and to expose a consistent interface for service configuration.
Instance Method Summary collapse
-
#container_options ⇒ Object
Options to use when creating the container, including ‘restart`, `count`, and `health_check_timeout`.
-
#count ⇒ Object
Number of instances to start.
-
#health_check_timeout ⇒ Object
The timeout duration for the health check.
-
#preload ⇒ Object
Any scripts to preload before starting the service.
-
#prepare!(instance) ⇒ Object
Prepare the instance for running the service.
-
#tags ⇒ Object
General tags for metrics, traces and logging.
Instance Method Details
#container_options ⇒ Object
Options to use when creating the container, including ‘restart`, `count`, and `health_check_timeout`.
29 30 31 32 33 34 35 |
# File 'lib/async/service/managed_environment.rb', line 29 def { restart: true, count: self.count, health_check_timeout: self.health_check_timeout, }.compact end |
#count ⇒ Object
Number of instances to start. By default, when ‘nil`, uses `Etc.nprocessors`.
15 16 17 |
# File 'lib/async/service/managed_environment.rb', line 15 def count nil end |
#health_check_timeout ⇒ Object
The timeout duration for the health check. Set to ‘nil` to disable the health check.
22 23 24 |
# File 'lib/async/service/managed_environment.rb', line 22 def health_check_timeout 30 end |
#preload ⇒ Object
Any scripts to preload before starting the service.
40 41 42 |
# File 'lib/async/service/managed_environment.rb', line 40 def preload [] end |
#prepare!(instance) ⇒ Object
Prepare the instance for running the service.
This is called before Async::Service::ManagedService#run.
56 57 58 |
# File 'lib/async/service/managed_environment.rb', line 56 def prepare!(instance) # No preparation required by default. end |
#tags ⇒ Object
General tags for metrics, traces and logging.
47 48 49 |
# File 'lib/async/service/managed_environment.rb', line 47 def [] end |