Module: Async::Service::Managed::Environment
- 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, andhealth_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.
-
#startup_timeout ⇒ Object
The timeout duration for the startup.
-
#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.
37 38 39 40 41 42 43 44 |
# File 'lib/async/service/managed/environment.rb', line 37 def { restart: true, count: self.count, startup_timeout: self.startup_timeout, health_check_timeout: self.health_check_timeout, }.compact end |
#count ⇒ Object
Number of instances to start. By default, when nil, uses Etc.nprocessors.
16 17 18 |
# File 'lib/async/service/managed/environment.rb', line 16 def count nil end |
#health_check_timeout ⇒ Object
The timeout duration for the health check. Set to nil to disable the health check.
30 31 32 |
# File 'lib/async/service/managed/environment.rb', line 30 def health_check_timeout 30 end |
#preload ⇒ Object
Any scripts to preload before starting the service.
49 50 51 |
# File 'lib/async/service/managed/environment.rb', line 49 def preload [] end |
#prepare!(instance) ⇒ Object
Prepare the instance for running the service.
This is called before Service#run.
65 66 67 |
# File 'lib/async/service/managed/environment.rb', line 65 def prepare!(instance) # No preparation required by default. end |
#startup_timeout ⇒ Object
The timeout duration for the startup. Set to nil to disable the startup timeout.
23 24 25 |
# File 'lib/async/service/managed/environment.rb', line 23 def startup_timeout nil end |
#tags ⇒ Object
General tags for metrics, traces and logging.
56 57 58 |
# File 'lib/async/service/managed/environment.rb', line 56 def [] end |