diff --git a/falcon.gemspec b/falcon.gemspec index a31d9ca..d49ecb3 100644 --- a/falcon.gemspec +++ b/falcon.gemspec @@ -28,13 +28,13 @@ Gem::Specification.new do |spec| spec.add_dependency "async" spec.add_dependency "async-container", "~> 0.20" + spec.add_dependency "async-container-supervisor", "~> 0.1.0" spec.add_dependency "async-http", "~> 0.75" spec.add_dependency "async-http-cache", "~> 0.4" spec.add_dependency "async-service", "~> 0.10" spec.add_dependency "bundler" spec.add_dependency "localhost", "~> 1.1" spec.add_dependency "openssl", "~> 3.0" - spec.add_dependency "process-metrics", "~> 0.2" spec.add_dependency "protocol-http", "~> 0.31" spec.add_dependency "protocol-rack", "~> 0.7" spec.add_dependency "samovar", "~> 2.3" diff --git a/lib/falcon/environment/supervisor.rb b/lib/falcon/environment/supervisor.rb index c10f3b0..9f5b7a3 100644 --- a/lib/falcon/environment/supervisor.rb +++ b/lib/falcon/environment/supervisor.rb @@ -12,34 +12,19 @@ module Falcon module Environment # Provides an environment for hosting a supervisor which can monitor multiple applications. module Supervisor + include Async::Container::Supervisor::Environment + # The service class to use for the supervisor. # @returns [Class] def service_class ::Falcon::Service::Supervisor end - # The name of the supervisor - # @returns [String] - def name - "supervisor" - end - # The IPC path to use for communication with the supervisor. # @returns [String] def ipc_path ::File.expand_path("supervisor.ipc", root) end - - # The endpoint the supervisor will bind to. - # @returns [::IO::Endpoint::Generic] - def endpoint - ::IO::Endpoint.unix(ipc_path) - end - - # Options to use when creating the container. - def container_options - {restart: true, count: 1, health_check_timeout: 30} - end end LEGACY_ENVIRONMENTS[:supervisor] = Supervisor diff --git a/lib/falcon/service/supervisor.rb b/lib/falcon/service/supervisor.rb index 7c3421a..d60a355 100644 --- a/lib/falcon/service/supervisor.rb +++ b/lib/falcon/service/supervisor.rb @@ -6,7 +6,7 @@ require "process/metrics" require "json" -require "async/service/generic" +require "async/container/supervisor/service" require "io/endpoint/bound_endpoint" require "io/stream" @@ -14,7 +14,7 @@ module Falcon module Service # Implements a host supervisor which can restart the host services and provide various metrics about the running processes. - class Supervisor < Async::Service::Generic + class Supervisor < Async::Container::Supervisor::Service # Initialize the supervisor using the given environment. # @parameter environment [Build::Environment] def initialize(...)