Class: Explorer::Servers
- Inherits:
-
Object
- Object
- Explorer::Servers
- Defined in:
- lib/explorer/servers.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Servers
constructor
A new instance of Servers.
- #load ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
-
#terminate ⇒ Object
Do I need this?.
Constructor Details
#initialize(options = {}) ⇒ Servers
Returns a new instance of Servers.
5 6 7 8 9 10 |
# File 'lib/explorer/servers.rb', line 5 def initialize ={} @dns_port = .fetch(:dns_port) { 23400 } @http_port = .fetch(:http_port) { 23401 } @https_port = .fetch(:https_port) { 23402 } @ipc_file = .fetch(:ipc_file) { '/tmp/explorer_ipc' } end |
Instance Method Details
#load ⇒ Object
29 30 31 32 |
# File 'lib/explorer/servers.rb', line 29 def load Explorer.hostmap.load File.join(Explorer::CONFIGDIR, 'hostmap.yaml') Explorer.process_manager.load File.join(Explorer::CONFIGDIR, 'process.yaml') end |
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/explorer/servers.rb', line 12 def run # Setup trap read, write = IO.pipe trap(:INT) { write.puts } # Start servers run! # Load configuration load IO.select([read]) # Wait for trap # Cleanup terminate end |
#run! ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/explorer/servers.rb', line 40 def run! Celluloid.logger = Explorer.log_watcher.logger @group = Celluloid::SupervisionGroup.new do |group| group.supervise_as :dns, Server::DNS, @dns_port group.supervise_as :http, Server::HTTP, @http_port group.supervise_as :https, Server::HTTPS, @https_port group.supervise_as :ipc, Server::IPC, @ipc_file end end |