passenger 5.0.6 → 5.0.7

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 (74) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +26 -0
  5. data/Rakefile +0 -1
  6. data/bin/passenger-install-apache2-module +46 -12
  7. data/bin/passenger-status +6 -3
  8. data/build/packaging.rb +9 -1
  9. data/dev/ci/run_travis.sh +0 -36
  10. data/doc/ServerOptimizationGuide.html +12 -11
  11. data/doc/ServerOptimizationGuide.txt.md +12 -11
  12. data/doc/Users guide Apache.html +81 -75
  13. data/doc/Users guide Apache.idmap.txt +15 -13
  14. data/doc/Users guide Apache.txt +9 -1
  15. data/doc/Users guide Nginx.html +81 -76
  16. data/doc/Users guide Nginx.idmap.txt +15 -13
  17. data/doc/Users guide Nginx.txt +8 -0
  18. data/doc/Users guide Standalone.html +183 -24
  19. data/doc/Users guide Standalone.idmap.txt +19 -11
  20. data/doc/Users guide Standalone.txt +4 -0
  21. data/doc/users_guide_snippets/environment_variables.txt +2 -1
  22. data/doc/users_guide_snippets/installation.txt +15 -2
  23. data/doc/users_guide_snippets/tips.txt +19 -31
  24. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +7 -0
  25. data/ext/apache2/ConfigurationCommands.cpp +7 -0
  26. data/ext/apache2/ConfigurationFields.hpp +2 -0
  27. data/ext/apache2/ConfigurationSetters.cpp +8 -0
  28. data/ext/apache2/CreateDirConfig.cpp +1 -0
  29. data/ext/apache2/MergeDirConfig.cpp +7 -0
  30. data/ext/apache2/SetHeaders.cpp +5 -0
  31. data/ext/common/ApplicationPool2/Options.h +9 -0
  32. data/ext/common/Constants.h +3 -1
  33. data/ext/common/Logging.cpp +2 -2
  34. data/ext/common/ServerKit/HttpHeaderParser.h +13 -1
  35. data/ext/common/ServerKit/Implementation.cpp +7 -1
  36. data/ext/common/agents/Base.cpp +1 -1
  37. data/ext/common/agents/HelperAgent/OptionParser.h +15 -0
  38. data/ext/common/agents/HelperAgent/RequestHandler.h +3 -1
  39. data/ext/common/agents/HelperAgent/RequestHandler/BufferBody.cpp +3 -3
  40. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +12 -1
  41. data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +7 -3
  42. data/ext/common/agents/HelperAgent/ResponseCache.h +7 -1
  43. data/ext/common/agents/LoggingAgent/Main.cpp +4 -1
  44. data/ext/nginx/CacheLocationConfig.c +20 -0
  45. data/ext/nginx/Configuration.c +7 -0
  46. data/ext/nginx/ConfigurationCommands.c +10 -0
  47. data/ext/nginx/ConfigurationFields.h +2 -0
  48. data/ext/nginx/ContentHandler.c +10 -0
  49. data/ext/nginx/CreateLocationConfig.c +5 -0
  50. data/ext/nginx/MergeLocationConfig.c +6 -0
  51. data/helper-scripts/meteor-loader.rb +15 -2
  52. data/helper-scripts/rack-loader.rb +2 -6
  53. data/helper-scripts/rack-preloader.rb +1 -5
  54. data/lib/phusion_passenger.rb +3 -3
  55. data/lib/phusion_passenger/apache2/config_options.rb +5 -0
  56. data/lib/phusion_passenger/config/command.rb +9 -0
  57. data/lib/phusion_passenger/config/install_standalone_runtime_command.rb +4 -0
  58. data/lib/phusion_passenger/config/validate_install_command.rb +478 -46
  59. data/lib/phusion_passenger/constants.rb +1 -0
  60. data/lib/phusion_passenger/loader_shared_helpers.rb +26 -3
  61. data/lib/phusion_passenger/nginx/config_options.rb +4 -0
  62. data/lib/phusion_passenger/packaging.rb +0 -8
  63. data/lib/phusion_passenger/platform_info/apache.rb +40 -28
  64. data/lib/phusion_passenger/platform_info/apache_detector.rb +29 -3
  65. data/lib/phusion_passenger/rack/thread_handler_extension.rb +12 -7
  66. data/lib/phusion_passenger/request_handler/thread_handler.rb +5 -0
  67. data/lib/phusion_passenger/standalone/start_command.rb +46 -5
  68. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +5 -3
  69. data/resources/templates/apache2/config_snippets.txt.erb +1 -1
  70. data/resources/templates/apache2/run_installer_as_root_for_apache_analysis.txt.erb +9 -0
  71. data/resources/templates/standalone/config.erb +16 -1
  72. metadata +3 -3
  73. metadata.gz.asc +7 -7
  74. data/build/debian.rb +0 -213
@@ -138,29 +138,31 @@
138
138
 
139
139
  7.3.3. passenger_nodejs <filename> => passenger-nodejs-filename--16hzjsv
140
140
 
141
- 7.3.4. passenger_app_env <string> => passenger-app-env-string--qjeimp
141
+ 7.3.4. passenger_meteor_app_settings <filename> => passenger-meteor-app-settings-filename--1toqnaz
142
142
 
143
- 7.3.5. rails_env <string> => rails-env-string--jlh7v9
143
+ 7.3.5. passenger_app_env <string> => passenger-app-env-string--qjeimp
144
144
 
