passenger 4.0.14 → 4.0.16

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (121) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +69 -0
  3. data/bin/passenger-install-apache2-module +7 -1
  4. data/bin/passenger-install-nginx-module +18 -1
  5. data/build/apache2.rb +25 -1
  6. data/build/basics.rb +7 -4
  7. data/build/debian.rb +72 -25
  8. data/build/nginx.rb +24 -0
  9. data/build/packaging.rb +45 -3
  10. data/debian.template/{control → control.template} +17 -8
  11. data/debian.template/ruby-passenger.install.template +1 -0
  12. data/debian.template/rules.template +9 -3
  13. data/dev/run_travis.sh +14 -0
  14. data/doc/Users guide Apache.idmap.txt +64 -48
  15. data/doc/Users guide Apache.txt +127 -93
  16. data/doc/Users guide Nginx.idmap.txt +46 -28
  17. data/doc/Users guide Nginx.txt +100 -12
  18. data/doc/images/{conservative_spawning.png → direct_spawning.png} +0 -0
  19. data/doc/images/{conservative_spawning.svg → direct_spawning.svg} +0 -0
  20. data/doc/users_guide_snippets/installation.txt +107 -66
  21. data/doc/users_guide_snippets/passenger_spawn_method.txt +1 -1
  22. data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -12
  23. data/doc/users_guide_snippets/tips.txt +70 -3
  24. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +2 -0
  25. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +114 -0
  26. data/ext/apache2/Configuration.cpp +53 -101
  27. data/ext/apache2/Configuration.hpp +19 -41
  28. data/ext/apache2/ConfigurationCommands.cpp +95 -0
  29. data/ext/apache2/ConfigurationCommands.cpp.erb +91 -0
  30. data/ext/apache2/ConfigurationFields.hpp +59 -0
  31. data/ext/apache2/ConfigurationFields.hpp.erb +89 -0
  32. data/ext/apache2/ConfigurationSetters.cpp +223 -0
  33. data/ext/apache2/ConfigurationSetters.cpp.erb +126 -0
  34. data/ext/apache2/CreateDirConfig.cpp +50 -0
  35. data/ext/apache2/CreateDirConfig.cpp.erb +71 -0
  36. data/ext/apache2/Hooks.cpp +6 -0
  37. data/ext/apache2/MergeDirConfig.cpp +103 -0
  38. data/ext/apache2/MergeDirConfig.cpp.erb +81 -0
  39. data/ext/common/ApplicationPool2/AppTypes.cpp +2 -0
  40. data/ext/common/ApplicationPool2/AppTypes.h +2 -0
  41. data/ext/common/ApplicationPool2/Common.h +1 -1
  42. data/ext/common/ApplicationPool2/Group.h +56 -7
  43. data/ext/common/ApplicationPool2/Implementation.cpp +133 -31
  44. data/ext/common/ApplicationPool2/Options.h +23 -2
  45. data/ext/common/ApplicationPool2/Pool.h +8 -1
  46. data/ext/common/ApplicationPool2/Process.h +9 -0
  47. data/ext/common/ApplicationPool2/Session.h +1 -0
  48. data/ext/common/ApplicationPool2/Spawner.h +21 -19
  49. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  50. data/ext/common/Constants.h +21 -17
  51. data/ext/common/Constants.h.erb +1 -1
  52. data/ext/common/Exceptions.h +19 -0
  53. data/ext/common/ServerInstanceDir.h +8 -4
  54. data/ext/common/Utils.cpp +33 -1
  55. data/ext/common/Utils.h +14 -0
  56. data/ext/common/Utils/StrIntUtils.cpp +16 -0
  57. data/ext/common/Utils/StrIntUtils.h +5 -0
  58. data/ext/common/agents/HelperAgent/Main.cpp +5 -5
  59. data/ext/common/agents/HelperAgent/RequestHandler.h +94 -45
  60. data/ext/common/agents/LoggingAgent/Main.cpp +10 -26
  61. data/ext/common/agents/Watchdog/Main.cpp +4 -15
  62. data/ext/nginx/CacheLocationConfig.c +501 -0
  63. data/ext/nginx/CacheLocationConfig.c.erb +140 -0
  64. data/ext/nginx/Configuration.c +29 -453
  65. data/ext/nginx/Configuration.h +3 -21
  66. data/ext/nginx/ConfigurationCommands.c +501 -0
  67. data/ext/nginx/ConfigurationCommands.c.erb +136 -0
  68. data/ext/nginx/ConfigurationFields.h +89 -0
  69. data/ext/nginx/ConfigurationFields.h.erb +85 -0
  70. data/ext/nginx/ContentHandler.c +3 -166
  71. data/ext/nginx/CreateLocationConfig.c +146 -0
  72. data/ext/nginx/CreateLocationConfig.c.erb +70 -0
  73. data/ext/nginx/MergeLocationConfig.c +166 -0
  74. data/ext/nginx/MergeLocationConfig.c.erb +72 -0
  75. data/ext/nginx/config +4 -0
  76. data/ext/oxt/detail/tracable_exception_disabled.hpp +21 -1
  77. data/ext/oxt/detail/tracable_exception_enabled.hpp +4 -1
  78. data/ext/oxt/implementation.cpp +7 -1
  79. data/ext/oxt/macros.hpp +9 -7
  80. data/helper-scripts/backtrace-sanitizer.rb +23 -0
  81. data/helper-scripts/classic-rails-loader.rb +23 -0
  82. data/helper-scripts/classic-rails-preloader.rb +23 -0
  83. data/helper-scripts/download_binaries/extconf.rb +10 -5
  84. data/helper-scripts/meteor-loader.rb +127 -0
  85. data/helper-scripts/node-loader.js +1 -1
  86. data/helper-scripts/rack-preloader.rb +23 -0
  87. data/helper-scripts/system-memory-stats.py +22 -0
  88. data/helper-scripts/touch-dir.sh +48 -0
  89. data/lib/phusion_passenger.rb +1 -1
  90. data/lib/phusion_passenger/apache2/config_options.rb +104 -0
  91. data/lib/phusion_passenger/constants.rb +8 -0
  92. data/lib/phusion_passenger/native_support.rb +9 -1
  93. data/lib/phusion_passenger/nginx/config_options.rb +328 -0
  94. data/lib/phusion_passenger/packaging.rb +2 -2
  95. data/lib/phusion_passenger/platform_info/apache.rb +8 -0
  96. data/lib/phusion_passenger/platform_info/compiler.rb +2 -2
  97. data/lib/phusion_passenger/rails3_extensions/init.rb +19 -4
  98. data/lib/phusion_passenger/ruby_core_enhancements.rb +4 -1
  99. data/lib/phusion_passenger/standalone/app_finder.rb +3 -2
  100. data/lib/phusion_passenger/standalone/command.rb +1 -0
  101. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -6
  102. data/lib/phusion_passenger/standalone/runtime_locator.rb +9 -2
  103. data/lib/phusion_passenger/standalone/start_command.rb +45 -9
  104. data/lib/phusion_passenger/utils.rb +4 -1
  105. data/resources/templates/{nginx → installer_common}/run_installer_as_root.txt.erb +3 -1
  106. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +6 -0
  107. data/resources/templates/standalone/config.erb +8 -8
  108. data/test/cxx/ApplicationPool2/PoolTest.cpp +120 -3
  109. data/test/cxx/RequestHandlerTest.cpp +66 -3
  110. data/test/integration_tests/native_packaging_spec.rb +41 -0
  111. data/test/integration_tests/nginx_tests.rb +1 -0
  112. data/test/integration_tests/standalone_tests.rb +4 -0
  113. data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +22 -0
  114. data/test/stub/rails3.0/config/initializers/passenger.rb +2 -1
  115. data/test/stub/rails3.1/config/initializers/passenger.rb +2 -1
  116. data/test/stub/rails3.2/config/initializers/passenger.rb +2 -1
  117. data/test/stub/rails4.0/config/initializers/passenger.rb +5 -1
  118. data/test/stub/wsgi/passenger_wsgi.py +5 -0
  119. metadata +32 -7
  120. metadata.gz.asc +7 -7
  121. data/resources/templates/apache2/run_installer_as_root.txt.erb +0 -8
