|
|
8d15f25 |
diff -Npru passenger-orig/ext/apache2/Configuration.cpp passenger-wc/ext/apache2/Configuration.cpp
|
|
|
8d15f25 |
--- passenger-orig/ext/apache2/Configuration.cpp 2012-03-05 17:33:31.162658085 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/apache2/Configuration.cpp 2012-03-05 17:38:37.164628243 -0800
|
|
|
8d15f25 |
@@ -272,6 +272,7 @@ passenger_config_merge_dir(apr_pool_t *p
|
|
|
8d15f25 |
|
|
|
8d15f25 |
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_root, root)
|
|
|
8d15f25 |
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_ruby, ruby)
|
|
|
8d15f25 |
+DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_spawn_ipaddress, spawnIPAddress)
|
|
|
8d15f25 |
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_log_level, logLevel, unsigned int, 0)
|
|
|
8d15f25 |
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_debug_log_file, debugLogFile)
|
|
|
8d15f25 |
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_max_pool_size, maxPoolSize, unsigned int, 1)
|
|
|
8d15f25 |
@@ -474,6 +475,11 @@ const command_rec passenger_commands[] =
|
|
|
8d15f25 |
NULL,
|
|
|
8d15f25 |
RSRC_CONF,
|
|
|
8d15f25 |
"The Ruby interpreter to use."),
|
|
|
8d15f25 |
+ AP_INIT_TAKE1("PassengerSpawnIPAddress",
|
|
|
8d15f25 |
+ (Take1Func) cmd_passenger_spawn_ipaddress,
|
|
|
8d15f25 |
+ NULL,
|
|
|
8d15f25 |
+ RSRC_CONF,
|
|
|
8d15f25 |
+ "The IP address to bind to."),
|
|
|
8d15f25 |
AP_INIT_TAKE1("PassengerLogLevel",
|
|
|
8d15f25 |
(Take1Func) cmd_passenger_log_level,
|
|
|
8d15f25 |
NULL,
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/apache2/Configuration.hpp passenger-wc/ext/apache2/Configuration.hpp
|
|
|
8d15f25 |
--- passenger-orig/ext/apache2/Configuration.hpp 2012-03-05 17:33:31.162658085 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/apache2/Configuration.hpp 2012-03-05 17:38:37.165628242 -0800
|
|
|
8d15f25 |
@@ -367,6 +367,9 @@ struct DirConfig {
|
|
|
8d15f25 |
struct ServerConfig {
|
|
|
8d15f25 |
/** The filename of the Ruby interpreter to use. */
|
|
|
8d15f25 |
const char *ruby;
|
|
|
8d15f25 |
+
|
|
|
8d15f25 |
+ /** The IP Address to bind to. */
|
|
|
8d15f25 |
+ const char *spawnIPAddress;
|
|
|
8d15f25 |
|
|
|
8d15f25 |
/** The Passenger root folder. */
|
|
|
8d15f25 |
const char *root;
|
|
|
8d15f25 |
@@ -416,6 +419,7 @@ struct ServerConfig {
|
|
|
8d15f25 |
|
|
|
8d15f25 |
ServerConfig() {
|
|
|
8d15f25 |
ruby = "ruby";
|
|
|
8d15f25 |
+ spawnIPAddress = "127.0.0.1";
|
|
|
8d15f25 |
root = NULL;
|
|
|
8d15f25 |
logLevel = DEFAULT_LOG_LEVEL;
|
|
|
8d15f25 |
debugLogFile = NULL;
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/apache2/HelperAgent.cpp passenger-wc/ext/apache2/HelperAgent.cpp
|
|
|
8d15f25 |
--- passenger-orig/ext/apache2/HelperAgent.cpp 2012-03-05 17:33:31.162658085 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/apache2/HelperAgent.cpp 2012-03-05 17:38:37.165628242 -0800
|
|
|
8d15f25 |
@@ -245,7 +245,8 @@ public:
|
|
|
8d15f25 |
accountsDatabase, rubyCommand,
|
|
|
8d15f25 |
analyticsLogger,
|
|
|
8d15f25 |
options.getInt("log_level"),
|
|
|
8d15f25 |
- options.get("debug_log_file", false)
|
|
|
8d15f25 |
+ options.get("debug_log_file", false),
|
|
|
8d15f25 |
+ options.get("spawn_ipaddress")
|
|
|
8d15f25 |
));
|
|
|
8d15f25 |
pool->setMax(maxPoolSize);
|
|
|
8d15f25 |
pool->setMaxPerApp(maxInstancesPerApp);
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/apache2/Hooks.cpp passenger-wc/ext/apache2/Hooks.cpp
|
|
|
8d15f25 |
--- passenger-orig/ext/apache2/Hooks.cpp 2012-03-05 17:33:31.162658085 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/apache2/Hooks.cpp 2012-03-05 17:48:25.902486295 -0800
|
|
|
8d15f25 |
@@ -1401,7 +1401,8 @@ public:
|
|
|
8d15f25 |
serverConfig.unionStationGatewayCert,
|
|
|
8d15f25 |
serverConfig.unionStationProxyAddress,
|
|
|
8d15f25 |
serverConfig.unionStationProxyType,
|
|
|
8d15f25 |
- serverConfig.prestartURLs);
|
|
|
8d15f25 |
+ serverConfig.prestartURLs,
|
|
|
8d15f25 |
+ serverConfig.spawnIPAddress);
|
|
|
8d15f25 |
|
|
|
8d15f25 |
analyticsLogger = ptr(new AnalyticsLogger(agentsStarter.getLoggingSocketAddress(),
|
|
|
8d15f25 |
"logging", agentsStarter.getLoggingSocketPassword()));
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/AgentsStarter.cpp passenger-wc/ext/common/AgentsStarter.cpp
|
|
|
8d15f25 |
--- passenger-orig/ext/common/AgentsStarter.cpp 2012-03-05 17:33:31.192658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/AgentsStarter.cpp 2012-03-05 17:38:37.168628242 -0800
|
|
|
8d15f25 |
@@ -64,6 +64,7 @@ agents_starter_start(AgentsStarter *as,
|
|
|
8d15f25 |
const char *unionStationProxyAddress,
|
|
|
8d15f25 |
const char *unionStationProxyType,
|
|
|
8d15f25 |
const char **prestartURLs, unsigned int prestartURLsCount,
|
|
|
8d15f25 |
+ const char *spawnIPAddress,
|
|
|
8d15f25 |
const AfterForkCallback afterFork,
|
|
|
8d15f25 |
void *callbackArgument,
|
|
|
8d15f25 |
char **errorMessage)
|
|
|
8d15f25 |
@@ -96,6 +97,7 @@ agents_starter_start(AgentsStarter *as,
|
|
|
8d15f25 |
unionStationProxyAddress,
|
|
|
8d15f25 |
unionStationProxyType,
|
|
|
8d15f25 |
setOfprestartURLs,
|
|
|
8d15f25 |
+ spawnIPAddress,
|
|
|
8d15f25 |
afterForkFunctionObject);
|
|
|
8d15f25 |
return 1;
|
|
|
8d15f25 |
} catch (const Passenger::SystemException &e) {
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/AgentsStarter.h passenger-wc/ext/common/AgentsStarter.h
|
|
|
8d15f25 |
--- passenger-orig/ext/common/AgentsStarter.h 2012-03-05 17:33:31.189658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/AgentsStarter.h 2012-03-05 17:38:37.168628242 -0800
|
|
|
8d15f25 |
@@ -64,6 +64,7 @@ int agents_starter_start(AgentsStarter
|
|
|
8d15f25 |
const char *unionStationProxyAddress,
|
|
|
8d15f25 |
const char *unionStationProxyType,
|
|
|
8d15f25 |
const char **prestartURLs, unsigned int prestartURLsCount,
|
|
|
8d15f25 |
+ const char *spawnIPAddress,
|
|
|
8d15f25 |
const AfterForkCallback afterFork,
|
|
|
8d15f25 |
void *callbackArgument,
|
|
|
8d15f25 |
char **errorMessage);
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/AgentsStarter.hpp passenger-wc/ext/common/AgentsStarter.hpp
|
|
|
8d15f25 |
--- passenger-orig/ext/common/AgentsStarter.hpp 2012-03-05 17:33:31.190658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/AgentsStarter.hpp 2012-03-05 17:38:37.169628242 -0800
|
|
|
8d15f25 |
@@ -387,6 +387,7 @@ public:
|
|
|
8d15f25 |
const string &unionStationProxyAddress,
|
|
|
8d15f25 |
const string &unionStationProxyType,
|
|
|
8d15f25 |
const set<string> &prestartURLs,
|
|
|
8d15f25 |
+ const string &spawnIPAddress,
|
|
|
8d15f25 |
const function<void ()> &afterFork = function<void ()>())
|
|
|
8d15f25 |
{
|
|
|
8d15f25 |
TRACE_POINT();
|
|
|
8d15f25 |
@@ -416,6 +417,7 @@ public:
|
|
|
8d15f25 |
.setGid ("web_server_worker_gid", webServerWorkerGid)
|
|
|
8d15f25 |
.set ("passenger_root", passengerRoot)
|
|
|
8d15f25 |
.set ("ruby", rubyCommand)
|
|
|
8d15f25 |
+ .set ("spawn_ipaddress", spawnIPAddress)
|
|
|
8d15f25 |
.setInt ("max_pool_size", maxPoolSize)
|
|
|
8d15f25 |
.setInt ("max_instances_per_app", maxInstancesPerApp)
|
|
|
8d15f25 |
.setInt ("pool_idle_time", poolIdleTime)
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/ApplicationPool/Pool.h passenger-wc/ext/common/ApplicationPool/Pool.h
|
|
|
8d15f25 |
--- passenger-orig/ext/common/ApplicationPool/Pool.h 2012-03-05 17:33:31.189658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/ApplicationPool/Pool.h 2012-03-05 17:38:37.169628242 -0800
|
|
|
8d15f25 |
@@ -1062,7 +1062,8 @@ public:
|
|
|
8d15f25 |
const string &rubyCommand = "ruby",
|
|
|
8d15f25 |
const AnalyticsLoggerPtr &analyticsLogger = AnalyticsLoggerPtr(),
|
|
|
8d15f25 |
int logLevel = 0,
|
|
|
8d15f25 |
- const string &debugLogFile = ""
|
|
|
8d15f25 |
+ const string &debugLogFile = "",
|
|
|
8d15f25 |
+ const string &spawnIPAddress = "127.0.0.1"
|
|
|
8d15f25 |
) : data(new SharedData()),
|
|
|
8d15f25 |
cstat(DEFAULT_MAX_POOL_SIZE),
|
|
|
8d15f25 |
lock(data->lock),
|
|
|
8d15f25 |
@@ -1079,7 +1080,7 @@ public:
|
|
|
8d15f25 |
|
|
|
8d15f25 |
this->spawnManager = ptr(new SpawnManager(spawnServerCommand, generation,
|
|
|
8d15f25 |
accountsDatabase, rubyCommand, analyticsLogger, logLevel,
|
|
|
8d15f25 |
- debugLogFile));
|
|
|
8d15f25 |
+ debugLogFile, spawnIPAddress));
|
|
|
8d15f25 |
initialize(analyticsLogger);
|
|
|
8d15f25 |
}
|
|
|
8d15f25 |
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/SpawnManager.h passenger-wc/ext/common/SpawnManager.h
|
|
|
8d15f25 |
--- passenger-orig/ext/common/SpawnManager.h 2012-03-05 17:33:31.189658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/SpawnManager.h 2012-03-05 17:38:37.170628241 -0800
|
|
|
8d15f25 |
@@ -107,6 +107,7 @@ private:
|
|
|
8d15f25 |
ServerInstanceDir::GenerationPtr generation;
|
|
|
8d15f25 |
AccountsDatabasePtr accountsDatabase;
|
|
|
8d15f25 |
string rubyCommand;
|
|
|
8d15f25 |
+ string spawnIPAddress;
|
|
|
8d15f25 |
AnalyticsLoggerPtr analyticsLogger;
|
|
|
8d15f25 |
int logLevel;
|
|
|
8d15f25 |
string debugLogFile;
|
|
|
8d15f25 |
@@ -267,6 +268,7 @@ private:
|
|
|
8d15f25 |
}
|
|
|
8d15f25 |
writeExact(ownerSocket, toString(logLevel) + "\n");
|
|
|
8d15f25 |
writeExact(ownerSocket, debugLogFile + "\n");
|
|
|
8d15f25 |
+ writeExact(ownerSocket, spawnIPAddress + "\n");
|
|
|
8d15f25 |
|
|
|
8d15f25 |
this->ownerSocket = ownerSocket;
|
|
|
8d15f25 |
this->socketFilename = socketFilename;
|
|
|
8d15f25 |
@@ -547,13 +549,15 @@ public:
|
|
|
8d15f25 |
const string &rubyCommand = "ruby",
|
|
|
8d15f25 |
const AnalyticsLoggerPtr &analyticsLogger = AnalyticsLoggerPtr(),
|
|
|
8d15f25 |
int logLevel = 0,
|
|
|
8d15f25 |
- const string &debugLogFile = ""
|
|
|
8d15f25 |
+ const string &debugLogFile = "",
|
|
|
8d15f25 |
+ const string &spawnIPAddress = "127.0.0.1"
|
|
|
8d15f25 |
) {
|
|
|
8d15f25 |
TRACE_POINT();
|
|
|
8d15f25 |
this->spawnServerCommand = spawnServerCommand;
|
|
|
8d15f25 |
this->generation = generation;
|
|
|
8d15f25 |
this->accountsDatabase = accountsDatabase;
|
|
|
8d15f25 |
this->rubyCommand = rubyCommand;
|
|
|
8d15f25 |
+ this->spawnIPAddress = spawnIPAddress;
|
|
|
8d15f25 |
this->analyticsLogger = analyticsLogger;
|
|
|
8d15f25 |
this->logLevel = logLevel;
|
|
|
8d15f25 |
this->debugLogFile = debugLogFile;
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/common/Watchdog.cpp passenger-wc/ext/common/Watchdog.cpp
|
|
|
8d15f25 |
--- passenger-orig/ext/common/Watchdog.cpp 2012-03-05 17:33:31.189658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/common/Watchdog.cpp 2012-03-05 17:38:37.170628241 -0800
|
|
|
8d15f25 |
@@ -75,6 +75,7 @@ static uid_t webServerWorkerUid;
|
|
|
8d15f25 |
static gid_t webServerWorkerGid;
|
|
|
8d15f25 |
static string passengerRoot;
|
|
|
8d15f25 |
static string rubyCommand;
|
|
|
8d15f25 |
+static string spawnIPAddress;
|
|
|
8d15f25 |
static unsigned int maxPoolSize;
|
|
|
8d15f25 |
static unsigned int maxInstancesPerApp;
|
|
|
8d15f25 |
static unsigned int poolIdleTime;
|
|
|
8d15f25 |
@@ -592,7 +593,8 @@ protected:
|
|
|
8d15f25 |
options.set("request_socket_password", Base64::encode(requestSocketPassword)).
|
|
|
8d15f25 |
set("message_socket_password", Base64::encode(messageSocketPassword)).
|
|
|
8d15f25 |
set("logging_agent_address", loggingAgentAddress).
|
|
|
8d15f25 |
- set("logging_agent_password", loggingAgentPassword);
|
|
|
8d15f25 |
+ set("logging_agent_password", loggingAgentPassword).
|
|
|
8d15f25 |
+ set("spawn_ipaddress", spawnIPAddress);
|
|
|
8d15f25 |
options.writeToFd(fd);
|
|
|
8d15f25 |
}
|
|
|
8d15f25 |
|
|
|
8d15f25 |
@@ -978,6 +980,7 @@ main(int argc, char *argv[]) {
|
|
|
8d15f25 |
webServerWorkerGid = agentsOptions.getGid("web_server_worker_gid");
|
|
|
8d15f25 |
passengerRoot = agentsOptions.get("passenger_root");
|
|
|
8d15f25 |
rubyCommand = agentsOptions.get("ruby");
|
|
|
8d15f25 |
+ spawnIPAddress = agentsOptions.get("spawn_ipaddress");
|
|
|
8d15f25 |
maxPoolSize = agentsOptions.getInt("max_pool_size");
|
|
|
8d15f25 |
maxInstancesPerApp = agentsOptions.getInt("max_instances_per_app");
|
|
|
8d15f25 |
poolIdleTime = agentsOptions.getInt("pool_idle_time");
|
|
|
8d15f25 |
diff -Npru passenger-orig/ext/nginx/ngx_http_passenger_module.c passenger-wc/ext/nginx/ngx_http_passenger_module.c
|
|
|
8d15f25 |
--- passenger-orig/ext/nginx/ngx_http_passenger_module.c 2012-03-05 17:33:31.188658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/ext/nginx/ngx_http_passenger_module.c 2012-03-05 17:38:37.171628240 -0800
|
|
|
8d15f25 |
@@ -291,6 +291,7 @@ start_helper_server(ngx_cycle_t *cycle)
|
|
|
8d15f25 |
union_station_proxy_address,
|
|
|
8d15f25 |
union_station_proxy_type,
|
|
|
8d15f25 |
(const char **) prestart_uris_ary, passenger_main_conf.prestart_uris->nelts,
|
|
|
8d15f25 |
+ "127.0.0.1",
|
|
|
8d15f25 |
starting_helper_server_after_fork,
|
|
|
8d15f25 |
cycle,
|
|
|
8d15f25 |
&error_message);
|
|
|
8d15f25 |
diff -Npru passenger-orig/helper-scripts/passenger-spawn-server passenger-wc/helper-scripts/passenger-spawn-server
|
|
|
8d15f25 |
--- passenger-orig/helper-scripts/passenger-spawn-server 2012-03-05 17:33:31.193658083 -0800
|
|
|
8d15f25 |
+++ passenger-wc/helper-scripts/passenger-spawn-server 2012-03-05 17:38:37.171628240 -0800
|
|
|
8d15f25 |
@@ -47,6 +47,7 @@ begin
|
|
|
8d15f25 |
node_name = owner_socket.readline.strip
|
|
|
8d15f25 |
log_level = owner_socket.readline.to_i
|
|
|
8d15f25 |
debug_log_file = owner_socket.readline.strip
|
|
|
8d15f25 |
+ spawn_ipaddress = owner_socket.readline.strip
|
|
|
8d15f25 |
rescue EOFError
|
|
|
8d15f25 |
exit
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
@@ -93,6 +94,8 @@ begin
|
|
|
8d15f25 |
"node_name" => node_name
|
|
|
8d15f25 |
}
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
+
|
|
|
8d15f25 |
+ options["spawn_ipaddress"] = spawn_ipaddress
|
|
|
8d15f25 |
|
|
|
8d15f25 |
require 'phusion_passenger/spawn_manager'
|
|
|
8d15f25 |
spawn_manager = PhusionPassenger::SpawnManager.new(options)
|
|
|
8d15f25 |
diff -Npru passenger-orig/lib/phusion_passenger/abstract_request_handler.rb passenger-wc/lib/phusion_passenger/abstract_request_handler.rb
|
|
|
8d15f25 |
--- passenger-orig/lib/phusion_passenger/abstract_request_handler.rb 2012-03-05 17:33:31.159658087 -0800
|
|
|
8d15f25 |
+++ passenger-wc/lib/phusion_passenger/abstract_request_handler.rb 2012-03-05 17:38:37.172628240 -0800
|
|
|
8d15f25 |
@@ -174,11 +174,11 @@ class AbstractRequestHandler
|
|
|
8d15f25 |
@main_socket_address, @main_socket = create_unix_socket_on_filesystem
|
|
|
8d15f25 |
@server_sockets[:main] = [@main_socket_address, 'unix', @main_socket]
|
|
|
8d15f25 |
else
|
|
|
8d15f25 |
- @main_socket_address, @main_socket = create_tcp_socket
|
|
|
8d15f25 |
+ @main_socket_address, @main_socket = create_tcp_socket(options["spawn_ipaddress"])
|
|
|
8d15f25 |
@server_sockets[:main] = [@main_socket_address, 'tcp', @main_socket]
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
|
|
|
8d15f25 |
- @http_socket_address, @http_socket = create_tcp_socket
|
|
|
8d15f25 |
+ @http_socket_address, @http_socket = create_tcp_socket(options["spawn_ipaddress"])
|
|
|
8d15f25 |
@server_sockets[:http] = [@http_socket_address, 'tcp', @http_socket]
|
|
|
8d15f25 |
|
|
|
8d15f25 |
@owner_pipe = owner_pipe
|
|
|
8d15f25 |
@@ -397,13 +397,14 @@ private
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
|
|
|
8d15f25 |
- def create_tcp_socket
|
|
|
8d15f25 |
+ def create_tcp_socket(spawn_ipaddr = nil)
|
|
|
8d15f25 |
# We use "127.0.0.1" as address in order to force
|
|
|
8d15f25 |
# TCPv4 instead of TCPv6.
|
|
|
8d15f25 |
- socket = TCPServer.new('127.0.0.1', 0)
|
|
|
8d15f25 |
+ spawn_ipaddr ||= '127.0.0.1'
|
|
|
8d15f25 |
+ socket = TCPServer.new(spawn_ipaddr, 0)
|
|
|
8d15f25 |
socket.listen(BACKLOG_SIZE)
|
|
|
8d15f25 |
socket.close_on_exec!
|
|
|
8d15f25 |
- socket_address = "127.0.0.1:#{socket.addr[1]}"
|
|
|
8d15f25 |
+ socket_address = "#{spawn_ipaddr}:#{socket.addr[1]}"
|
|
|
8d15f25 |
return [socket_address, socket]
|
|
|
8d15f25 |
end
|
|
|
8d15f25 |
|