145
- 7.3.6. rack_env <string> => rack-env-string--tqmrt0
145
+ 7.3.6. rails_env <string> => rails-env-string--jlh7v9
146
146
 
147
- 7.3.7. passenger_app_root <path/to/root> => passenger-app-root-path-to-root--1dbudc6
147
+ 7.3.7. rack_env <string> => rack-env-string--tqmrt0
148
148
 
149
- 7.3.8. passenger_app_group_name <name> => passenger-app-group-name-name--11jrx8u
149
+ 7.3.8. passenger_app_root <path/to/root> => passenger-app-root-path-to-root--1dbudc6
150
150
 
151
- 7.3.9. passenger_app_type <name> => passenger-app-type-name--g9zccv
151
+ 7.3.9. passenger_app_group_name <name> => passenger-app-group-name-name--11jrx8u
152
152
 
153
- 7.3.10. passenger_startup_file <filename> => passenger-startup-file-filename--y4gy1m
153
+ 7.3.10. passenger_app_type <name> => passenger-app-type-name--g9zccv
154
154
 
155
- 7.3.11. passenger_spawn_method <string> => passenger-spawn-method-string--1sc6njl
155
+ 7.3.11. passenger_startup_file <filename> => passenger-startup-file-filename--y4gy1m
156
156
 
157
- 7.3.12. passenger_env_var <name> <value> => passenger-env-var-name-value--y8e7wh
157
+ 7.3.12. passenger_spawn_method <string> => passenger-spawn-method-string--1sc6njl
158
158
 
159
- 7.3.13. passenger_load_shell_envvars <on|off> => passenger-load-shell-envvars-on-off--fw5u4l
159
+ 7.3.13. passenger_env_var <name> <value> => passenger-env-var-name-value--y8e7wh
160
160
 
161
- 7.3.14. passenger_rolling_restarts <on|off> => passenger-rolling-restarts
161
+ 7.3.14. passenger_load_shell_envvars <on|off> => passenger-load-shell-envvars-on-off--fw5u4l
162
162
 
163
- 7.3.15. passenger_resist_deployment_errors <on|off> => passenger-resist-deployment-errors-on-off--k9yf1
163
+ 7.3.15. passenger_rolling_restarts <on|off> => passenger-rolling-restarts
164
+
165
+ 7.3.16. passenger_resist_deployment_errors <on|off> => passenger-resist-deployment-errors-on-off--k9yf1
164
166
 
165
167
  7.4. Security options => security-options-1bv93g4
166
168
 
@@ -312,7 +314,7 @@
312
314
 
313
315
  10.2. Copy-on-write memory support (reducing memory consumption of Ruby applications) => reducing-memory-consumption-of-ruby-on-rails-applications-by-33--1o3z66q
314
316
 
315
- 10.3. Capistrano recipe => capistrano-recipe-pfn4qu
317
+ 10.3. Tuning for Server Sent Events and WebSockets => tuning-for-server-sent-events-and-websockets-8ec9td
316
318
 
317
319
  10.4. Bundler support => bundler-support-19v1h43
318
320
 
@@ -568,6 +568,14 @@ include::users_guide_snippets/since_version.txt[]
568
568
 
569
569
  This option allows one to specify the Node.js command to use. See <<PassengerRuby,passenger_ruby>> for more information. The default value is 'node', meaning that the Node.js command will be looked up according to the `PATH` environment variable.
570
570
 
571
+ ==== passenger_meteor_app_settings <filename>
572
+ :version: 5.0.7
573
+ include::users_guide_snippets/since_version.txt[]
574
+
575
+ When using a Meteor application in non-bundled mode, use this option to specify a (JSON) file with settings for the application. Meteor will be started with the `--settings` parameter set to this option.
576
+
577
+ N.B. For bundled mode, Meteor requires you to put applications settings in the `METEOR_SETTINGS` environment variable.
578
+
571
579
  [[PassengerAppEnv]]
572
580
  ==== passenger_app_env <string>
573
581
  This option sets the value of the following environment variables:
@@ -1138,17 +1138,21 @@ pre {
1138
1138
  <div class="foo toclevel3"><a href="#_generic_troubleshooting_tips">7.1. Generic troubleshooting tips</a></div>
1139
1139
  <div class="foo toclevel3"><a href="#_upon_uploading_a_file_phusion_passenger_reports_client_body_temp_00000000xx_failed_2_no_such_file_or_directory">7.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)"</a></div>
1140
1140
  <div class="foo toclevel3"><a href="#_i_get_command_not_found_when_running_a_phusion_passenger_command_through_sudo">7.3. I get "command not found" when running a Phusion Passenger command through sudo</a></div>