@@ -32,6 +32,6 @@ the startup time of a single server in Mongrel Cluster. Direct spawning will als
32
32
  render <<reducing_memory_usage,Ruby Enterprise Edition's memory reduction technology>> useless.
33
33
 
34
34
  ************************************************
35
- As of Passenger 3.2, 'conservative' spawning was renamed to 'direct' and 'smart-lv2' was renamed
35
+ As of Phusion Passenger 4.0, 'conservative' spawning was renamed to 'direct' and 'smart-lv2' was renamed
36
36
  to 'smart'. The old 'smart' spawning has been removed in favor of the new version.
37
37
  ************************************************
@@ -21,12 +21,6 @@ passenger-config was invoked through the following Ruby interpreter:
21
21
  To use in Nginx : passenger_ruby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
22
22
  To use with Standalone: /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby /opt/passenger/bin/passenger start
23
23
 
24
- The following Ruby interpreter was found first in $PATH:
25
- Command: /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
26
- Version: ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
27
- To use in Apache: PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
28
- To use in Nginx : passenger_ruby /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby
29
- To use with Standalone: /usr/local/rvm/wrappers/ruby-1.8.7-p358/ruby /opt/passenger/bin/passenger start
30
24
 
31
25
  ## Notes for RVM users
32
26
  Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'.
