Class Beetle::Commands::ConfigurationServer
In: lib/beetle/commands/configuration_server.rb
Parent: Object

Command to start a RedisConfigurationServer daemon.

  Usage: beetle configuration_server  [options] -- [server options]

  server options:
          --redis-servers LIST         Required for start command (e.g. 192.168.0.1:6379,192.168.0.2:6379)
          --client-ids LIST            Clients that have to acknowledge on master switch (e.g. client-id1,client-id2)
          --redis-master-file FILE     Write redis master server string to FILE
          --redis-retry-interval SEC   Number of seconds to wait between master checks
          --amqp-servers LIST          AMQP server list (e.g. 192.168.0.1:5672,192.168.0.2:5672)
          --config-file PATH           Path to an external yaml config file
          --pid-dir DIR                Write pid and log to DIR
      -v, --verbose
      -h, --help                       Show this message

Methods

execute  

Public Class methods

parses command line options and starts Beetle::RedisConfigurationServer as a daemon

[Source]

    # File lib/beetle/commands/configuration_server.rb, line 24
24:       def self.execute
25:         command, controller_options, app_options = Daemons::Controller.split_argv(ARGV)
26: 
27:         opts = OptionParser.new
28:         opts.banner = "Usage: beetle configuration_server #{command} [options] -- [server options]"
29:         opts.separator ""
30:         opts.separator "server options:"
31: 
32:         opts.on("--redis-servers LIST", Array, "Required for start command (e.g. 192.168.0.1:6379,192.168.0.2:6379)") do |val|
33:           Beetle.config.redis_servers = val.join(",")
34:         end
35: 
36:         opts.on("--client-ids LIST", "Clients that have to acknowledge on master switch (e.g. client-id1,client-id2)") do |val|
37:           Beetle.config.redis_configuration_client_ids = val
38:         end
39: 
40:         opts.on("--redis-master-file FILE", String, "Write redis master server string to FILE") do |val|
41:           Beetle.config.redis_server = val
42:         end
43: 
44:         opts.on("--redis-retry-interval SEC", Integer, "Number of seconds to wait between master checks") do |val|
45:           Beetle.config.redis_configuration_master_retry_interval = val
46:         end
47: 
48:         opts.on("--amqp-servers LIST", String, "AMQP server list (e.g. 192.168.0.1:5672,192.168.0.2:5672)") do |val|
49:           Beetle.config.servers = val
50:         end
51: 
52:         opts.on("--config-file PATH", String, "Path to an external yaml config file") do |val|
53:           Beetle.config.config_file = val
54:         end
55: 
56:         dir_mode = nil
57:         dir = nil
58:         opts.on("--pid-dir DIR", String, "Write pid and log to DIR") do |val|
59:           dir_mode = :normal
60:           dir = val
61:         end
62: 
63:         opts.on("-v", "--verbose") do |val|
64:           Beetle.config.logger.level = Logger::DEBUG
65:         end
66: 
67:         opts.on_tail("-h", "--help", "Show this message") do
68:           puts opts
69:           exit
70:         end
71: 
72:         opts.parse!(app_options)
73: 
74:         if command =~ /start|run/ && Beetle.config.redis_servers.blank?
75:           puts opts
76:           exit
77:         end
78: 
79:         Daemons.run_proc("redis_configuration_server", :log_output => true, :dir_mode => dir_mode, :dir => dir) do
80:           Beetle::RedisConfigurationServer.new.start
81:         end
82:       end

[Validate]