1141
- <div class="foo toclevel2"><a href="#about_environment_variables">8. Appendix: About environment variables</a></div>
1142
- <div class="foo toclevel3"><a href="#_working_with_environment_variables">8.1. Working with environment variables</a></div>
1143
- <div class="foo toclevel3"><a href="#the_path_env_var">8.2. The PATH environment variable</a></div>
1144
- <div class="foo toclevel4"><a href="#_adding_phusion_passenger_8217_s_administration_tools_to_path">8.2.1. Adding Phusion Passenger’s administration tools to PATH</a></div>
1145
- <div class="foo toclevel3"><a href="#_making_environment_variables_permanent">8.3. Making environment variables permanent</a></div>
1146
- <div class="foo toclevel4"><a href="#_bash">8.3.1. bash</a></div>
1147
- <div class="foo toclevel4"><a href="#_apache">8.3.2. Apache</a></div>
1148
- <div class="foo toclevel4"><a href="#_nginx">8.3.3. Nginx</a></div>
1149
- <div class="foo toclevel4"><a href="#_cron">8.3.4. cron</a></div>
1150
- <div class="foo toclevel4"><a href="#env_vars_passenger_apps">8.3.5. Phusion Passenger-served apps</a></div>
1151
- <div class="foo toclevel3"><a href="#env_vars_and_sudo">8.4. Environment variables and sudo</a></div>
1141
+ <div class="foo toclevel2"><a href="#_under_the_hood">8. Under the hood</a></div>
1142
+ <div class="foo toclevel3"><a href="#relationship_with_ruby">8.1. Phusion Passenger and its relationship with Ruby</a></div>
1143
+ <div class="foo toclevel4"><a href="#_how_ruby_is_used">8.1.1. How Ruby is used</a></div>
1144
+ <div class="foo toclevel4"><a href="#_when_the_system_has_multiple_ruby_interpreters">8.1.2. When the system has multiple Ruby interpreters</a></div>
1145
+ <div class="foo toclevel2"><a href="#about_environment_variables">9. Appendix: About environment variables</a></div>
1146
+ <div class="foo toclevel3"><a href="#_working_with_environment_variables">9.1. Working with environment variables</a></div>
1147
+ <div class="foo toclevel3"><a href="#the_path_env_var">9.2. The PATH environment variable</a></div>
1148
+ <div class="foo toclevel4"><a href="#_adding_phusion_passenger_8217_s_administration_tools_to_path">9.2.1. Adding Phusion Passenger’s administration tools to PATH</a></div>
1149
+ <div class="foo toclevel3"><a href="#_making_environment_variables_permanent">9.3. Making environment variables permanent</a></div>
1150
+ <div class="foo toclevel4"><a href="#_bash">9.3.1. bash</a></div>
1151
+ <div class="foo toclevel4"><a href="#_apache">9.3.2. Apache</a></div>
1152
+ <div class="foo toclevel4"><a href="#_nginx">9.3.3. Nginx</a></div>
1153
+ <div class="foo toclevel4"><a href="#_cron">9.3.4. cron</a></div>
1154
+ <div class="foo toclevel4"><a href="#env_vars_passenger_apps">9.3.5. Phusion Passenger-served apps</a></div>
1155
+ <div class="foo toclevel3"><a href="#env_vars_and_sudo">9.4. Environment variables and sudo</a></div>
1152
1156
  </div>
1153
1157
  </div>
1154
1158
  <div id="content">
@@ -1467,6 +1471,25 @@ sudo apt-get update</pre>
1467
1471
  </div>
1468
1472
  </div>
1469
1473
  </li>
1474
+ <li>
1475
+ <p>
1476
+ (Optional) If using <span class="monospaced">unattended-upgrades</span>, add our APT repository to the list of <span class="monospaced">Allowed-Origins</span> for upgrades, <span class="monospaced">/etc/apt/apt.conf.d/50unattended-upgrades</span>:
1477
+ </p>
1478
+ <div class="listingblock">
1479
+ <div class="content">
1480
+ <!-- Generator: GNU source-highlight 2.11.1
1481
+ by Lorenzo Bettini
1482
+ http://www.lorenzobettini.it
1483
+ http://www.gnu.org/software/src-highlite -->
1484
+ <pre><tt><span style="color: #990000">//</span> Automatically upgrade packages from these <span style="color: #990000">(</span>origin<span style="color: #990000">:</span>archive<span style="color: #990000">)</span> pairs
1485
+ Unattended-Upgrade<span style="color: #990000">::</span>Allowed-Origins {
1486
+ <span style="color: #990000">//</span> To check <span style="color: #FF0000">"Origin:"</span> and <span style="color: #FF0000">"Suite:"</span><span style="color: #990000">,</span> you could use e<span style="color: #990000">.</span>g<span style="color: #990000">.:</span>
1487
+ <span style="color: #990000">//</span> grep <span style="color: #FF0000">"Origin</span><span style="color: #CC33CC">\|</span><span style="color: #FF0000">Suite"</span> /var/lib/apt/lists/oss-binaries<span style="color: #990000">.</span>phusionpassenger<span style="color: #990000">.</span>com<span style="color: #990000">*</span>
1488
+ <span style="color: #FF0000">"Phusion:stable"</span><span style="color: #990000">;</span>
1489
+ }<span style="color: #990000">;</span></tt></pre>
1490
+ </div>
1491
+ </div>
1492
+ </li>
1470
1493
  </ol></div>
1471
1494
  </div>
1472
1495
  <div class="sect3">
@@ -1522,6 +1545,7 @@ Install the packages:
1522
1545
  </ol></div>
1523
1546
  </dd>
1524
1547
  </dl></div>
1548
+ <div class="paragraph"><p>You can now proceed with a chapter for Deploying your (specific type of) application.</p></div>
1525
1549
  </div>
1526
1550
  </div>
1527
1551
  <div class="sect2">
@@ -2892,7 +2916,141 @@ $ rvmsudo /somewhere/bin/passenger-status</pre>
2892
2916
  </div>
2893
2917
  </div>
2894
2918
  <div class="sect1">
