Permalink
Browse files

Make sure that the global passenger_ruby option is used correctly, an…

…d rename the global PassengerRuby option to PassengerDefaultRuby in order to please Apache.
  • Loading branch information...
1 parent d43fdc8 commit 1eb60763e4f750b1f41e9bfdbbdd1207a6165895 @FooBarWidget FooBarWidget committed Mar 26, 2013
View
5 NEWS
@@ -1,6 +1,11 @@
Release 4.0.0 release candidate 5
---------------------------------
+ * The default config snippet for Apache has changed! It must now contain a
+ `PassengerDefaultRuby` option. The installer has been updated to output
+ this option. The `PassengerRuby` option still exists, but it's only used
+ for configuring different Ruby interpreters in different contexts. Please
+ refer to the manual for more information.
* We now provide GPG digital signatures for all file releases by Phusion.
More information can be found in the manual.
* `passenger-status` now displays process memory usage and time when it
@@ -170,7 +170,7 @@ private
if bare
puts "LoadModule passenger_module #{PhusionPassenger.apache2_module_path}"
puts "PassengerRoot #{PhusionPassenger.source_root}"
- puts "PassengerRuby #{PlatformInfo.ruby_command}"
+ puts "PassengerDefaultRuby #{PlatformInfo.ruby_command}"
else
puts
line
@@ -114,111 +114,113 @@
6.1. PassengerRoot <directory> => passengerroot-directory--sere8l
-6.2. PassengerRuby <filename> => passengerruby-filename--1r3fv73
+6.2. PassengerDefaultRuby and PassengerRuby => passengerdefaultruby-and-passengerruby-7zblp8
-6.3. PassengerPython <filename> => passengerpython-filename--1ssesv3
+6.3. PassengerRuby <filename> => passengerruby-filename--1r3fv73
-6.4. PassengerAppRoot <path/to/root> => passengerapproot-path-to-root--uf24yd
+6.4. PassengerPython <filename> => passengerpython-filename--1ssesv3
-6.5. PassengerSpawnMethod <string> => passengerspawnmethod-string--sodg2y
+6.5. PassengerAppRoot <path/to/root> => passengerapproot-path-to-root--uf24yd
-6.6. PassengerEnabled <on|off> => passengerenabled-on-off--74rzth
+6.6. PassengerSpawnMethod <string> => passengerspawnmethod-string--sodg2y
-6.7. PassengerTempDir <directory> => passengertempdir-directory--68h2ng
+6.7. PassengerEnabled <on|off> => passengerenabled-on-off--74rzth
-6.8. PassengerUploadBufferDir <directory> => passengeruploadbufferdir-directory--kdr8at
+6.8. PassengerTempDir <directory> => passengertempdir-directory--68h2ng
-6.9. PassengerRestartDir <directory> => passengerrestartdir-directory--1fmhmv0
+6.9. PassengerUploadBufferDir <directory> => passengeruploadbufferdir-directory--kdr8at
-6.10. PassengerBufferResponse <on|off> => passengerbufferresponse-on-off--1y7ilka
+6.10. PassengerRestartDir <directory> => passengerrestartdir-directory--1fmhmv0
-6.11. PassengerRollingRestarts <on|off> => passengerrollingrestarts
+6.11. PassengerBufferResponse <on|off> => passengerbufferresponse-on-off--1y7ilka
-6.12. PassengerResistDeploymentErrors <on|off> => passengerresistdeploymenterrors
+6.12. PassengerRollingRestarts <on|off> => passengerrollingrestarts
-6.13. Security options => security-options-1pb75ho
+6.13. PassengerResistDeploymentErrors <on|off> => passengerresistdeploymenterrors
-6.13.1. PassengerUserSwitching <on|off> => passengeruserswitching
+6.14. Security options => security-options-1pb75ho
-6.13.2. PassengerUser <username> => passengeruser
+6.14.1. PassengerUserSwitching <on|off> => passengeruserswitching
-6.13.3. PassengerGroup <group name> => passengergroup
+6.14.2. PassengerUser <username> => passengeruser
-6.13.4. PassengerDefaultUser <username> => passengerdefaultuser
+6.14.3. PassengerGroup <group name> => passengergroup
-6.13.5. PassengerDefaultGroup <group name> => passengerdefaultgroup
+6.14.4. PassengerDefaultUser <username> => passengerdefaultuser
-6.13.6. PassengerFriendlyErrorPages <on|off> => passengerfriendlyerrorpages
+6.14.5. PassengerDefaultGroup <group name> => passengerdefaultgroup
-6.14. Resource control and optimization options => resource-control-and-optimization-options-zu2f7u
+6.14.6. PassengerFriendlyErrorPages <on|off> => passengerfriendlyerrorpages
-6.14.1. PassengerMaxPoolSize <integer> => passengermaxpoolsize-integer--am64q8
+6.15. Resource control and optimization options => resource-control-and-optimization-options-zu2f7u
-6.14.2. PassengerMinInstances <integer> => passengermininstances-integer--wegq6b
+6.15.1. PassengerMaxPoolSize <integer> => passengermaxpoolsize-integer--am64q8
-6.14.3. PassengerMaxInstances <integer> => passengermaxinstances
+6.15.2. PassengerMinInstances <integer> => passengermininstances-integer--wegq6b
-6.14.4. PassengerMaxInstancesPerApp <integer> => passengermaxinstancesperapp
+6.15.3. PassengerMaxInstances <integer> => passengermaxinstances
-6.14.5. PassengerPoolIdleTime <integer> => passengerpoolidletime-integer--a3gunq
+6.15.4. PassengerMaxInstancesPerApp <integer> => passengermaxinstancesperapp
-6.14.6. PassengerMaxPreloaderIdleTime <integer> => railsappspawneridletime-integer--1awgog1
+6.15.5. PassengerPoolIdleTime <integer> => passengerpoolidletime-integer--a3gunq
-6.14.7. PassengerConcurrencyModel <process|thread> => passengerconcurrencymodel-process-thread--1eipofj
+6.15.6. PassengerMaxPreloaderIdleTime <integer> => railsappspawneridletime-integer--1awgog1
-6.14.8. PassengerThreadCount <number> => passengerthreadcount-number--10jl64a
+6.15.7. PassengerConcurrencyModel <process|thread> => passengerconcurrencymodel-process-thread--1eipofj
-6.14.9. PassengerMaxRequests <integer> => passengermaxrequests-integer--17qkw9n
+6.15.8. PassengerThreadCount <number> => passengerthreadcount-number--10jl64a
-6.14.10. PassengerMaxRequestTime <seconds> => passengermaxrequesttime-seconds--127v1i2
+6.15.9. PassengerMaxRequests <integer> => passengermaxrequests-integer--17qkw9n
-6.14.11. PassengerMemoryLimit <integer> => passengermemorylimit-integer--18irza1
+6.15.10. PassengerMaxRequestTime <seconds> => passengermaxrequesttime-seconds--127v1i2
-6.14.12. PassengerStatThrottleRate <integer> => passengerstatthrottlerate-integer--1dcfda3
+6.15.11. PassengerMemoryLimit <integer> => passengermemorylimit-integer--18irza1
-6.14.13. PassengerPreStart <url> => passengerprestart-url--1utb57k
+6.15.12. PassengerStatThrottleRate <integer> => passengerstatthrottlerate-integer--1dcfda3
-6.14.14. PassengerHighPerformance <on|off> => passengerhighperformance-on-off--nvfa86
+6.15.13. PassengerPreStart <url> => passengerprestart-url--1utb57k
-6.15. Compatibility options => compatibility-options-8jve5a
+6.15.14. PassengerHighPerformance <on|off> => passengerhighperformance-on-off--nvfa86
-6.15.1. PassengerResolveSymlinksInDocumentRoot <on|off> => passengerresolvesymlinksindocumentroot-on-off--1r0qcp8
+6.16. Compatibility options => compatibility-options-8jve5a
-6.15.2. PassengerAllowEncodedSlashes <on|off> => passengerallowencodedslashes-on-off--1y3s1ww
+6.16.1. PassengerResolveSymlinksInDocumentRoot <on|off> => passengerresolvesymlinksindocumentroot-on-off--1r0qcp8
-6.16. Logging and debugging options => logging-and-debugging-options-el2cuc
+6.16.2. PassengerAllowEncodedSlashes <on|off> => passengerallowencodedslashes-on-off--1y3s1ww
-6.16.1. PassengerLogLevel <integer> => passengerloglevel-integer--s3kbil
+6.17. Logging and debugging options => logging-and-debugging-options-el2cuc
-6.16.2. PassengerDebugLogFile <filename> => passengerdebuglogfile-filename--1wjm2j1
+6.17.1. PassengerLogLevel <integer> => passengerloglevel-integer--s3kbil
-6.16.3. PassengerDebugger <on|off> => passengerdebugger-on-off--19you7e
+6.17.2. PassengerDebugLogFile <filename> => passengerdebuglogfile-filename--1wjm2j1
-6.17. Classic Ruby on Rails (⇐ 2.x)-specific options => ruby-on-rails-specific-options-1t10wfu
+6.17.3. PassengerDebugger <on|off> => passengerdebugger-on-off--19you7e
-6.17.1. RailsBaseURI <uri> => railsbaseuri-uri--1txrw3k
+6.18. Classic Ruby on Rails (⇐ 2.x)-specific options => ruby-on-rails-specific-options-1t10wfu
-6.17.2. RailsEnv <string> => railsenv-string--1b0xxvu
+6.18.1. RailsBaseURI <uri> => railsbaseuri-uri--1txrw3k
-6.18. Rack and Rails >= 3 specific options => rack-specific-options-wk9qzt
+6.18.2. RailsEnv <string> => railsenv-string--1b0xxvu
-6.18.1. RackBaseURI <uri> => rackbaseuri-uri--1to24pj
+6.19. Rack and Rails >= 3 specific options => rack-specific-options-wk9qzt
-6.18.2. RackEnv <string> => rackenv-string--vve9py
+6.19.1. RackBaseURI <uri> => rackbaseuri-uri--1to24pj
-6.19. Deprecated or removed options => deprecated-options-pm9m57
+6.19.2. RackEnv <string> => rackenv-string--vve9py
-6.19.1. RailsRuby => railsruby-ht09ei
+6.20. Deprecated or removed options => deprecated-options-pm9m57
-6.19.2. RailsUserSwitching => railsuserswitching-1npx8y4
+6.20.1. RailsRuby => railsruby-ht09ei
-6.19.3. RailsDefaultUser => railsdefaultuser-19j7n3m
+6.20.2. RailsUserSwitching => railsuserswitching-1npx8y4
-6.19.4. RailsAllowModRewrite => railsallowmodrewrite-1vkziro
+6.20.3. RailsDefaultUser => railsdefaultuser-19j7n3m
-6.19.5. RailsSpawnMethod => railsspawnmethod-1aljgpa
+6.20.4. RailsAllowModRewrite => railsallowmodrewrite-1vkziro
-6.19.6. RailsAutoDetect, RackAutoDetect and WsgiAutoDetect => railsautodetect-rackautodetect-and-wsgiautodetect-1qgakzs
+6.20.5. RailsSpawnMethod => railsspawnmethod-1aljgpa
+
+6.20.6. RailsAutoDetect, RackAutoDetect and WsgiAutoDetect => railsautodetect-rackautodetect-and-wsgiautodetect-1qgakzs
7. Troubleshooting => troubleshooting-2ihihi
View
@@ -487,28 +487,36 @@ this option as well. Please read
This required option may only occur once, in the global server configuration.
+[[PassengerDefaultRuby]]
+=== PassengerDefaultRuby and PassengerRuby ===
+:version: 4.0.0
+include::users_guide_snippets/since_version.txt[]
+
+This option specifies the default Ruby interpreter to use for web apps as well as for all sorts of internal Phusion Passenger helper scripts, e.g. the one used by <<PassengerPreStart,PassengerPreStart>>. Please see <<PassengerRuby,PassengerRuby>> for more information, as well as how it relates to <<PassengerRuby,PassengerRuby>>.
+
+This option may occur in the global server configuration. The default value is 'ruby', meaning that the Ruby interpreter will be looked up according to the `PATH` environment variable.
+
[[PassengerRuby]]
=== PassengerRuby <filename> ===
-The `PassengerRuby` option allows one to specify the Ruby interpreter to use. Similarly, the `PassengerPython` option is for specifying the Python interpreter.
+The `PassengerDefaultRuby` and `PassengerRuby` directives specify the Ruby interpreter to use. Similarly, the `PassengerPython` directive is for specifying the Python interpreter.
-In versions prior to 4.0.0, only a single Ruby version was supported for the entire Apache instance, so `PassengerRuby` may only occur in the global server configuration. Also, the `PassengerPython` option was not supported.
+The relationship between `PassengerDefaultRuby` and `PassengerRuby` is as follows:
-Since version 4.0.0, the `PassengerPython` option was added. Also, Phusion Passenger supports multiple Ruby or Python interpreters in the same Apache instance. And so, since version 4.0.0, this option may occur in the following places:
+ * `PassengerDefaultRuby` may only occur in the global server configuration.
+ * In contrast, `PassengerRuby` may only occur in `<Directory>`, `<Location>`, and in '.htaccess' if `AllowOverride Options` is on.
+ * You don't *have* to specify `PassengerRuby`. In this case `PassengerDefaultRuby` is used as the Ruby interpreter. But if you do specify `PassengerRuby` then it will override `PassengerDefaultRuby` in that context. This allows you to use `PassengerRuby` to specify a different Ruby interpreter on a per-application basis.
- * In the global server configuration.
- * In a virtual host configuration block.
- * In a `<Directory>` or `<Location>` block.
- * In '.htaccess', if `AllowOverride Options` is on.
+Phusion Passenger not only uses Ruby to run web apps, but also for running certain helper tools that are written in Ruby, e.g. the internal helper script used by <<PassengerPreStart,PassengerPreStart>>. These tools are always run using `PassengerDefaultRuby`, never by `PassengerRuby`. `PassengerRuby` is only used for running web apps.
-The `PassengerRuby` in the global server configuration - that is, the one that `passenger-install-apache2-module` outputs, or the one in the RPM/DEB package's 'passenger.load' config file - is used for invoking certain Phusion Passenger tools that are written in Ruby, e.g. the internal helper script used by <<PassengerPreStart,PassengerPreStart>>. It is also used as the default Ruby interpreter for Ruby web apps. You don't *have* to specify a `PassengerRuby` in the global configuration though, because the default is to use the first `ruby` command found in `$PATH`.
+The reason why `PassengerDefaultRuby` exists at all is because limitations in the Apache API prevents us from implementing the same behavior using only the `PassengerRuby` directive.
-The `PassengerPython` option works in a similar manner, but applies to Python instead.
+There is no `PassengerDefaultPython` because there are no Phusion Passenger tools written in Python. As such, having `PassengerPython` is enough.
-You can also override `PassengerRuby` or `PassengerPython` in specific contexts if you want to use a different Ruby/Python interpreter for that web app. For example:
+The following example illustrates how it works and how you can use these options to specify different Ruby/Python interpreters for different web apps.
------------------------------
# Use Ruby 1.8.7 by default.
-PassengerRuby /usr/bin/ruby1.8
+PassengerDefaultRuby /usr/bin/ruby1.8
# Use Python 2.6 by default.
PassengerPython /usr/bin/python2.6
@@ -730,8 +730,8 @@ NameVirtualHosts *:80
LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
-PassengerRuby /usr/bin/ruby
PassengerRoot /somewhere/passenger/x.x.x
+PassengerDefaultRuby /usr/bin/ruby
PassengerMaxPoolSize 10
<VirtualHost *:80>
@@ -750,8 +750,8 @@ NameVirtualHosts *:80
# LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so
-# PassengerRuby /usr/bin/ruby
# PassengerRoot /somewhere/passenger/x.x.x
+# PassengerDefaultRuby /usr/bin/ruby
# PassengerMaxPoolSize 10
<VirtualHost *:80>
@@ -266,6 +266,7 @@ passenger_config_merge_dir(apr_pool_t *p, void *basev, void *addv) {
*************************************************/
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_root, root)
+DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_default_ruby, defaultRuby)
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_log_level, logLevel, unsigned int, 0)
DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_debug_log_file, debugLogFile)
DEFINE_SERVER_INT_CONFIG_SETTER(cmd_passenger_max_pool_size, maxPoolSize, unsigned int, 1)
@@ -466,10 +467,15 @@ const command_rec passenger_commands[] = {
NULL,
RSRC_CONF,
"The Passenger root folder."),
+ AP_INIT_TAKE1("PassengerDefaultRuby",
+ (Take1Func) cmd_passenger_default_ruby,
+ NULL,
+ RSRC_CONF,
+ "The default Ruby interpreter to use."),
AP_INIT_TAKE1("PassengerRuby",
(Take1Func) cmd_passenger_ruby,
NULL,
- OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
+ OR_OPTIONS | ACCESS_CONF,
"The Ruby interpreter to use."),
AP_INIT_TAKE1("PassengerPython",
(Take1Func) cmd_passenger_python,
@@ -337,6 +337,9 @@ struct DirConfig {
struct ServerConfig {
/** The Passenger root folder. */
const char *root;
+
+ /** The default Ruby interpreter to use. */
+ const char *defaultRuby;
/** The log verbosity. */
int logLevel;
@@ -380,6 +383,7 @@ struct ServerConfig {
ServerConfig() {
root = NULL;
+ defaultRuby = DEFAULT_RUBY;
logLevel = DEFAULT_LOG_LEVEL;
debugLogFile = NULL;
maxPoolSize = DEFAULT_MAX_POOL_SIZE;
View
@@ -955,7 +955,7 @@ class Hooks {
addHeader(output, "PASSENGER_STATUS_LINE", "false");
addHeader(output, "PASSENGER_APP_ROOT", appRoot);
addHeader(output, "PASSENGER_APP_GROUP_NAME", config->getAppGroupName(appRoot));
- addHeader(output, "PASSENGER_RUBY", config->ruby);
+ addHeader(output, "PASSENGER_RUBY", config->ruby ? config->ruby : serverConfig.defaultRuby);
addHeader(output, "PASSENGER_PYTHON", config->python);
addHeader(output, "PASSENGER_ENV", config->getEnvironment());
addHeader(output, "PASSENGER_SPAWN_METHOD", config->getSpawnMethodString());
@@ -1265,7 +1265,7 @@ class Hooks {
serverConfig.userSwitching,
serverConfig.defaultUser, serverConfig.defaultGroup,
unixd_config.user_id, unixd_config.group_id,
- serverConfig.root, "ruby", serverConfig.maxPoolSize,
+ serverConfig.root, serverConfig.defaultRuby, serverConfig.maxPoolSize,
serverConfig.maxInstancesPerApp, serverConfig.poolIdleTime,
"",
serverConfig.analyticsLogUser,
@@ -52,7 +52,7 @@ agents_starter_start(AgentsStarter *as,
const char *defaultUser, const char *defaultGroup,
uid_t webServerWorkerUid, gid_t webServerWorkerGid,
const char *passengerRoot,
- const char *rubyCommand, unsigned int maxPoolSize,
+ const char *defaultRubyCommand, unsigned int maxPoolSize,
unsigned int maxInstancesPerApp,
unsigned int poolIdleTime,
const char *analyticsServer,
@@ -84,7 +84,7 @@ agents_starter_start(AgentsStarter *as,
webServerPid, tempDir, userSwitching,
defaultUser, defaultGroup,
webServerWorkerUid, webServerWorkerGid,
- passengerRoot, rubyCommand,
+ passengerRoot, defaultRubyCommand,
maxPoolSize, maxInstancesPerApp, poolIdleTime,
analyticsServer,
analyticsLogUser, analyticsLogGroup,
@@ -52,7 +52,7 @@ int agents_starter_start(AgentsStarter *as,
const char *defaultUser, const char *defaultGroup,
uid_t webServerWorkerUid, gid_t webServerWorkerGid,
const char *passengerRoot,
- const char *rubyCommand, unsigned int maxPoolSize,
+ const char *defaultRubyCommand, unsigned int maxPoolSize,
unsigned int maxInstancesPerApp,
unsigned int poolIdleTime,
const char *analyticsServer,
@@ -375,7 +375,7 @@ class AgentsStarter {
pid_t webServerPid, const string &tempDir,
bool userSwitching, const string &defaultUser, const string &defaultGroup,
uid_t webServerWorkerUid, gid_t webServerWorkerGid,
- const string &passengerRoot, const string &rubyCommand,
+ const string &passengerRoot, const string &defaultRubyCommand,
unsigned int maxPoolSize, unsigned int maxInstancesPerApp,
unsigned int poolIdleTime,
const string &analyticsServer,
@@ -414,7 +414,7 @@ class AgentsStarter {
.setUid ("web_server_worker_uid", webServerWorkerUid)
.setGid ("web_server_worker_gid", webServerWorkerGid)
.set ("passenger_root", passengerRoot)
- .set ("ruby", rubyCommand)
+ .set ("default_ruby", defaultRubyCommand)
.setInt ("max_pool_size", maxPoolSize)
.setInt ("max_instances_per_app", maxInstancesPerApp)
.setInt ("pool_idle_time", poolIdleTime)
@@ -1373,7 +1373,7 @@ initializeAgent(int argc, char *argv[], const char *processName) {
#ifdef __linux__
if (options.has("passenger_root")) {
ResourceLocator locator(options.get("passenger_root", true));
- string ruby = options.get("ruby", false, DEFAULT_RUBY);
+ string ruby = options.get("default_ruby", false, DEFAULT_RUBY);
string path = ruby + " \"" + locator.getHelperScriptsDir() +
"/backtrace-sanitizer.rb\"";
backtraceSanitizerCommand = strdup(path.c_str());
@@ -42,7 +42,7 @@ struct AgentOptions {
string defaultUser;
string defaultGroup;
string passengerRoot;
- string rubyCommand;
+ string defaultRubyCommand;
unsigned int generationNumber;
unsigned int maxPoolSize;
unsigned int maxInstancesPerApp;
@@ -62,7 +62,7 @@ struct AgentOptions {
passengerRoot = options.get("passenger_root");
tempDir = options.get("temp_dir");
userSwitching = options.getBool("user_switching");
- rubyCommand = options.get("ruby");
+ defaultRubyCommand = options.get("default_ruby");
defaultUser = options.get("default_user");
defaultGroup = options.get("default_group");
maxPoolSize = options.getInt("max_pool_size");
Oops, something went wrong.

0 comments on commit 1eb6076

Please sign in to comment.