aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/commands/process/spawner.rb18
2 files changed, 16 insertions, 4 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index b8b23352d1..3491c0c336 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed script/process/spawner to work properly with Mongrel including in -r (daemonize mode) [DHH]
+
* Added one-letter aliases for the three default environments to script/console, so script/console p will load the production environment (t for test, d for development) [DHH]
* Fixed that script/server running against Mongrel should tail the proper log regardless of the environment [DHH]
diff --git a/railties/lib/commands/process/spawner.rb b/railties/lib/commands/process/spawner.rb
index 43d652b4e5..c8ca1d04a2 100644
--- a/railties/lib/commands/process/spawner.rb
+++ b/railties/lib/commands/process/spawner.rb
@@ -56,11 +56,18 @@ end
class MongrelSpawner < Spawner
def self.spawn(port)
- cmd = "mongrel_rails start -d -p #{port} -P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid -e #{OPTIONS[:environment]}"
- cmd << "-a #{OPTIONS[:address]}" if can_bind_to_custom_address?
+ cmd =
+ "mongrel_rails start -d " +
+ "-a #{OPTIONS[:address]} " +
+ "-p #{port} " +
+ "-P #{OPTIONS[:pids]}/#{OPTIONS[:process]}.#{port}.pid " +
+ "-e #{OPTIONS[:environment]} " +
+ "-c #{OPTIONS[:rails_root]} " +
+ "-l #{OPTIONS[:rails_root]}/log/mongrel.log"
+
system(cmd)
end
-
+
def self.can_bind_to_custom_address?
true
end
@@ -109,6 +116,7 @@ OPTIONS = {
:spawner => '/usr/bin/env spawn-fcgi',
:dispatcher => File.expand_path(RAILS_ROOT + '/public/dispatch.fcgi'),
:pids => File.expand_path(RAILS_ROOT + "/tmp/pids"),
+ :rails_root => File.expand_path(RAILS_ROOT),
:process => "dispatch",
:port => 8000,
:address => '0.0.0.0',
@@ -165,9 +173,11 @@ ARGV.options do |opts|
opts.on(" Options:")
opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |OPTIONS[:port]| }
+
if spawner_class.can_bind_to_custom_address?
opts.on("-a", "--address=ip", String, "Bind to IP address (default: #{OPTIONS[:address]})") { |OPTIONS[:address]| }
end
+
opts.on("-p", "--port=number", Integer, "Starting port number (default: #{OPTIONS[:port]})") { |v| OPTIONS[:port] = v }
opts.on("-i", "--instances=number", Integer, "Number of instances (default: #{OPTIONS[:instances]})") { |v| OPTIONS[:instances] = v }
opts.on("-r", "--repeat=seconds", Integer, "Repeat spawn attempts every n seconds (default: off)") { |v| OPTIONS[:repeat] = v }
@@ -196,4 +206,4 @@ if OPTIONS[:repeat]
end
else
spawner_class.spawn_all
-end
+end \ No newline at end of file