Class: Cluster::Configure
- Inherits:
-
Object
- Object
- Cluster::Configure
- Includes:
- ExecBase
- Defined in:
- lib/mongrel_cluster/init.rb
Constant Summary
Constants included from ExecBase
ExecBase::STATUS_ERROR, ExecBase::STATUS_OK
Instance Method Summary collapse
Methods included from ExecBase
#chdir_cwd, #check_process, #cmd_flags, #cmd_name, #find_pid, #log, #log_error, #log_verbose, #pid_file_exists?, #port_log_file, #port_pid_file, #process_log_file, #process_pid_file, #read_options, #read_pid, #start, #status, #stop
Instance Method Details
#configure ⇒ Object
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/mongrel_cluster/init.rb', line 284 def configure [ ["-e", "--environment ENV", "Rails environment to run as", :@environment, nil], ['-p', '--port PORT', "Starting port to bind to", :@port, 3000], ['-a', '--address ADDR', "Address to bind to", :@address, nil], ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"], ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "tmp/pids/mongrel.pid"], ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, nil], ['-o', '--timeout TIME', "Time to wait (in seconds) before killing a stalled thread", :@timeout, nil], ['-t', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients", :@throttle, nil], ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil], ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, nil], ['-n', '--num-procs INT', "Number of processor threads to use", :@num_procs, nil], ['-B', '--debug', "Enable debugging mode", :@debug, nil], ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil], ['-N', '--num-servers INT', "Number of Mongrel servers", :@servers, 2], ['-C', '--config PATH', "Path to cluster configuration file", :@config_file, "config/mongrel_cluster.yml"], ['', '--user USER', "User to run as", :@user, nil], ['', '--group GROUP', "Group to run as", :@group, nil], ['', '--prefix PREFIX', "Rails prefix to use", :@prefix, nil] ] end |
#run ⇒ Object
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/mongrel_cluster/init.rb', line 316 def run @options = { "port" => @port, "servers" => @servers, "pid_file" => @pid_file } @options["log_file"] = @log_file if @log_file @options["debug"] = @debug if @debug @options["num_procs"] = @num_procs if @num_procs @options["docroot"] = @docroot if @docroot @options["address"] = @address if @address @options["timeout"] = @timeout if @timeout @options["throttle"] = @throttle if @throttle @options["environment"] = @environment if @environment @options["mime_map"] = @mime_map if @mime_map @options["config_script"] = @config_script if @config_script @options["cwd"] = @cwd if @cwd @options["user"] = @user if @user @options["group"] = @group if @group @options["prefix"] = @prefix if @prefix log "Writing configuration file to #{@config_file}." File.open(@config_file,"w") {|f| f.write(@options.to_yaml)} end |
#validate ⇒ Object
307 308 309 310 311 312 313 314 |
# File 'lib/mongrel_cluster/init.rb', line 307 def validate @servers = @servers.to_i valid?(@servers > 0, "Must give a valid number of servers") valid_dir? File.dirname(@config_file), "Path to config file not valid: #{@config_file}" @valid end |