Class: Falcon::Command::Host
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Falcon::Command::Host
- Defined in:
- lib/falcon/command/host.rb
Overview
Implements the ‘falcon host` command. Designed for deployment.
Manages a Falcon::Controller::Host instance which is responsible for running applications in a production environment.
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
One or more paths to the configuration files.
Instance Method Summary collapse
-
#call ⇒ Object
Prepare the environment and run the controller.
-
#configuration ⇒ Object
Generate a configuration based on the specified #paths.
-
#container_class ⇒ Object
The container class to use.
-
#controller ⇒ Object
Prepare a new controller for the command.
Instance Attribute Details
#paths ⇒ Object (readonly)
One or more paths to the configuration files.
41 |
# File 'lib/falcon/command/host.rb', line 41 many :paths, "Service configuration paths.", default: ["falcon.rb"] |
Instance Method Details
#call ⇒ Object
Prepare the environment and run the controller.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/falcon/command/host.rb', line 66 def call Console.logger.info(self) do |buffer| buffer.puts "Falcon Host v#{VERSION} taking flight!" buffer.puts "- Configuration: #{@paths.join(', ')}" buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}" buffer.puts "- To reload: kill -HUP #{Process.pid}" end begin Bundler.require(:preload) rescue Bundler::GemfileNotFound # Ignore. end if GC.respond_to?(:compact) GC.compact end self.controller.run end |
#configuration ⇒ Object
Generate a configuration based on the specified #paths.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/falcon/command/host.rb', line 49 def configuration configuration = Configuration.new @paths.each do |path| path = File.(path) configuration.load_file(path) end return configuration end |
#container_class ⇒ Object
The container class to use.
44 45 46 |
# File 'lib/falcon/command/host.rb', line 44 def container_class Async::Container.best_container_class end |
#controller ⇒ Object
Prepare a new controller for the command.
61 62 63 |
# File 'lib/falcon/command/host.rb', line 61 def controller Controller::Host.new(self) end |