2895
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="about_environment_variables"></span><h2 data-comment-topic="appendix-about-environment-variables-1ct91x3" data-anchor="about_environment_variables">8. Appendix: About environment variables</h2>
2919
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_under_the_hood"></span><h2 data-comment-topic="under-the-hood-ub7j3q" data-anchor="_under_the_hood">8. Under the hood</h2>
2920
+ <div class="sectionbody">
2921
+ <div class="sect2">
2922
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="relationship_with_ruby"></span><h3 data-comment-topic="phusion-passenger-and-its-relationship-with-ruby-1usvd0o" data-anchor="relationship_with_ruby">8.1. Phusion Passenger and its relationship with Ruby</h3>
2923
+ <div class="sect3">
2924
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_how_ruby_is_used"></span><h4 data-comment-topic="how-ruby-is-used-1saha86" data-anchor="_how_ruby_is_used">8.1.1. How Ruby is used</h4>
2925
+ <div class="paragraph"><p>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.</p></div>
2926
+ <div class="ulist"><ul>
2927
+ <li>
2928
+ <p>
2929
+ Phusion Passenger’s installer, build system and administration tools are written in Ruby.
2930
+ </p>
2931
+ </li>
2932
+ <li>
2933
+ <p>
2934
+ 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
2935
+ <a href="#PassengerPreStart">passenger_pre_start</a>)
2936
+ </p>
2937
+ </li>
2938
+ </ul></div>
2939
+ <div class="paragraph"><p>are written in Ruby as well.
2940
+ * Ruby web application support is implemented in Ruby.
2941
+ * If you use <a href="#flying_passenger">Flying Passenger</a>, 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<span class="monospaced"> core.
2942
+ * If you use <a href="Users%20guide%20Standalone.html">Phusion Passenger Standalone</a>, then the frontend (the <span class="monospaced">passenger</span> command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C</span> core.</p></div>
2943
+ <div class="paragraph"><p>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.</p></div>
2944
+ </div>
2945
+ <div class="sect3">
2946
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_when_the_system_has_multiple_ruby_interpreters"></span><h4 data-comment-topic="when-the-system-has-multiple-ruby-interpreters-acf6d" data-anchor="_when_the_system_has_multiple_ruby_interpreters">8.1.2. When the system has multiple Ruby interpreters</h4>
2947
+ <div class="paragraph"><p>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.</p></div>
2948
+ <div class="paragraph"><p>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.</p></div>
2949
+ <div class="paragraph"><p>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
2950
+ <a href="#PassengerRuby">passenger_ruby</a>
2951
+ directive to learn how run different web applications under different Ruby interpreters.</p></div>
2952
+ <div class="paragraph">
2953
+ <div class="title">Caveat: RVM and RVM gemsets</div>
2954
+ <p>There is however one caveat if you happen to be using RVM or RVM gemsets. When you <span class="monospaced">gem install</span> Phusion Passenger using RVM, then RVM will install Phusion Passenger into the <strong>currently active RVM Ruby and gemset</strong>. This means that Phusion Passenger commands - such as <span class="monospaced">passenger</span>, <span class="monospaced">passenger-install-xxx-module</span> and <span class="monospaced">passenger-status</span> - 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 <span class="monospaced">command not found</span> error. Here’s an example which demonstrates the problem.</p>
2955
+ </div>
2956
+ <div class="listingblock">
2957
+ <div class="title">"Command not found" problem demonstration</div>
2958
+ <div class="content">
2959
+ <!-- Generator: GNU source-highlight 2.11.1
2960
+ by Lorenzo Bettini
2961
+ http://www.lorenzobettini.it
2962
+ http://www.gnu.org/software/src-highlite -->
2963
+ <pre><tt><span style="font-style: italic"><span style="color: #9A1900">## Install Phusion Passenger (open source edition) using Ruby 1.9.3</span></span>
2964
+ <span style="font-style: italic"><span style="color: #9A1900">## and the 'business' gemset</span></span>
2965
+ $ rvm use <span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>
2966
+ Using /home/phusion<span style="color: #990000">/.</span>rvm/gems/ruby-<span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>-p<span style="color: #993399">429</span>
2967
+ $ rvm gemset create business
2968
+ $ rvm gemset use business
2969
+ Using ruby-<span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>-p<span style="color: #993399">429</span> with gemset business
2970
+ $ curl -O https<span style="color: #990000">:</span>//s<span style="color: #993399">3</span><span style="color: #990000">.</span>amazonaws<span style="color: #990000">.</span>com/phusion-passenger/releases/gem_bootstrap<span style="color: #990000">.</span>sh
2971
+ $ <span style="font-weight: bold"><span style="color: #0000FF">eval</span></span> <span style="color: #FF0000">"`sh gem_bootstrap.sh`"</span>
2972
+ $ gem install passenger
2973
+
2974
+ <span style="font-style: italic"><span style="color: #9A1900">## Verify that passenger works</span></span>
2975
+ $ passenger --version
2976
+ Phusion Passenger version <span style="color: #993399">4.0</span><span style="color: #990000">.</span><span style="color: #993399">14</span>
2977
+
2978
+ <span style="font-style: italic"><span style="color: #9A1900">## Switch to a different RVM gemset. You will get a `command not found`</span></span>
2979
+ $ rvm gemset use default
2980
+ Using ruby-<span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>-p<span style="color: #993399">429</span> with gemset default
2981
+ $ passenger --version
2982
+ bash<span style="color: #990000">:</span> passenger<span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">command</span></span> not found
2983
+
2984
+ <span style="font-style: italic"><span style="color: #9A1900">## Switch to a different Ruby interpreter. You will also get</span></span>
2985
+ <span style="font-style: italic"><span style="color: #9A1900">## a `command not found`</span></span>
2986
+ $ rvm use <span style="color: #993399">2.0</span><span style="color: #990000">.</span><span style="color: #993399">0</span>
2987
+ Using /home/phusion<span style="color: #990000">/.</span>rvm/gems/ruby-<span style="color: #993399">2.0</span><span style="color: #990000">.</span><span style="color: #993399">0</span>-p<span style="color: #993399">195</span>
2988
+ $ passenger --version
2989
+ bash<span style="color: #990000">:</span> passenger<span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">command</span></span> not found
2990
+
2991
+ <span style="font-style: italic"><span style="color: #9A1900">## Switch back to the Ruby and gemset that you installed Phusion</span></span>
2992
+ <span style="font-style: italic"><span style="color: #9A1900">## Passenger with, and verify that it works again</span></span>
2993
+ $ rvm use <span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>
2994
+ Using /home/phusion<span style="color: #990000">/.</span>rvm/gems/ruby-<span style="color: #993399">2.0</span><span style="color: #990000">.</span><span style="color: #993399">0</span>-p<span style="color: #993399">195</span>
2995
+ $ rvm gemset use business
2996
+ Using ruby-<span style="color: #993399">1.9</span><span style="color: #990000">.</span><span style="color: #993399">3</span>-p<span style="color: #993399">429</span> with gemset business
2997
+ $ passenger --version
2998
+ Phusion Passenger version <span style="color: #993399">4.0</span><span style="color: #990000">.</span><span style="color: #993399">14</span></tt></pre>
2999
+ </div>
3000
+ </div>
3001
+ <div class="paragraph">
3002
+ <div class="title">Solutions</div>
3003
+ <p>There are several ways to solve this problem:</p>
3004
+ </div>
3005
+ <div class="olist arabic"><ol class="arabic">
3006
+ <li>
3007
+ <p>
3008
+ 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 <a href="#about_environment_variable">About environment variables</a> first.
3009
+ </p>
3010
+ <div class="paragraph"><p>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.</p></div>
3011
+ <div class="paragraph"><p>First, identify the location of the Phusion Passenger command directory, like this:</p></div>
3012
+ <div class="listingblock">
3013
+ <div class="content monospaced">
3014
+ <pre>$ echo `passenger-config --root`/bin
3015
+ /home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin</pre>
3016
+ </div>
3017
+ </div>
3018
+ <div class="paragraph"><p>Next, add the directory that you’ve found to your current shell’s PATH:</p></div>
3019
+ <div class="listingblock">
3020
+ <div class="content monospaced">
3021
+ <pre>$ export PATH=/home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin:$PATH</pre>
3022
+ </div>
3023
+ </div>
3024
+ <div class="paragraph"><p>Finally, make the change permanent by appending the above command to your bash startup file:</p></div>
3025
+ <div class="listingblock">
3026
+ <div class="content monospaced">
3027
+ <pre>$ echo 'export PATH=/home/phusion/.rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.15/bin:$PATH' &gt;&gt; ~/.bashrc</pre>
3028
+ </div>
3029
+ </div>
3030
+ </li>
3031
+ <li>
3032
+ <p>
3033
+ Switch back to the RVM Ruby and gemset that you installed Phusion Passenger with, before running any Phusion Passenger command.
3034
+ </p>
3035
+ </li>
3036
+ <li>
3037
+ <p>
3038
+ Prepend any Phusion Passenger command with <span class="monospaced">rvm-exec RUBY_NAME@GEMSET_NAME ruby -S</span>. If the relevant Phusion Passenger command also needs root privileges, then prepend <span class="monospaced">rvmsudo</span> before that. For example:
3039
+ </p>
3040
+ <div class="listingblock">
3041
+ <div class="content monospaced">
3042
+ <pre>rvm-exec 1.9.3@business ruby -S passenger --version
3043
+ rvmsudo rvm-exec 1.9.3@business ruby -S passenger-install-apache2-module</pre>
3044
+ </div>
3045
+ </div>
3046
+ </li>
3047
+ </ol></div>
3048
+ </div>
3049
+ </div>
3050
+ </div>
3051
+ </div>
3052
+ <div class="sect1">
3053
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="about_environment_variables"></span><h2 data-comment-topic="appendix-about-environment-variables-1ct91x3" data-anchor="about_environment_variables">9. Appendix: About environment variables</h2>
2896
3054
  <div class="sectionbody">
2897
3055
  <div class="paragraph"><p>Environment variables are named values that affect how the system works. For example they tell the system where to look for commands (the <span class="monospaced">PATH</span> variable) or where to look for libraries (<span class="monospaced">LD_LIBRARY_PATH</span>). Their names are often in all-uppercase. Sometimes people refer to an environment variable with a dollar sign <span class="monospaced">$</span> in front, but that’s the same thing: when people say "the $PATH environment variable" they mean "the PATH environment variable". This is because the dollar sign <span class="monospaced">$</span> is a shell syntax for refering to an environment variable, as you will learn later.</p></div>
2898
3056
  <div class="paragraph"><p>Environment variables are set on a <strong>per-process</strong> basis, but they are <strong>inherited</strong> by child processes. This means that if you set environment variables in process A, another already running process B will not see these new environment variables. But if A spawns a child process C, then C will have all environment variables that A had. If you once again change the environment variables in A, then C will not see the changes.</p></div>
@@ -2923,7 +3081,7 @@ $ rvmsudo /somewhere/bin/passenger-status</pre>
2923
3081
  </tr></table>
2924
3082
  </div>
2925
3083
  <div class="sect2">
2926
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_working_with_environment_variables"></span><h3 data-comment-topic="working-with-environment-variables-11cmwlv" data-anchor="_working_with_environment_variables">8.1. Working with environment variables</h3>
3084
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_working_with_environment_variables"></span><h3 data-comment-topic="working-with-environment-variables-11cmwlv" data-anchor="_working_with_environment_variables">9.1. Working with environment variables</h3>
2927
3085
  <div class="paragraph"><p>You can see all environment variables in your shell by running the following command:</p></div>
2928
3086
  <div class="listingblock">
2929
3087
  <div class="content">
@@ -3005,7 +3163,7 @@ http://www.gnu.org/software/src-highlite -->
3005
3163
  </div>
3006
3164
  </div>
3007
3165
  <div class="sect2">
3008
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="the_path_env_var"></span><h3 data-comment-topic="the-path-environment-variable-yzfn3k" data-anchor="the_path_env_var">8.2. The PATH environment variable</h3>
3166
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="the_path_env_var"></span><h3 data-comment-topic="the-path-environment-variable-yzfn3k" data-anchor="the_path_env_var">9.2. The PATH environment variable</h3>
3009
3167
  <div class="paragraph"><p>The <span class="monospaced">PATH</span> environment variable dictates where the system looks for command. It is a colon-separated list of directories. If you get a "command not found" error while you know that the command is installed, then setting <span class="monospaced">PATH</span> will help. For example suppose that the command <span class="monospaced">frobnicator</span> is in <span class="monospaced">/opt/local/bin</span>:</p></div>
3010
3168
  <div class="listingblock">
3011
3169
  <div class="content">
@@ -3052,7 +3210,7 @@ user@localhost bash$ frobnicator
3052
3210
  </div>
3053
3211
  </div>
3054
3212
  <div class="sect3">
3055
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_phusion_passenger_8217_s_administration_tools_to_path"></span><h4 data-comment-topic="adding-phusion-passenger-s-administration-tools-to-path-d7k5mh" data-anchor="_adding_phusion_passenger_8217_s_administration_tools_to_path">8.2.1. Adding Phusion Passenger’s administration tools to PATH</h4>
3213
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_phusion_passenger_8217_s_administration_tools_to_path"></span><h4 data-comment-topic="adding-phusion-passenger-s-administration-tools-to-path-d7k5mh" data-anchor="_adding_phusion_passenger_8217_s_administration_tools_to_path">9.2.1. Adding Phusion Passenger’s administration tools to PATH</h4>
3056
3214
  <div class="paragraph"><p>If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. <span class="monospaced">passenger-status</span> or <span class="monospaced">passenger-memory-stats</span> then that means the tools are not in <span class="monospaced">PATH</span>, so you need to add them.</p></div>
3057
3215
  <div class="ulist"><ul>
3058
3216
  <li>
@@ -3122,10 +3280,10 @@ $ sudo find . -name passenger-status
3122
3280
  </div>
3123
3281
  </div>
3124
3282
  <div class="sect2">
3125
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-mkq46d" data-anchor="_making_environment_variables_permanent">8.3. Making environment variables permanent</h3>
3283
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-mkq46d" data-anchor="_making_environment_variables_permanent">9.3. Making environment variables permanent</h3>
3126
3284
  <div class="paragraph"><p>When you exit your shell, the evironment variable changes are lost. There is no standard method to set environment variables system-wide, so you have to set them in different configuration files for different services.</p></div>
3127
3285
  <div class="sect3">
3128
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_bash"></span><h4 data-comment-topic="bash-hmcscc" data-anchor="_bash">8.3.1. bash</h4>
3286
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_bash"></span><h4 data-comment-topic="bash-hmcscc" data-anchor="_bash">9.3.1. bash</h4>
3129
3287
  <div class="paragraph"><p>To make environment variables permanent for future bash sessions <strong>for the current user</strong>, add them to your <span class="monospaced">~/.bashrc</span>:</p></div>
3130
3288
  <div class="listingblock">
3131
3289
  <div class="content">
@@ -3143,12 +3301,13 @@ echo <span style="color: #FF0000">'export PATH=/usr/local/bin:$PATH'</span> <spa
3143
3301
  <td class="icon">
3144
3302
  <img src="./images/icons/note.png" alt="Note">
3145
3303
  </td>
3146
- <td class="content">Depending on the system, the bashrc file may have a different filename. On Debian and Ubuntu, it’s <span class="monospaced">/etc/bash.bashrc</span>.</td>
3304
+ <td class="content">Depending on the system, the bashrc file may have a different filename. On Debian and Ubuntu, it’s <span class="monospaced">/etc/bash.bashrc</span>.
3305
+ NOTE: Make sure your <span class="monospaced">~/.bashrc</span> is actually included by your <span class="monospaced">~/.profile</span>, which might not be the case if you created the user with <span class="monospaced">useradd</span> instead of <span class="monospaced">adduser</span> for example</td>
3147
3306
  </tr></table>
3148
3307
  </div>
3149
3308
  </div>
3150
3309
  <div class="sect3">
3151
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_apache"></span><h4 data-comment-topic="apache-15y3bm0" data-anchor="_apache">8.3.2. Apache</h4>
3310
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_apache"></span><h4 data-comment-topic="apache-15y3bm0" data-anchor="_apache">9.3.2. Apache</h4>
3152
3311
  <div class="admonitionblock">
3153
3312
  <table><tr>
3154
3313
  <td class="icon">
@@ -3163,7 +3322,7 @@ echo <span style="color: #FF0000">'export PATH=/usr/local/bin:$PATH'</span> <spa
3163
3322
  <div class="paragraph"><p>On other systems, or if you did not install Apache through the system’s package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.</p></div>
3164
3323
  </div>
3165
3324
  <div class="sect3">
3166
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_nginx"></span><h4 data-comment-topic="nginx-uarf27" data-anchor="_nginx">8.3.3. Nginx</h4>
3325
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_nginx"></span><h4 data-comment-topic="nginx-uarf27" data-anchor="_nginx">9.3.3. Nginx</h4>
3167
3326
  <div class="admonitionblock">
3168
3327
  <table><tr>
3169
3328
  <td class="icon">
@@ -3185,7 +3344,7 @@ then you should edit that script to define the environment variables. Those init
3185
3344
  </div>
3186
3345
  </div>
3187
3346
  <div class="sect3">
3188
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_cron"></span><h4 data-comment-topic="cron-6272ar" data-anchor="_cron">8.3.4. cron</h4>
3347
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_cron"></span><h4 data-comment-topic="cron-6272ar" data-anchor="_cron">9.3.4. cron</h4>
3189
3348
  <div class="paragraph"><p>To make environment variables permanent for cron jobs, add those variables to the relevant crontab. But note that inside crontabs you cannot refer to existing environment variables with the <span class="monospaced">$</span> syntax because crontabs are not shell scripts. You have to specify the entire value.</p></div>
3190
3349
  <div class="listingblock">
3191
3350
  <div class="title">What to put in "crontab -e"</div>
@@ -3208,7 +3367,7 @@ PATH=/usr/bin:/usr/local/bin
3208
3367
  </div>
3209
3368
  </div>
3210
3369
  <div class="sect3">
3211
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_passenger_apps"></span><h4 data-comment-topic="phusion-passenger-served-apps-127wbl2" data-anchor="env_vars_passenger_apps">8.3.5. Phusion Passenger-served apps</h4>
3370
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_passenger_apps"></span><h4 data-comment-topic="phusion-passenger-served-apps-127wbl2" data-anchor="env_vars_passenger_apps">9.3.5. Phusion Passenger-served apps</h4>
3212
3371
  <div class="paragraph"><p>You can pass environment variables to Phusion Passenger-served apps through various methods:</p></div>
3213
3372
  <div class="ulist"><ul>
3214
3373
  <li>
@@ -3218,7 +3377,7 @@ When running Apache, use the <span class="monospaced">PassEnv</span> and <span c
3218
3377
  </li>
3219
3378
  <li>
3220
3379
  <p>
3221
- When running Nginx, use the <a href="#passenger_env_var">passenger_env_var</a> directive.
3380
+ When running Nginx, use the <a href="#PassengerEnvVar">passenger_env_var</a> directive.
3222
3381
  </p>
3223
3382
  </li>
3224
3383
  <li>
@@ -3260,7 +3419,7 @@ os<span style="color: #990000">.</span>environ<span style="color: #990000">[</sp
3260
3419
  </div>
3261
3420
  </div>
3262
3421
  <div class="sect2">
3263
- <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_and_sudo"></span><h3 data-comment-topic="environment-variables-and-sudo-znzmif" data-anchor="env_vars_and_sudo">8.4. Environment variables and sudo</h3>
3422
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="env_vars_and_sudo"></span><h3 data-comment-topic="environment-variables-and-sudo-znzmif" data-anchor="env_vars_and_sudo">9.4. Environment variables and sudo</h3>
3264
3423
  <div class="admonitionblock">
3265
3424
  <table><tr>
3266
3425
  <td class="icon">
@@ -96,25 +96,33 @@
96
96
 
97
97
  7.3. I get "command not found" when running a Phusion Passenger command through sudo => i-get-command-not-found-when-running-a-phusion-passenger-command-through-sudo-14k8kde
98
98
 
99
- 8. Appendix: About environment variables => appendix-about-environment-variables-1ct91x3
99
+ 8. Under the hood => under-the-hood-ub7j3q
100
100
 
101
- 8.1. Working with environment variables => working-with-environment-variables-11cmwlv
101
+ 8.1. Phusion Passenger and its relationship with Ruby => phusion-passenger-and-its-relationship-with-ruby-1usvd0o
102
102
 
103
- 8.2. The PATH environment variable => the-path-environment-variable-yzfn3k
103
+ 8.1.1. How Ruby is used => how-ruby-is-used-1saha86
104
104
 
105
- 8.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-d7k5mh
105
+ 8.1.2. When the system has multiple Ruby interpreters => when-the-system-has-multiple-ruby-interpreters-acf6d
106
106
 
107
- 8.3. Making environment variables permanent => making-environment-variables-permanent-mkq46d
107
+ 9. Appendix: About environment variables => appendix-about-environment-variables-1ct91x3
108
108
 
109
- 8.3.1. bash => bash-hmcscc
109
+ 9.1. Working with environment variables => working-with-environment-variables-11cmwlv
110
110
 
111
- 8.3.2. Apache => apache-15y3bm0
111
+ 9.2. The PATH environment variable => the-path-environment-variable-yzfn3k
112
112
 
113
- 8.3.3. Nginx => nginx-uarf27
113
+ 9.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-d7k5mh
114
114
 
115
- 8.3.4. cron => cron-6272ar
115
+ 9.3. Making environment variables permanent => making-environment-variables-permanent-mkq46d
116
116
 
117
- 8.3.5. Phusion Passenger-served apps => phusion-passenger-served-apps-127wbl2
117
+ 9.3.1. bash => bash-hmcscc
118
118
 
119
- 8.4. Environment variables and sudo => environment-variables-and-sudo-znzmif
119
+ 9.3.2. Apache => apache-15y3bm0
120
+
121
+ 9.3.3. Nginx => nginx-uarf27
122
+
123
+ 9.3.4. cron => cron-6272ar
124
+
125
+ 9.3.5. Phusion Passenger-served apps => phusion-passenger-served-apps-127wbl2
126
+
127
+ 9.4. Environment variables and sudo => environment-variables-and-sudo-znzmif
120
128
 
@@ -415,6 +415,10 @@ Any options that you pass to the `passenger` command will affect all deployed we
415
415
 
416
416
  include::users_guide_snippets/troubleshooting/default.txt[]
417
417
 
418
+ == Under the hood
419
+
420
+ include::users_guide_snippets/under_the_hood/relationship_with_ruby.txt[]
421
+
418
422
  [[about_environment_variables]]
419
423
  == Appendix: About environment variables
420
424
 
@@ -167,6 +167,7 @@ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
167
167
  To make them permanent for future bash sessions **for all users**, add them to `/etc/bashrc`.
168
168
 
169
169
  NOTE: Depending on the system, the bashrc file may have a different filename. On Debian and Ubuntu, it's `/etc/bash.bashrc`.
170
+ NOTE: Make sure your `~/.bashrc` is actually included by your `~/.profile`, which might not be the case if you created the user with `useradd` instead of `adduser` for example
170
171
 
171
172
  ==== Apache
172
173
 
@@ -225,7 +226,7 @@ PATH=/usr/bin:/usr/local/bin
225
226
  You can pass environment variables to Phusion Passenger-served apps through various methods:
226
227
 
227
228
  * When running Apache, use the `PassEnv` and `SetEnv` directives of link:http://httpd.apache.org/docs/2.4/mod/mod_env.html[mod_env]. This is supported starting from Phusion Passenger 4.0.
228
- * When running Nginx, use the <<passenger_env_var,passenger_env_var>> directive.
229
+ * When running Nginx, use the <<PassengerEnvVar,passenger_env_var>> directive.
229
230
  * Through your `bashrc`. Starting from version 4.0, Phusion Passenger 4.0 spawns applications through bash and inherit all bash environment variables. Phusion Passenger Standalone tends to be started from the shell and thus inherits all environment variables set by the shell.
230
231
  * Through Apache and Nginx, as described earlier in this chapter. Any environment variables that you set on Apache and Nginx itself are inherited by Phusion Passenger, and thus by Phusion Passenger-served apps as well.
231
232
  * Through the application itself. Most programming languages provide APIs for setting environment variables. For example in Ruby you can write:
@@ -124,6 +124,18 @@ sudo chmod 600 /etc/apt/sources.list.d/passenger.list
124
124
  sudo apt-get update
125
125
  --------------------------------------------------------------
126
126
 
127
+ 5. (Optional) If using `unattended-upgrades`, add our APT repository to the list of `Allowed-Origins` for upgrades, `/etc/apt/apt.conf.d/50unattended-upgrades`:
128
+ +
129
+ [source,sh]
130
+ --------------------------------------------------------------
131
+ // Automatically upgrade packages from these (origin:archive) pairs
132
+ Unattended-Upgrade::Allowed-Origins {
133
+ // To check "Origin:" and "Suite:", you could use e.g.:
134
+ // grep "Origin\|Suite" /var/lib/apt/lists/oss-binaries.phusionpassenger.com*
135
+ "Phusion:stable";
136
+ };
137
+ --------------------------------------------------------------
138
+
127
139
  ==== Installing packages
128
140
 
129
141
  ifdef::nginx[]
@@ -210,11 +222,13 @@ sudo apt-get install passenger-enterprise
210
222
  --------------------------------------------------------------
211
223
  endif::[]
212
224
 
225
+ You can now proceed with a chapter for Deploying your (specific type of) application.
226
+
213
227
  ifdef::nginx[]
214
228
  [[inserting_passenger_root_for_apt]]
215
229
  ==== Inserting `passenger_root` into nginx.conf
216
230
 
217
- During step 3 of the 'Installing packages' subsection, you were instructed to uncomment the <<PassengerRoot,passenger_root>> directive in `/etc/nginx/nginx.conf`. If there is no commented version in there, then you need to insert it yourself.
231
+ If there is no <<PassengerRoot,passenger_root>> directive in `/etc/nginx/nginx.conf`, you can insert it yourself as follows:
218
232
 
219
233
  First, run the following command and take note of its output:
220
234
 
@@ -239,7 +253,6 @@ http {
239
253
  }
240
254
  -------------------------------------------------------------
241
255
 
242
- Once you're done editing nginx.conf, continue with step 4.
243
256
  endif::nginx[]
244
257
 
245
258