@@ -44,12 +38,6 @@ passenger-config was invoked through the following Ruby interpreter:
44
38
  To use in Nginx : passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
45
39
  To use with Standalone: /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby /opt/passenger/bin/passenger start
46
40
 
47
- The following Ruby interpreter was found first in $PATH:
48
- Command: /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
49
- Version: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]
50
- To use in Apache: PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
51
- To use in Nginx : passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
52
- To use with Standalone: /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby /opt/passenger/bin/passenger start
53
41
 
54
42
  ## Notes for RVM users
55
43
  Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'.
@@ -314,7 +314,7 @@ append a timestamp to the URI to better facilitate HTTP caching. For more inform
314
314
  please refer to
315
315
  link:http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html[the Rails API docs].
316
316
 
317
- === Out-of-Band Garbage Work and Out-of-Band Garbage Collection
317
+ === Out-of-Band Work and Out-of-Band Garbage Collection
318
318
 
319
319
  **Available since Phusion Passenger 4.0.0.**
320
320
 
@@ -328,11 +328,24 @@ Because Out-of-Band Work is implemented at the Phusion Passenger inter-process r
328
328
 
329
329
  - It works well even with tasks that can pause all threads. The MRI Ruby garbage collector is a stop-the-world mark-and-sweep garbage collector.
330
330
  - Phusion Passenger can spawn more processes as necessary, in order to prevent situations in which all application processes are busy performing out-of-band work. Phusion Passenger guarantees that there's at least one process that's ready to process requests.
331
+ - Phusion Passenger guarantees that no more than 1 process is performing out-of-band work at the same time.
331
332
 
332
333
  Applications can use Out-of-Band Work as follows:
333
334
 
334
- 1. Request out-of-band work by outputting the `X-Passenger-Request-OOB-Work` header during a request. It does not matter what the value is. At this time, it is not possible to request out-of-band work from outside requests.
335
- 2. You can actually perform out-of-band work when you receive a `:oob_work` Phusion Passenger event.
335
+ 1. Ensure that
336
+ ifdef::apache[]
337
+ <<PassengerMaxPoolSize,PassengerMaxPoolSize>>
338
+ and
339
+ <<PassengerMaxInstances,PassengerMaxInstances>>
340
+ endif::[]
341
+ ifdef::nginx[]
342
+ <<PassengerMaxPoolSize,passenger_max_pool_size>>
343
+ and
344
+ <<PassengerMaxInstances,passenger_max_instances>>
345
+ endif::[]
346
+ are both larger than 1. Out-of-band work only works if there are at least 2 application processes.
347
+ 2. Request out-of-band work by outputting the `X-Passenger-Request-OOB-Work` header during a request. It does not matter what the value is. At this time, it is not possible to request out-of-band work from outside requests.
348
+ 3. You can actually perform out-of-band work when you receive a `:oob_work` Phusion Passenger event.
336
349
 
337
350
  Note that even though you can request out-of-band work, there's no guarantee that Phusion Passenger will send an `oob_work` event in a timely manner, if at all. It is also possible that Phusion Passenger sends an `oob_work` event without you ever having requested one. This latter could for example happen if the OOB work is administrator-initiated. Do not make any assumptions in your code.
338
351
 
@@ -538,6 +551,59 @@ Immediately after creating the `run` file, daemontools/runit automatically runs
538
551
 
539
552
  To shut down a daemontools/runit-managed daemon, you need to use `svc -d /etc/service/flying-passenger` (daemontools) or `sv stop /etc/service/flying-passenger` (runit) instead of sending a signal to the process.
540
553
 
