Class: Falcon::Command::Host

Inherits:
Samovar::Command
  • Object
show all
Includes:
Paths
Defined in:
lib/falcon/command/host.rb

Overview

Implements the falcon host command. Designed for deployment.

Manages a Controller::Host instance which is responsible for running applications in a production environment.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#configuration, #resolved_paths

Instance Attribute Details

#pathsObject (readonly)

One or more paths to the configuration files.



35
# File 'lib/falcon/command/host.rb', line 35

many :paths, "Service configuration paths.", default: ["falcon.rb"]

Class Method Details

.callObject

The main entry point for the falcon-host executable.



23
24
25
26
27
28
29
30
# File 'lib/falcon/command/host.rb', line 23

def self.call(...)
	super
rescue Interrupt
	# Ignore.
rescue => error
	Console.error(self, error)
	exit! 1
end

Instance Method Details

#callObject

Prepare the environment and run the controller.



45
46
47
48
49
50
51
52
53
54
# File 'lib/falcon/command/host.rb', line 45

def call
	Console.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
	
	Async::Service::Controller.run(self.configuration, container_class: self.container_class)
end

#container_classObject

The container class to use.



40
41
42
# File 'lib/falcon/command/host.rb', line 40

def container_class
	Async::Container.best_container_class
end