class Explorer::Servers

Public Class Methods

new(options={}) click to toggle source
# File lib/explorer/servers.rb, line 5
def initialize options={}
  @dns_port = options.fetch(:dns_port) { 23400 }
  @http_port = options.fetch(:http_port) { 23401 }
  @https_port = options.fetch(:https_port) { 23402 }
  @ipc_file = options.fetch(:ipc_file) { '/tmp/explorer_ipc' }
end

Public Instance Methods

load() click to toggle source
# 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() click to toggle source
# 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!() click to toggle source
# 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
terminate() click to toggle source

Do I need this?

# File lib/explorer/servers.rb, line 35
def terminate
  @group.terminate if @group
  Explorer.terminate
end