554
+ [[using_flying_passenger_with_mri_18_or_jruby]]
555
+ ==== Using Flying Passenger with MRI 1.8 or JRuby
556
+
557
+ Using Flying Passenger in combination with MRI Ruby 1.8 or with JRuby requires special attention. This is because the Flying Passenger daemon is written in Ruby, and requires proper `Process.spawn` support, which neither MRI 1.8 nor JRuby support.
558
+
559
+ It is however possible to use Flying Passenger with MRI Ruby 1.8 and JRuby. You can't run the Flying Passenger daemon in MRI 1.8 or JRuby, but you can still run the web applications - hosted under Flying Passenger - in MRI 1.8 or JRuby.
560
+
561
+ First, edit your Nginx configuration file and specify a Ruby interpreter for your web applications. For example:
562
+
563
+ --------------------
564
+ # Connect to the Flying Passenger daemon on the following socket
565
+ passenger_fly_with /var/run/flying-passenger.sock;
566
+ ...
567
+
568
+ server {
569
+ listen 80;
570
+ server_name www.foo.com;
571
+ root /webapps/foo/public;
572
+ passenger_enabled on;
573
+ # Use JRuby for this web application
574
+ passenger_ruby /opt/jruby/bin/jruby;
575
+ }
576
+ --------------------
577
+
578
+ Then you need to install a Ruby 1.9-compatible Ruby interpeter with POSIX spawn support, alongside JRuby/MRI 1.8. Ruby interpreters which can be used for running the Flying Passenger daemon include:
579
+
580
+ * MRI Ruby >= 1.9.
581
+ * Rubinius.
582
+
583
+ The following example demonstrates how you can install MRI Ruby 1.9 in parallel with your MRI Ruby 1.8 or JRuby installation.
584
+
585
+ Example for Debian/Ubuntu users:
586
+
587
+ [source,sh]
588
+ --------------------------------
589
+ # Install Ruby 1.9
590
+ sudo apt-get install ruby1.9.3
591
+ # Run the Flying Passenger daemon in Ruby 1.9
592
+ ruby1.9 -S flying-passenger --socket-file=/var/run/flying-passenger.sock
593
+ --------------------------------
594
+
595
+ Example for RVM users:
596
+
597
+ [source,sh]
598
+ --------------------------------
599
+ # Install Ruby 1.9
600
+ rvm install 1.9.3
601
+ # Run the Flying Passenger daemon in Ruby 1.9
602
+ $ rvm-exec 1.9.3 ruby -S flying-passenger --socket-file=/var/run/flying-passenger.sock
603
+ --------------------------------
604
+
605
+ The Flying Passenger daemon will now be run on Ruby 1.9, while the web application 'www.foo.com' will be run on JRuby.
606
+
541
607
  [[flying_passenger_caveats]]
542
608
  ==== Caveats and limitations
543
609
 
@@ -545,6 +611,7 @@ Beware of the following caveats and limitations when using Flying Passenger:
545
611
 
546
612
  - The Nginx executable **must** be compiled with the same version of Phusion Passenger as the Flying Passenger daemon. Failing to meet this requirement may result in cryptic errors, or may result in certain features not working, until you've fixed the situation. When upgrading Phusion Passenger, you must restart both Nginx and the Flying Passenger daemon.
547
613
  - The <<PassengerRoot,passenger_root>> directive has no effect. When using Flying Passenger, you are not supposed to set `passenger_root`.
614
+ - The Flying Passenger daemon is written in Ruby. It requires a Ruby interpreter with proper `Process#spawn` support. At the time of writing, all Ruby interpreters in existance satisfy this requirement, except for MRI Ruby 1.8 and JRuby. See <<using_flying_passenger_with_mri_18_or_jruby,Using Flying Passenger with MRI 1.8 or JRuby>> for more information.
548
615
  - When you add a new application to the web server configuration, Flying Passenger will automatically pick up the application's settings and spawn this new application upon the first request to it. However it is not capable of automatically starting the new app before a request has been sent to it (i.e. <<PassengerPreStart,passenger_pre_start>>-like behavior is not available in this case). As a workaround, you can send an HTTP request to your application after starting the daemon, which forces it to spawn application processes.
549
616
  - When you remove an application from the web server configuration, Flying Passenger will not detect the removal and will not shut down the associated application processes. Killing the application processes will also not help, because Flying Passenger will restart them per the (now-removed, but still in the Flying Passenger daemon's memory) <<PassengerMinInstances,passenger_min_instances>> settings. At the moment, there are two ways to get rid of those processes:
550
617
  * Before removing the application from the web server configuration, explicitly set its `passenger_min_instances` to 0. Next, send a request to it, which will cause the Flying Passenger daemon to take over the new `passenger_min_instances 0` option. You can then proceed with removing the application from the web server configuration, and restarting the web server. Finally, kill the PIDs associated to those application processes and remove the application configuration.
@@ -1,3 +1,5 @@
1
+ === Page caching support
2
+
1
3
  For each HTTP request, Phusion Passenger will automatically look for a corresponding
2
4
  page cache file, and serve that if it exists. It does this by appending ".html" to
3
5
  the filename that the URI normally maps to, and checking whether that file exists.
@@ -0,0 +1,114 @@
1
+ [[relationship_with_ruby]]
2
+ === Phusion Passenger and its relationship with Ruby
3
+
4
+ ==== How Ruby is used
5
+
6
+ Phusion Passenger's core is written in C++ for performance and memory efficiency. It supports web applications written in any language. Phusion Passenger requires Ruby, its usage of Ruby is minimal in order to maximize performance and to minimize memory usage.
7
+
8
+ * Phusion Passenger's installer, build system and administration tools are written in Ruby.
9
+ * Certain internally used tools, such as the crash handler (which generates a backtrace in case Phusion Passenger crash) and the prespawn script (used to implement
10
+ ifdef::apache[]
11
+ <<PassengerPreStart,PassengerPreStart>>)
12
+ endif::[]
13
+ ifdef::nginx[]
14
+ <<PassengerPreStart,passenger_pre_start>>)
15
+ endif::[]
16
+ are written in Ruby as well.
17
+ * Ruby web application support is implemented in Ruby.
18
+ * If you use <<flying_passenger,Flying Passenger>>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C++ core.
19
+ * If you use link:Users%20guide%20Standalone.html[Phusion Passenger Standalone], then the frontend (the `passenger` command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C++ core.
20
+
21
+ Other than the aforementioned aspects, Phusion Passenger does not use Ruby during normal operation. For example, if you run Python WSGI web applications on Phusion Passenger, then there will be (almost) no Ruby code running on the system.
22
+
23
+ ==== When the system has multiple Ruby interpreters
24
+
25
+ Phusion Passenger may be installed with any Ruby interpreter. Once installed, you can run Phusion Passenger's Ruby parts under any Ruby interpreter you want, even if that Ruby interpreter was not the one you originally installed Phusion Passenger with.
26
+
27
+ The reason for this is that Phusion Passenger does not dynamically link to Ruby: Phusion Passenger uses Ruby entirely out-of-process. Thus you can switch to any Ruby interpreter you want during runtime, without recompiling Phusion Passenger, and without worrying about what Ruby you used to install Phusion Passenger.
28
+
29
+ Phusion Passenger is also capable of running Ruby web applications under any Ruby interpreter you want. So it is not important which Ruby you use to install Phusion Passenger: it will work regardless. Please refer to the documentation for the
30
+ ifdef::apache[]
31
+ <<PassengerRuby,PassengerRuby>>
32
+ endif::[]
33
+ ifdef::nginx[]
34
+ <<PassengerRuby,passenger_ruby>>
35
+ endif::[]
36
+ directive to learn how run different web applications under different Ruby interpreters.
37
+
38
+ .Caveat: RVM and RVM gemsets
39
+
40
+ There is however one caveat if you happen to be using RVM or RVM gemsets. When you `gem install` Phusion Passenger using RVM, then RVM will install Phusion Passenger into the *currently active RVM Ruby and gemset*. This means that Phusion Passenger commands - such as `passenger`, `passenger-install-xxx-module` and `passenger-status` - are available in that same RVM Ruby and gemset only. When you switch Ruby interpreter, or when you switch gemset, the Phusion Passenger commands will no longer be available, and you will get a `command not found` error. Here's an example which demonstrates the problem.
41
+
42
+ ."Command not found" problem demonstration
43
+ [source,sh]
44
+ ------------------------
45
+ ## Install Phusion Passenger (open source edition) using Ruby 1.9.3
46
+ ## and the 'business' gemset
47
+ $ rvm use 1.9.3
48
+ Using /home/phusion/.rvm/gems/ruby-1.9.3-p429
49
+ $ rvm gemset create business
50
+ $ rvm gemset use business
51
+ Using ruby-1.9.3-p429 with gemset business
52
+ $ curl -O https://s3.amazonaws.com/phusion-passenger/releases/gem_bootstrap.sh
53
+ $ eval "`sh gem_bootstrap.sh`"
54
+ $ gem install passenger
55
+
56
+ ## Verify that passenger works
57
+ $ passenger --version
58
+ Phusion Passenger version 4.0.14
59
+
60
+ ## Switch to a different RVM gemset. You will get a `command not found`
61
+ $ rvm gemset use default
62
+ Using ruby-1.9.3-p429 with gemset default
63
+ $ passenger --version
64
+ bash: passenger: command not found
65
+
66
+ ## Switch to a different Ruby interpreter. You will also get
67
+ ## a `command not found`
68
+ $ rvm use 2.0.0
69
+ Using /home/phusion/.rvm/gems/ruby-2.0.0-p195
70
+ $ passenger --version
71
+ bash: passenger: command not found
72
+
73
+ ## Switch back to the Ruby and gemset that you installed Phusion
74
+ ## Passenger with, and verify that it works again
75
+ $ rvm use 1.9.3
76
+ Using /home/phusion/.rvm/gems/ruby-2.0.0-p195
77
+ $ rvm gemset use business
78
+ Using ruby-1.9.3-p429 with gemset business
79
+ $ passenger --version
80
+ Phusion Passenger version 4.0.14
81
+ ------------------------
82
+
83
+ .Solutions
84
+ There are several ways to solve this problem:
85
+
86
+ 1. Permanently add Phusion Passenger's command directory to your PATH, so that your shell can always find them even when you switch RVM Ruby or gemset. If you don't know what PATH means, please read <<about_environment_variable,About environment variables>> first.
87
+ +
88
+ The drawback is that you have to redo this every time you upgrade Phusion Passenger, because the Phusion Passenger directory filename is dependent on the version number.
89
+ +
90
+ First, identify the location of the Phusion Passenger command directory, like this:
91
+ +
92
+ ------------------------------------------------------------------
93
+ $ echo `passenger-config --root`/bin
94
+ /home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin
95
+ ------------------------------------------------------------------
96
+ +
97
+ Next, add the directory that you've found to your current shell's PATH:
98
+ +
99
+ ------------------------------------------------------------------
100
+ $ export PATH=/home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin:$PATH
101
+ ------------------------------------------------------------------
102
+ +
103
+ Finally, make the change permanent by appending the above command to your bash startup file:
104
+ +
105
+ ------------------------------------------------------------------
106
+ $ echo 'export PATH=/home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin:$PATH' >> ~/.bashrc
107
+ ------------------------------------------------------------------
108
+ 2. Switch back to the RVM Ruby and gemset that you installed Phusion Passenger with, before running any Phusion Passenger command.
109
+ 3. Prepend any Phusion Passenger command with `rvm-exec RUBY_NAME@GEMSET_NAME ruby -S`. If the relevant Phusion Passenger command also needs root privileges, then prepend `rvmsudo` before that. For example:
110
+ +
111
+ ------------------------------------------------------------------
112
+ rvm-exec 1.9.3@business ruby -S passenger --version
113
+ rvmsudo rvm-exec 1.9.3@business ruby -S passenger-install-apache2-module
114
+ ------------------------------------------------------------------
@@ -24,6 +24,7 @@
24
24
  */
25
25
  #include <algorithm>
26
26
  #include <cstdlib>
27
+ #include <climits>
27
28
 
28
29
  /* ap_config.h checks whether the compiler has support for C99's designated
29
30
  * initializers, and defines AP_HAVE_DESIGNATED_INITIALIZER if it does. However,
@@ -185,20 +186,14 @@ create_dir_config_struct(apr_pool_t *pool) {
185
186
  void *
186
187
  passenger_config_create_dir(apr_pool_t *p, char *dirspec) {
187
188
  DirConfig *config = create_dir_config_struct(p);
188
- config->enabled = DirConfig::UNSET;
189
- config->ruby = NULL;
189
+
190
+ #include "CreateDirConfig.cpp"
191
+
190
192
  config->python = NULL;
191
193
  config->environment = NULL;
192
194
  config->appRoot = NULL;
193
- config->user = NULL;
194
- config->group = NULL;
195
195
  config->spawnMethod = DirConfig::SM_UNSET;
196
196
  config->maxPreloaderIdleTime = -1;
197
- config->maxRequests = 0;
198
- config->maxRequestsSpecified = false;
199
- config->minInstances = 1;
200
- config->minInstancesSpecified = false;
201
- config->highPerformance = DirConfig::UNSET;
202
197
  config->resolveSymlinksInDocRoot = DirConfig::UNSET;
203
198
  config->allowEncodedSlashes = DirConfig::UNSET;
204
199
  config->statThrottleRate = 0;
@@ -218,25 +213,19 @@ passenger_config_merge_dir(apr_pool_t *p, void *basev, void *addv) {
218
213
  DirConfig *base = (DirConfig *) basev;
219
214
  DirConfig *add = (DirConfig *) addv;
220
215
 
221
- config->enabled = (add->enabled == DirConfig::UNSET) ? base->enabled : add->enabled;
216
+ #include "MergeDirConfig.cpp"
222
217
 
223
218
  config->baseURIs = base->baseURIs;
224
219
  for (set<string>::const_iterator it(add->baseURIs.begin()); it != add->baseURIs.end(); it++) {
225
220
  config->baseURIs.insert(*it);
226
221
  }
227
222
 
228
- MERGE_STR_CONFIG(ruby);
229
223
  MERGE_STR_CONFIG(python);
230
224
  MERGE_STR_CONFIG(environment);
231
225
  MERGE_STR_CONFIG(appRoot);
232
226
  MERGE_STRING_CONFIG(appGroupName);
233
- MERGE_STR_CONFIG(user);
234
- MERGE_STR_CONFIG(group);
235
227
  config->spawnMethod = (add->spawnMethod == DirConfig::SM_UNSET) ? base->spawnMethod : add->spawnMethod;
236
228
  config->maxPreloaderIdleTime = (add->maxPreloaderIdleTime == -1) ? base->maxPreloaderIdleTime : add->maxPreloaderIdleTime;
237
- MERGE_INT_CONFIG(maxRequests);
238
- MERGE_INT_CONFIG(minInstances);
239
- MERGE_THREEWAY_CONFIG(highPerformance);
240
229
  MERGE_INT_CONFIG(statThrottleRate);
241
230
  MERGE_STR_CONFIG(restartDir);
242
231
  MERGE_STR_CONFIG(uploadBufferDir);
@@ -291,18 +280,13 @@ cmd_passenger_pre_start(cmd_parms *cmd, void *pcfg, const char *arg) {
291
280
  return NULL;
292
281
  }
293
282
 
294
- DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_min_instances, minInstances, unsigned long, 0)
295
- DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_max_requests, maxRequests, unsigned long, 0)
296
- DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_high_performance, highPerformance)
297
- DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_enabled, enabled)
298
- DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_ruby, ruby)
283
+ #include "ConfigurationSetters.cpp"
284
+
299
285
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_python, python)
300
286
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_environment, environment)
301
287
  DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_stat_throttle_rate, statThrottleRate, unsigned long, 0)
302
288
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_app_root, appRoot)
303
289
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_app_group_name, appGroupName)
304
- DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_user, user)
305
- DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_group, group)
306
290
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_restart_dir, restartDir)
307
291
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_upload_buffer_dir, uploadBufferDir)
308
292
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_union_station_key, unionStationKey)
@@ -451,11 +435,6 @@ const command_rec passenger_commands[] = {
451
435
  NULL,
452
436
  RSRC_CONF,
453
437
  "The default Ruby interpreter to use."),
454
- AP_INIT_TAKE1("PassengerRuby",
455
- (Take1Func) cmd_passenger_ruby,
456
- NULL,
457
- OR_OPTIONS | ACCESS_CONF,
458
- "The Ruby interpreter to use."),
459
438
  AP_INIT_TAKE1("PassengerLogLevel",
460
439
  (Take1Func) cmd_passenger_log_level,
461
440
  NULL,
@@ -471,11 +450,6 @@ const command_rec passenger_commands[] = {
471
450
  NULL,
472
451
  RSRC_CONF,
473
452
  "The maximum number of simultaneously alive application instances."),
474
- AP_INIT_TAKE1("PassengerMinInstances",
475
- (Take1Func) cmd_passenger_min_instances,
476
- NULL,
477
- OR_LIMIT | ACCESS_CONF | RSRC_CONF,
478
- "The minimum number of application instances to keep when cleaning idle instances."),
479
453
  AP_INIT_TAKE1("PassengerMaxInstancesPerApp",
480
454
  (Take1Func) cmd_passenger_max_instances_per_app,
481
455
  NULL,
@@ -491,16 +465,6 @@ const command_rec passenger_commands[] = {
491
465
  NULL,
492
466
  RSRC_CONF,
493
467
  "Whether to enable user switching support."),
494
- AP_INIT_TAKE1("PassengerUser",
495
- (Take1Func) cmd_passenger_user,
496
- NULL,
497
- ACCESS_CONF | RSRC_CONF,
498
- "The user that Ruby applications must run as."),
499
- AP_INIT_TAKE1("PassengerGroup",
500
- (Take1Func) cmd_passenger_group,
501
- NULL,
502
- ACCESS_CONF | RSRC_CONF,
503
- "The group that Ruby applications must run as."),
504
468
  AP_INIT_TAKE1("PassengerDefaultUser",
505
469
  (Take1Func) cmd_passenger_default_user,
506
470
  NULL,
@@ -516,21 +480,54 @@ const command_rec passenger_commands[] = {
516
480
  NULL,
517
481
  RSRC_CONF,
518
482
  "The temp directory that Passenger should use."),
519
- AP_INIT_TAKE1("PassengerMaxRequests",
520
- (Take1Func) cmd_passenger_max_requests,
483
+ AP_INIT_TAKE1("PassengerMaxPreloaderIdleTime",
484
+ (Take1Func) cmd_passenger_max_preloader_idle_time,
521
485
  NULL,
522
- OR_LIMIT | ACCESS_CONF | RSRC_CONF,
523
- "The maximum number of requests that an application instance may process."),
524
- AP_INIT_FLAG("PassengerHighPerformance",
525
- (FlagFunc) cmd_passenger_high_performance,
486
+ RSRC_CONF,
487
+ "The maximum number of seconds that a preloader process may be idle before it is shutdown."),
488
+ AP_INIT_TAKE1("UnionStationGatewayAddress",
489
+ (Take1Func) cmd_union_station_gateway_address,
526
490
  NULL,
527
- OR_ALL,
528
- "Enable or disable Passenger's high performance mode."),
529
- AP_INIT_FLAG("PassengerEnabled",
530
- (FlagFunc) cmd_passenger_enabled,
491
+ RSRC_CONF,
492
+ "The Union Station Gateway host name."),
493
+ AP_INIT_TAKE1("UnionStationGatewayPort",
494
+ (Take1Func) cmd_union_station_gateway_port,
531
495
  NULL,
532
- OR_ALL,
533
- "Enable or disable Phusion Passenger."),
496
+ RSRC_CONF,
497
+ "The Union Station Gateway port number."),
498
+ AP_INIT_TAKE1("UnionStationGatewayCert",
499
+ (Take1Func) cmd_union_station_gateway_cert,
500
+ NULL,
501
+ RSRC_CONF,
502
+ "The Union Station Gateway certificate."),
503
+ AP_INIT_TAKE1("UnionStationProxyAddress",
504
+ (Take1Func) cmd_union_station_proxy_address,
505
+ NULL,
506
+ RSRC_CONF,
507
+ "The address of the proxy that should be used for sending data to Union Station."),
508
+ AP_INIT_TAKE1("PassengerAnalyticsLogUser",
509
+ (Take1Func) cmd_passenger_analytics_log_user,
510
+ NULL,
511
+ RSRC_CONF,
512
+ "The owner of analytics files."),
513
+ AP_INIT_TAKE1("PassengerAnalyticsLogGroup",
514
+ (Take1Func) cmd_passenger_analytics_log_group,
515
+ NULL,
516
+ RSRC_CONF,
517
+ "The group of analytics files."),
518
+ AP_INIT_TAKE1("PassengerPreStart",
519
+ (Take1Func) cmd_passenger_pre_start,
520
+ NULL,
521
+ RSRC_CONF,
522
+ "Prestart the given web applications during startup."),
523
+ AP_INIT_TAKE1("PassengerSpawnMethod",
524
+ (Take1Func) cmd_passenger_spawn_method,
525
+ NULL,
526
+ RSRC_CONF,
527
+ "The spawn method to use."),
528
+
529
+ #include "ConfigurationCommands.cpp"
530
+
534
531
  AP_INIT_TAKE1("PassengerAppGroupName",
535
532
  (Take1Func) cmd_passenger_app_group_name,
536
533
  NULL,
@@ -586,62 +583,17 @@ const command_rec passenger_commands[] = {
586
583
  NULL,
587
584
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
588
585
  "Whether to display friendly error pages when something goes wrong"),
589
- AP_INIT_TAKE1("PassengerSpawnMethod",
590
- (Take1Func) cmd_passenger_spawn_method,
591
- NULL,
592
- RSRC_CONF,
593
- "The spawn method to use."),
594
586
  AP_INIT_TAKE1("PassengerBaseURI",
595
587
  (Take1Func) cmd_passenger_base_uri,
596
588
  NULL,
597
589
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
598
590
  "Declare the given base URI as belonging to an application."),
599
- AP_INIT_TAKE1("PassengerMaxPreloaderIdleTime",
600
- (Take1Func) cmd_passenger_max_preloader_idle_time,
601
- NULL,
602
- RSRC_CONF,
603
- "The maximum number of seconds that a preloader process may be idle before it is shutdown."),
604
- AP_INIT_TAKE1("UnionStationGatewayAddress",
605
- (Take1Func) cmd_union_station_gateway_address,
606
- NULL,
607
- RSRC_CONF,
608
- "The Union Station Gateway host name."),
609
- AP_INIT_TAKE1("UnionStationGatewayPort",
610
- (Take1Func) cmd_union_station_gateway_port,
611
- NULL,
612
- RSRC_CONF,
613
- "The Union Station Gateway port number."),
614
- AP_INIT_TAKE1("UnionStationGatewayCert",
615
- (Take1Func) cmd_union_station_gateway_cert,
616
- NULL,
617
- RSRC_CONF,
618
- "The Union Station Gateway certificate."),
619
- AP_INIT_TAKE1("UnionStationProxyAddress",
620
- (Take1Func) cmd_union_station_proxy_address,
621
- NULL,
622
- RSRC_CONF,
623
- "The address of the proxy that should be used for sending data to Union Station."),
624
- AP_INIT_TAKE1("PassengerAnalyticsLogUser",
625
- (Take1Func) cmd_passenger_analytics_log_user,
626
- NULL,
627
- RSRC_CONF,
628
- "The owner of analytics files."),
629
- AP_INIT_TAKE1("PassengerAnalyticsLogGroup",
630
- (Take1Func) cmd_passenger_analytics_log_group,
631
- NULL,
632
- RSRC_CONF,
633
- "The group of analytics files."),
634
- AP_INIT_TAKE1("PassengerPreStart",
635
- (Take1Func) cmd_passenger_pre_start,
636
- NULL,
637
- RSRC_CONF,
638
- "Prestart the given web applications during startup."),
639
591
  AP_INIT_FLAG("UnionStationSupport",
640
592
  (Take1Func) cmd_union_station_support,
641
593
  NULL,
642
594
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
643
595
  "Whether to enable logging through Union Station."),
644
-
596
+
645
597
  /*****************************/
646
598
  AP_INIT_TAKE1("PassengerMemoryLimit",
647
599
  (Take1Func) cmd_passenger_enterprise_only,