passenger 4.0.5 → 4.0.6

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 (162) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.travis.yml +1 -2
  3. data/CONTRIBUTING.md +20 -5
  4. data/CONTRIBUTORS +67 -0
  5. data/LICENSE +1 -1
  6. data/NEWS +48 -0
  7. data/Rakefile +2 -2
  8. data/bin/passenger-config +18 -0
  9. data/bin/passenger-install-apache2-module +2 -0
  10. data/bin/passenger-install-nginx-module +11 -12
  11. data/bin/passenger-memory-stats +2 -0
  12. data/bin/passenger-status +152 -69
  13. data/build/agents.rb +1 -5
  14. data/build/basics.rb +26 -13
  15. data/build/cplusplus_support.rb +9 -0
  16. data/build/debian.rb +129 -0
  17. data/build/documentation.rb +6 -2
  18. data/build/integration_tests.rb +13 -2
  19. data/build/misc.rb +16 -0
  20. data/build/packaging.rb +67 -51
  21. data/build/preprocessor.rb +314 -0
  22. data/build/test_basics.rb +1 -0
  23. data/{debian → debian.template}/README.Debian +0 -0
  24. data/{debian → debian.template}/changelog +131 -0
  25. data/debian.template/compat +1 -0
  26. data/debian.template/control +71 -0
  27. data/debian.template/copyright +385 -0
  28. data/debian.template/libapache2-mod-passenger.install +3 -0
  29. data/{debian → debian.template}/libapache2-mod-passenger.postinst +0 -0
  30. data/{debian → debian.template}/libapache2-mod-passenger.prerm +0 -0
  31. data/debian.template/locations.ini +12 -0
  32. data/debian.template/passenger.conf +4 -0
  33. data/{debian → debian.template}/passenger.load +0 -0
  34. data/debian.template/patches/series +0 -0
  35. data/debian.template/repack.sh +42 -0
  36. data/debian.template/ruby-passenger-dev.install +3 -0
  37. data/debian.template/ruby-passenger-doc.install +2 -0
  38. data/debian.template/ruby-passenger.docs +4 -0
  39. data/debian.template/ruby-passenger.install +11 -0
  40. data/debian.template/ruby-passenger.manpages +4 -0
  41. data/debian.template/rules.template +35 -0
  42. data/debian.template/source/format +1 -0
  43. data/debian.template/watch +3 -0
  44. data/dev/run_travis.sh +46 -46
  45. data/doc/Architectural overview.html +2 -2
  46. data/doc/Packaging.html +27 -18
  47. data/doc/Packaging.txt.md +27 -18
  48. data/doc/Security of user switching support.html +2 -2
  49. data/doc/Users guide Apache.html +881 -95
  50. data/doc/Users guide Apache.idmap.txt +48 -6
  51. data/doc/Users guide Apache.txt +13 -1
  52. data/doc/Users guide Nginx.html +1063 -190
  53. data/doc/Users guide Nginx.idmap.txt +89 -45
  54. data/doc/Users guide Nginx.txt +45 -0
  55. data/doc/Users guide Standalone.html +7 -7
  56. data/doc/users_guide_snippets/alternative_for_flying_passenger.txt +1 -0
  57. data/doc/users_guide_snippets/environment_variables.txt +221 -0
  58. data/doc/users_guide_snippets/installation.txt +66 -17
  59. data/doc/users_guide_snippets/support_information.txt +3 -3
  60. data/doc/users_guide_snippets/tips.txt +352 -40
  61. data/ext/common/Account.h +4 -3
  62. data/ext/common/AccountsDatabase.h +6 -6
  63. data/ext/common/AgentsStarter.h +1 -13
  64. data/ext/common/ApplicationPool2/DirectSpawner.h +4 -4
  65. data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
  66. data/ext/common/ApplicationPool2/Group.h +9 -4
  67. data/ext/common/ApplicationPool2/Implementation.cpp +6 -1
  68. data/ext/common/ApplicationPool2/Options.h +65 -37
  69. data/ext/common/ApplicationPool2/Pool.h +91 -41
  70. data/ext/common/ApplicationPool2/Process.h +6 -6
  71. data/ext/common/ApplicationPool2/SmartSpawner.h +14 -14
  72. data/ext/common/ApplicationPool2/Socket.h +1 -1
  73. data/ext/common/ApplicationPool2/Spawner.h +24 -16
  74. data/ext/common/ApplicationPool2/SpawnerFactory.h +9 -1
  75. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  76. data/ext/common/Constants.h +1 -1
  77. data/ext/common/Logging.cpp +12 -7
  78. data/ext/common/MessageServer.h +7 -12
  79. data/ext/common/MultiLibeio.cpp +5 -5
  80. data/ext/common/ResourceLocator.h +2 -6
  81. data/ext/common/ServerInstanceDir.h +37 -10
  82. data/ext/common/UnionStation.h +10 -10
  83. data/ext/common/Utils.cpp +30 -4
  84. data/ext/common/Utils.h +7 -0
  85. data/ext/common/Utils/BlockingQueue.h +2 -2
  86. data/ext/common/Utils/Lock.h +2 -2
  87. data/ext/common/Utils/MessagePassing.h +2 -2
  88. data/ext/common/Utils/Timer.h +4 -4
  89. data/ext/common/agents/HelperAgent/AgentOptions.h +2 -0
  90. data/ext/common/agents/HelperAgent/Main.cpp +57 -16
  91. data/ext/common/agents/HelperAgent/RequestHandler.h +4 -1
  92. data/ext/common/agents/LoggingAgent/AdminController.h +91 -0
  93. data/ext/common/agents/LoggingAgent/LoggingServer.h +46 -29
  94. data/ext/common/agents/LoggingAgent/Main.cpp +43 -16
  95. data/ext/common/agents/LoggingAgent/RemoteSender.h +7 -7
  96. data/ext/common/agents/Watchdog/AgentWatcher.cpp +11 -11
  97. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +3 -1
  98. data/ext/common/agents/Watchdog/Main.cpp +62 -0
  99. data/ext/libeio/config.guess +206 -167
  100. data/ext/libeio/config.sub +142 -68
  101. data/ext/libev/config.guess +304 -290
  102. data/ext/libev/config.sub +198 -77
  103. data/ext/nginx/config +4 -0
  104. data/ext/nginx/ngx_http_passenger_module.c +1 -0
  105. data/ext/oxt/implementation.cpp +4 -4
  106. data/lib/phusion_passenger.rb +14 -5
  107. data/lib/phusion_passenger/abstract_installer.rb +41 -0
  108. data/lib/phusion_passenger/admin_tools/server_instance.rb +48 -39
  109. data/lib/phusion_passenger/message_client.rb +31 -7
  110. data/lib/phusion_passenger/native_support.rb +35 -12
  111. data/lib/phusion_passenger/packaging.rb +16 -2
  112. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +6 -31
  113. data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +3 -1
  115. data/lib/phusion_passenger/request_handler.rb +1 -1
  116. data/lib/phusion_passenger/standalone/command.rb +6 -6
  117. data/lib/phusion_passenger/standalone/main.rb +23 -8
  118. data/lib/phusion_passenger/standalone/package_runtime_command.rb +9 -5
  119. data/lib/phusion_passenger/standalone/runtime_installer.rb +9 -10
  120. data/lib/phusion_passenger/standalone/start_command.rb +20 -4
  121. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +19 -0
  122. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +22 -0
  123. data/resources/templates/standalone/config.erb +3 -2
  124. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +4 -4
  125. data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -1
  126. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +7 -7
  127. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +9 -9
  128. data/test/cxx/EventedBufferedInputTest.cpp +17 -17
  129. data/test/cxx/RequestHandlerTest.cpp +5 -5
  130. data/test/cxx/ServerInstanceDirTest.cpp +3 -1
  131. data/test/cxx/TestSupport.h +4 -4
  132. data/test/cxx/UnionStationTest.cpp +3 -1
  133. data/test/cxx/UtilsTest.cpp +2 -0
  134. data/test/integration_tests/apache2_tests.rb +2 -2
  135. data/test/integration_tests/native_packaging_spec.rb +170 -0
  136. data/test/ruby/spec_helper.rb +0 -1
  137. data/test/stub/apache2/httpd.conf.erb +1 -1
  138. data/test/stub/nginx/nginx.conf.erb +1 -0
  139. data/test/support/apache2_controller.rb +1 -1
  140. data/test/support/placebo-preloader.rb +1 -1
  141. data/test/support/test_helper.rb +5 -2
  142. metadata +32 -26
  143. metadata.gz.asc +7 -7
  144. data/debian/compat +0 -1
  145. data/debian/control +0 -49
  146. data/debian/copyright +0 -20
  147. data/debian/libapache2-mod-passenger.install +0 -1
  148. data/debian/passenger-common.install +0 -4
  149. data/debian/passenger.conf +0 -4
  150. data/debian/prerm +0 -2
  151. data/debian/rules +0 -37
  152. data/debian/watch +0 -3
  153. data/dev/googlecode_upload.py +0 -265
  154. data/ext/common/agents/HelperAgent/BacktracesServer.h +0 -60
  155. data/resources/templates/nginx/not_available_when_natively_packaged.txt.erb +0 -8
  156. data/test/stub/rails3.1/app/assets/javascripts/application.js +0 -9
  157. data/test/stub/rails3.2/app/assets/javascripts/application.js +0 -15
  158. data/test/stub/rails_apps/2.3/mycook/public/javascripts/application.js +0 -2
  159. data/test/stub/rails_apps/2.3/mycook/public/javascripts/controls.js +0 -963
  160. data/test/stub/rails_apps/2.3/mycook/public/javascripts/dragdrop.js +0 -973
  161. data/test/stub/rails_apps/2.3/mycook/public/javascripts/effects.js +0 -1128
  162. data/test/stub/rails_apps/2.3/mycook/public/javascripts/prototype.js +0 -4320
data.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJRpgpHAAoJECrHRaUKISqMmNkIAIbfyHTRn7w8hubsVIbNhaTn
6
- wbgIkDW2N7y9RQXCtjiCp8niJB5J0nguVsrU+vykoEPcQ8YVsDeo2OMrnWqZOQ3Y
7
- k94g/ZDDXg+g9FkaQ/6U1B0au48qqwJVquBz6rL8awkgWd8yve6UAO9i5Oum3YWz
8
- tuj1abiJxxZOOKhu6lGSe51nephHG35BUh0eNtO/PQCDptfjNBnEmDTmZL1xs3GM
9
- W/lwx8q4AQJU4gpA31qtRDDP7GSL/2OKE0rBUfXSaMF88X3SotNr+ohZSUm6siHG
10
- 4R2m469J8+RBNOnjNY6xILrrC+/WYM5G5GTKtjP8lwL6RD5xJ9JtyEOuYT0UrAc=
11
- =TDNl
5
+ iQEbBAABAgAGBQJR1eJgAAoJECrHRaUKISqMlOwH9iVnxxO+68qEAnLgklGOj6+C
6
+ /ON2JZpMB7rVB3iL86C13gAE/zH+Ks7VxhUEr6pkK/XgNRxK23Y1key55yzxawLR
7
+ 0v9B7qQSPhLbhzrvBrQzVoGp9v1JOwM0yzp3mS4LJJT95+coNmhu6QeDH0xeFxMg
8
+ OwP3q7n2vMz3k2RsFdgtYk9Ig10wfbqhCpsYEi3xx2mIHL4VO1YlJDbkcGp8VX30
9
+ ZfhcZaui5Ytt7bc/euSWvqmGFrXQByzqAnv+RDzpaGFJ07b75YAeveManwDrcMkr
10
+ 22aolcN1OPfujTMzHxVyy59Mvlmj8itoBzweWdZZ2TwYHrD6tY0yNh9cvPx/4Q==
11
+ =TeIY
12
12
  -----END PGP SIGNATURE-----
@@ -1,16 +1,15 @@
1
1
  language: ruby
2
2
 
3
3
  env:
4
- - TEST_FULL_COMPILE=1
5
4
  - TEST_CXX=1
6
5
  - TEST_CXX=1 SUDO=1
7
6
  - TEST_RUBY=1 TEST_RUBY_VERSION=1.8.7 TEST_CLASSIC_RAILS=0
8
7
  - TEST_RUBY=1 TEST_RUBY_VERSION=1.9.3 TEST_CLASSIC_RAILS=0
9
8
  - TEST_NGINX=1 TEST_RUBYGEMS_VERSION=1.8.25
10
9
  - TEST_APACHE2=1 TEST_RUBYGEMS_VERSION=1.8.25
10
+ - TEST_DEBIAN_PACKAGING=1 TEST_RUBYGEMS_VERSION=1.8.25
11
11
 
12
12
  before_install:
13
- - sudo apt-get install apache2-mpm-worker apache2-threaded-dev
14
13
  - cp test/config.json.travis test/config.json
15
14
 
16
15
  script: ./dev/run_travis.sh
@@ -13,11 +13,19 @@ We require contributors to sign our [contributor agreement](http://www.phusion.n
13
13
 
14
14
  Please submit patches in the form of a Github pull request or as a patch on the [bug tracker](http://code.google.com/p/phusion-passenger/issues/list). Pull requests are preferred and generally get more attention because Github has better email notifications and better discussion capabilities.
15
15
 
16
+ You should also install required developer tools. The following command will install everything you need:
17
+
18
+ rake test:install_deps
19
+
20
+ If your system requires gems to be installed with root privileges, run:
21
+
22
+ rake test:install_deps SUDO=1
23
+
16
24
  ## Contributing documentation
17
25
 
18
26
  All good software should have good documentation, and we take this very seriously. However writing and maintaing quality documentation is not an easy task. If you are not skilled in C++ or programming, then writing documentation is the easiest way to contribute.
19
27
 
20
- Most documentation can be located in the `doc` directory, and are either written in Markdown or in Asciidoc format. They can be compiled to HTML with `rake doc`. You need [Mizuho](https://github.com/FooBarWidget/mizuho) to compile Asciidoc and [BlueCloth](http://deveiate.org/projects/BlueCloth) to compile Markdown.
28
+ Most documentation can be located in the `doc` directory, and are either written in Markdown or in Asciidoc format. They can be compiled to HTML with `rake doc`. You need [Mizuho](https://github.com/FooBarWidget/mizuho) to compile Asciidoc and [BlueCloth](http://deveiate.org/projects/BlueCloth) to compile Markdown. Both gems are automatically installed as part of the Phusion Passenger developer tools.
21
29
 
22
30
  ## Contributing by bug triaging
23
31
 
@@ -57,9 +65,11 @@ Run the following command to compile everything:
57
65
  rake apache2
58
66
  rake nginx
59
67
 
68
+ It is recommended that you install ccache and set the `USE_CCACHE=1` environment variable. The build system will then automatically wrap all compiler calls in ccache, significantly improving recompilation times.
69
+
60
70
  ### Running the unit tests
61
71
 
62
- The tests depend on all the usual Phusion Passenger dependencies, plus a bunch of additional dependencies that you can install with:
72
+ The tests depend on the Phusion Passenger developer tools. Make sure they're installed:
63
73
 
64
74
  rake test:install_deps
65
75
 
@@ -105,18 +115,23 @@ The most important directories are:
105
115
 
106
116
  * `lib/phusion_passenger` <br>
107
117
  The source code for Ruby parts of Phusion Passenger.
108
- * `ext/phusion_passenger` <br>
109
- Native extensions for Ruby, used by the spawn server.
118
+ * `ext/ruby` <br>
119
+ Native extension for Ruby. Phusion Passenger uses the functions in this extension for optimizing certain operations, but Phusion Passenger can also function without this extension.
110
120
  * `ext/apache2` <br>
111
121
  Apache 2-specific source code.
112
122
  * `ext/nginx` <br>
113
123
  Nginx-specific source code.
114
124
  * `ext/common` <br>
115
125
  Source code shared by the Apache and Nginx modules.
126
+ * `ext/common/agents` <br>
127
+ Source code of the Phusion agent executables, i.e. PassengerWatchdog, PassengerHelperAgent and PassengerLoggingAgent.
128
+ * PassengerWatchdog is is the main Phusion Passenger control process, starts PassengerHelperAgent and PassengerLoggingAgent, and restarts them when they crash. It also cleans everything up upon shut down.
129
+ * PassengerHelperAgent performs most of the heavy lifting. It parses requests, spawns application processes, forwards requests to the correct process and forwards application responses back to the web server.
130
+ * PassengerLoggingAgent processes Union Station data and sends them to the Union Station server.
116
131
  * `bin` <br>
117
132
  User executables.
118
133
  * `helper-scripts` <br>
119
- Scripts used during runtime, but not directly executed by the user.
134
+ Scripts used during runtime, but not directly executed by the user. All the loaders - applications which are responsible for loading an application written in a certain language and hooking it up to Phusion Passenger - are in this directory.
120
135
  * `doc` <br>
121
136
  Various documentation.
122
137
  * `test` <br>
@@ -0,0 +1,67 @@
1
+ _why
2
+ Adam Duke
3
+ Alex Osborne
4
+ Alex Tomlins
5
+ Aman Gupta
6
+ Andre Ferraz
7
+ Andre Nathan
8
+ Andy Allan
9
+ Benjamin Fleischer
10
+ Bernd Ahlers
11
+ Chad Fowler
12
+ Christoffer Sawicki
13
+ Damien Le Berrigaud
14
+ Dan Peterson
15
+ Danial Pearce
16
+ Dave Parfitt
17
+ David Sissitka
18
+ Dirk Mueller
19
+ Dmitry Galinsky
20
+ Dylan Vaughn
21
+ Erik Ogan
22
+ Evan Phoenix
23
+ Gaspard Bucher
24
+ Goffert van Gool
25
+ Gregory Potamianos
26
+ Hongli Lai (Phusion)
27
+ Ian Ehlert
28
+ isaac
29
+ Isaac Reuben
30
+ J.W. Koelewijn
31
+ Jacob Harris
32
+ James Miller
33
+ Jan Berkel
34
+ Jason Cannon
35
+ jastix
36
+ Jay Freeman (saurik)
37
+ John Dewey
38
+ John Leach
39
+ Joshua Lund
40
+ jpatterson
41
+ Jude Nagurney
42
+ Luuk Hendriks (Phusion)
43
+ Magnus Holm
44
+ Michal Papis
45
+ Michał Pokrywka
46
+ Mike
47
+ Mike Boone
48
+ Morton Jonuschat
49
+ Nathaniel Bibler
50
+ Neil Wilson
51
+ Ninh Bui (Phusion)
52
+ Pat Downey
53
+ Paul Kmiec
54
+ Perry Smith
55
+ Philip M. Gollucci
56
+ Redmar Kerkhoff
57
+ remi
58
+ Robin Bowes
59
+ Ryo Onodera
60
+ Saimon Moore
61
+ Sam Pohlenz
62
+ Sebastian Delmont
63
+ Slippy Douglas
64
+ Tim Carey-Smith
65
+ Tinco Andringa (Phusion)
66
+ W. Andrew Loe III
67
+ Weyert de Boer
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Phusion
1
+ Copyright (c) 2010-2013 Phusion
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/NEWS CHANGED
@@ -1,3 +1,51 @@
1
+ Release 4.0.6
2
+ -------------
3
+
4
+ * Fixed a potential 100% CPU lock up in the crash handler, which only occurs
5
+ on OS X. Fixes issue #908.
6
+ * Fixed a crash in request handling, when certain events are trigger after
7
+ the client has already disconnected. Fixes issue #889.
8
+ * Phusion Passenger will no longer crash when the Phusion Passenger
9
+ native_support Ruby extension cannot be compiled, e.g. because the Ruby
10
+ development headers are not installed or because the current user has no
11
+ permission to save the native extension file. Fixes issue #890.
12
+ * Fixed OS X 10.9 support. Fixes issue #906.
13
+ * Removed dependency on bash, so that Phusion Passenger works out of the box
14
+ on BSD platforms without installing/configuring bash. Fixes issue #911.
15
+ * Fix 'PassengerPoolIdleTime 0' not being respected correctly. Issue #904.
16
+ * Admin tools improvement: it is now possible to see all currently running
17
+ requests by invoking `passenger-status --show=requests`.
18
+ * [Apache] Fixed compatibility with Apache pipe logging. Previously this
19
+ would cause Phusion Passenger to lock up with 100% CPU during Apache
20
+ restart.
21
+ * [Nginx] The Nginx configure script now checks whether 'ruby' is in $PATH.
22
+ Previously, if 'ruby' is not in $PATH, then the compilation process fails
23
+ with an obscure error.
24
+ * [Nginx] passenger-install-nginx-module now works properly even when Phusion
25
+ Passenger is installed through the Debian packages. Before, the installer
26
+ would tell you to install Phusion Passenger through the gem or tarball
27
+ instead.
28
+ * [Enterprise] Added pretty printing helpers to the Live IRB Console.
29
+ * Fixed permissions on a subdirectory in the server instance directory. The
30
+ server instance directory is a temporary directory that Phusion Passenger
31
+ uses to store working files, and is deleted after Phusion Passenger exits.
32
+ A subdirectory inside it is world-writable (but not world-readable) and is
33
+ used for storing Unix domain sockets created by different apps, which may
34
+ run as different users. These sockets had long random filenames to prevent
35
+ them from being guessed. However because of a typo, this subdirectory was
36
+ created with the setuid bit, when it should have sticky bit (to prevent
37
+ existing files from being deleted or renamed by a user that doesn't own the
38
+ file). This has now been fixed.
39
+ * If the server instance directory already exists, it will now be removed
40
+ first in order get correct directory permissions. If the directory still
41
+ exists after removal, Phusion Passenger aborts to avoid writing to a
42
+ directory with unexpected permissions. Fixes issue #910.
43
+ * The installer now checks whether the system has enough virtual memory, and
44
+ prints a helpful warning if it doesn't.
45
+ * Linux/AArch64 compatibility fixes. Patch contributed by Dirk Mueller.
46
+ * Improved documentation.
47
+
48
+
1
49
  Release 4.0.5
2
50
  -------------
3
51
 
data/Rakefile CHANGED
@@ -36,6 +36,7 @@ else
36
36
  require 'build/ruby_tests'
37
37
  require 'build/integration_tests'
38
38
  require 'build/misc'
39
+ require 'build/debian'
39
40
  require 'build/rpm'
40
41
  end
41
42
 
@@ -49,8 +50,7 @@ end
49
50
 
50
51
  desc "Remove compiled files"
51
52
  task :clean do
52
- sh "rm -rf build/cache"
53
- sh "rm -rf libout"
53
+ sh "rm -rf buildout"
54
54
  end
55
55
 
56
56
  desc "Remove all generated files"
@@ -37,9 +37,13 @@ def help
37
37
  puts "Options:"
38
38
  puts " --root Show Phusion Passenger's root directory."
39
39
  puts " --includedir Show the Nginx runtime library headers directory."
40
+ puts " --nginx-addon-dir Show the Phusion Passenger Nginx addon directory."
40
41
  puts " --nginx-libs Show Nginx runtime library flags."
41
42
  puts " --compiled Check whether runtime libraries are compiled."
43
+ puts " --natively-packaged Check whether Phusion Passenger is natively packged."
42
44
  puts " --ruby-command Print the correct command for invoking the Ruby interpreter."
45
+ puts " --rubyext-compat-id Print the Ruby extension binary compatibility ID."
46
+ puts " --cxx-compat-id Print the C++ binary compatibility ID."
43
47
  puts " --version Show version number."
44
48
  end
45
49
 
@@ -55,6 +59,8 @@ when "--root"
55
59
  puts PhusionPassenger.source_root
56
60
  when "--includedir"
57
61
  puts PhusionPassenger.include_dir
62
+ when "--nginx-addon-dir"
63
+ puts PhusionPassenger.nginx_addon_dir
58
64
  when "--nginx-libs"
59
65
  text = "#{common_library.link_objects_as_string} #{PhusionPassenger.lib_dir}/common/libboost_oxt.a"
60
66
  if PhusionPassenger::PlatformInfo.has_math_library?
@@ -72,6 +78,12 @@ when "--compiled"
72
78
  else
73
79
  exit 1
74
80
  end
81
+ when "--natively-packaged"
82
+ if PhusionPassenger.natively_packaged?
83
+ exit 0
84
+ else
85
+ exit 1
86
+ end
75
87
  when "--ruby-command"
76
88
  require 'phusion_passenger/platform_info/ruby'
77
89
  ruby = PhusionPassenger::PlatformInfo.ruby_command
@@ -101,6 +113,12 @@ when "--ruby-command"
101
113
  puts
102
114
  puts "## Notes for RVM users"
103
115
  puts "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'."
116
+ when "--rubyext-compat-id"
117
+ require 'phusion_passenger/platform_info/binary_compatibility'
118
+ puts PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_id
119
+ when "--cxx-compat-id"
120
+ require 'phusion_passenger/platform_info/binary_compatibility'
121
+ puts PhusionPassenger::PlatformInfo.cxx_binary_compatibility_id
104
122
  when "--version"
105
123
  puts PhusionPassenger::VERSION_STRING
106
124
  else
@@ -93,6 +93,8 @@ class Installer < PhusionPassenger::AbstractInstaller
93
93
  show_welcome_screen
94
94
  check_dependencies || exit(1)
95
95
  check_whether_apache_uses_compatible_mpm
96
+ check_whether_os_is_broken
97
+ check_whether_system_has_enough_ram
96
98
  check_write_permission_to_passenger_root || exit(1)
97
99
  if install_apache2_module
98
100
  show_apache2_config_snippets
@@ -69,15 +69,14 @@ class Installer < PhusionPassenger::AbstractInstaller
69
69
  # Make sure the configure script finds the correct
70
70
  # passenger-config command.
71
71
  ENV['PATH'] = PhusionPassenger.bin_dir + ":" + ENV['PATH']
72
-
73
- if PhusionPassenger.natively_packaged?
74
- not_available_when_natively_packaged
75
- exit(2)
76
- end
77
72
 
78
73
  show_welcome_screen
79
74
  check_dependencies || exit(1)
80
- check_whether_we_can_write_to(PhusionPassenger.source_root) || exit(1)
75
+ if needs_compiling_support_files?
76
+ check_whether_we_can_write_to(PhusionPassenger.source_root) || exit(1)
77
+ end
78
+ check_whether_os_is_broken
79
+ check_whether_system_has_enough_ram
81
80
 
82
81
  download_and_install = should_we_download_and_install_nginx_automatically?
83
82
  if pcre_is_installed?
@@ -104,7 +103,7 @@ class Installer < PhusionPassenger::AbstractInstaller
104
103
  end
105
104
  check_whether_we_can_write_to(nginx_prefix) || exit(1)
106
105
  nginx_config_already_exists_before_installing = nginx_config_exists?(nginx_prefix)
107
- if PhusionPassenger.originally_packaged?
106
+ if needs_compiling_support_files?
108
107
  compile_passenger_support_files || exit(1)
109
108
  end
110
109
  if install_nginx(nginx_source_dir, nginx_prefix, extra_nginx_configure_flags)
@@ -132,14 +131,14 @@ class Installer < PhusionPassenger::AbstractInstaller
132
131
  end
133
132
 
134
133
  private
135
- def not_available_when_natively_packaged
136
- render_template 'nginx/not_available_when_natively_packaged'
137
- end
138
-
139
134
  def show_welcome_screen
140
135
  render_template 'nginx/welcome', :version => VERSION_STRING
141
136
  wait
142
137
  end
138
+
139
+ def needs_compiling_support_files?
140
+ return PhusionPassenger.originally_packaged?
141
+ end
143
142
 
144
143
  def compile_passenger_support_files
145
144
  new_screen
@@ -432,7 +431,7 @@ private
432
431
  elsif !pcre_is_installed?
433
432
  command << "--without-http_rewrite_module "
434
433
  end
435
- command << "--add-module='#{PhusionPassenger.source_root}/ext/nginx' #{extra_configure_flags}"
434
+ command << "--add-module='#{PhusionPassenger.nginx_addon_dir}' #{extra_configure_flags}"
436
435
  command.strip!
437
436
  return command
438
437
  end
@@ -110,6 +110,8 @@ class App
110
110
  end
111
111
 
112
112
  def start
113
+ puts "Version: #{PhusionPassenger::VERSION_STRING}"
114
+ puts "Date : #{Time.now}"
113
115
  if @stats.apache_processes
114
116
  print_process_list("Apache processes", @stats.apache_processes)
115
117
  else
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010 Phusion
3
+ # Copyright (c) 2010-2013 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -35,56 +35,134 @@ require 'optparse'
35
35
  include PhusionPassenger::AdminTools
36
36
  include PhusionPassenger::Utils::AnsiColors
37
37
 
38
- def show_status(server_instance, options = {})
39
- server_instance.connect(:passenger_status) do
40
- case options[:show]
41
- when 'pool'
42
- begin
43
- puts server_instance.status(:verbose => options[:verbose], :colorize => true)
44
- rescue SystemCallError => e
45
- STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{server_instance.pid}:"
46
- STDERR.puts e.to_s
47
- exit 2
48
- end
38
+ DEFAULT_OPTIONS = { :show => 'pool' }.freeze
49
39
 
50
- when 'backtraces'
51
- begin
52
- text = server_instance.backtraces
53
- rescue SystemCallError => e
54
- STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{control_process.pid}:"
55
- STDERR.puts e.to_s
56
- exit 2
57
- end
58
-
59
- # Colorize output
60
- text.gsub!(/^(Thread .*:)$/, BLACK_BG + YELLOW + '\1' + RESET)
61
- text.gsub!(/^( +in '.*? )(.*?)\(/, '\1' + BOLD + '\2' + RESET + '(')
62
-
63
- puts text
40
+
41
+ ##### Show status command #####
42
+
43
+ def command_show_status(argv, options)
44
+ if argv.empty?
45
+ server_instance = find_sole_server_instance
46
+ else
47
+ server_instance = find_server_instance_on_pid(argv[0].to_i)
48
+ end
49
+ show_status(server_instance, options)
50
+ end
51
+
52
+ def find_sole_server_instance
53
+ server_instances = ServerInstance.list
54
+ if server_instances.empty?
55
+ abort "ERROR: Phusion Passenger doesn't seem to be running."
56
+ elsif server_instances.size == 1
57
+ return server_instances.first
58
+ else
59
+ puts "It appears that multiple Passenger instances are running. Please select a"
60
+ puts "specific one by running:"
61
+ puts
62
+ puts " passenger-status <PID>"
63
+ puts
64
+ puts "The following Passenger instances are running:"
65
+ server_instances.each do |instance|
66
+ puts " PID: #{instance.pid}"
67
+ end
68
+ exit 1
69
+ end
70
+ end
71
+
72
+ def find_server_instance_on_pid(pid)
73
+ if server_instance = ServerInstance.for_pid(pid)
74
+ return server_instance
75
+ else
76
+ abort "ERROR: there doesn't seem to be a Phusion Passenger instance running on PID #{pid}."
77
+ end
78
+ end
79
+
80
+ def show_status(server_instance, options)
81
+ puts "Version : #{PhusionPassenger::VERSION_STRING}"
82
+ puts "Date : #{Time.now}"
83
+ puts "Instance: #{server_instance.pid}"
84
+ case options[:show]
85
+ when 'pool'
86
+ client = server_instance.connect(:role => :passenger_status)
87
+ begin
88
+ puts client.pool_status(:verbose => options[:verbose], :colorize => true)
89
+ rescue SystemCallError => e
90
+ STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{server_instance.pid}:"
91
+ STDERR.puts e.to_s
92
+ exit 2
93
+ end
94
+
95
+ when 'requests'
96
+ client = server_instance.connect(:role => :passenger_status)
97
+ begin
98
+ puts client.helper_agent_requests
99
+ rescue SystemCallError => e
100
+ STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{server_instance.pid}:"
101
+ STDERR.puts e.to_s
102
+ exit 2
103
+ end
104
+
105
+ when 'backtraces'
106
+ client = server_instance.connect(:role => :passenger_status)
107
+ begin
108
+ text = client.helper_agent_backtraces
109
+ rescue SystemCallError => e
110
+ STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{control_process.pid}:"
111
+ STDERR.puts e.to_s
112
+ exit 2
113
+ end
114
+
115
+ # Colorize output
116
+ text.gsub!(/^(Thread .*:)$/, BLACK_BG + YELLOW + '\1' + RESET)
117
+ text.gsub!(/^( +in '.*? )(.*?)\(/, '\1' + BOLD + '\2' + RESET + '(')
118
+
119
+ puts text
120
+
121
+ when 'xml'
122
+ client = server_instance.connect(:role => :passenger_status)
123
+ begin
124
+ xml = client.pool_xml
125
+ rescue SystemCallError => e
126
+ STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{control_process.pid}:"
127
+ STDERR.puts e.to_s
128
+ exit 2
129
+ end
64
130
 
65
- when 'xml'
66
- begin
67
- xml = server_instance.xml
68
- rescue SystemCallError => e
69
- STDERR.puts "*** ERROR: Cannot query status for Passenger instance #{control_process.pid}:"
70
- STDERR.puts e.to_s
71
- exit 2
72
- end
73
-
74
- indented = format_with_xmllint(xml)
75
- if indented
76
- puts indented
77
- else
78
- puts xml
79
- STDERR.puts "*** Tip: if you install the 'xmllint' command then the XML output will be indented."
80
- end
131
+ indented = format_with_xmllint(xml)
132
+ if indented
133
+ puts indented
134
+ else
135
+ puts xml
136
+ STDERR.puts "*** Tip: if you install the 'xmllint' command then the XML output will be indented."
137
+ end
138
+
139
+ when 'union_station'
140
+ client = server_instance.connect(:role => :passenger_status, :socket_name => 'logging_admin')
141
+ begin
142
+ response = client.logging_agent_status
143
+ rescue SystemCallError => e
144
+ STDERR.puts "*** ERROR: Cannot query status for Phusion Passenger instance #{control_process.pid}:"
145
+ STDERR.puts e.to_s
146
+ exit 2
81
147
  end
148
+
149
+ puts response
82
150
  end
83
151
  rescue ServerInstance::RoleDeniedError
84
152
  require 'phusion_passenger/platform_info/ruby'
85
153
  STDERR.puts "*** ERROR: You are not authorized to query the status for this Phusion " <<
86
154
  "Passenger instance. Please try again with '#{PhusionPassenger::PlatformInfo.ruby_sudo_command}'."
87
155
  exit 2
156
+ rescue ServerInstance::CorruptedDirectoryError
157
+ STDERR.puts "*** ERROR: The server instance directory #{server_instance.path} is corrupted. " <<
158
+ "This could have two causes:\n" <<
159
+ "\n" <<
160
+ " 1. The Phusion Passenger instance is no longer running, but failed to cleanup the directory. " <<
161
+ "Please delete this directory and ignore the problem.\n" <<
162
+ " 2. An external program corrupted the directory. Please restart Phusion Passenger.\n"
163
+ exit 2
164
+ ensure
165
+ client.close if client
88
166
  end
89
167
 
90
168
  def format_with_xmllint(xml)
@@ -122,20 +200,23 @@ def format_with_xmllint(xml)
122
200
  end
123
201
  end
124
202
 
125
- def start
126
- options = { :show => 'pool' }
127
- parser = OptionParser.new do |opts|
203
+
204
+ ##### Main command dispatcher #####
205
+
206
+ def create_option_parser(options)
207
+ return OptionParser.new do |opts|
128
208
  opts.banner = "Usage: passenger-status [options] [Phusion Passenger's PID]"
129
209
  opts.separator ""
130
210
  opts.separator "Tool for inspecting Phusion Passenger's internal status."
131
211
  opts.separator ""
132
212
 
133
213
  opts.separator "Options:"
134
- opts.on("--show=pool|backtraces|xml", String,
135
- "Whether to show the pool's contents, \n" <<
214
+ opts.on("--show=pool|requests|backtraces|xml|union_station", String,
215
+ "Whether to show the pool's contents,\n" <<
216
+ "#{' ' * 37}the currently running requests,\n" <<
136
217
  "#{' ' * 37}the backtraces of all threads or an XML\n" <<
137
218
  "#{' ' * 37}description of the pool.") do |what|
138
- if what !~ /\A(pool|backtraces|xml)\Z/
219
+ if what !~ /\A(pool|requests|backtraces|xml|union_station)\Z/
139
220
  STDERR.puts "Invalid argument for --show."
140
221
  exit 1
141
222
  else
@@ -146,6 +227,11 @@ def start
146
227
  options[:verbose] = true
147
228
  end
148
229
  end
230
+ end
231
+
232
+ def parse_argv
233
+ options = DEFAULT_OPTIONS.dup
234
+ parser = create_option_parser(options)
149
235
  begin
150
236
  parser.parse!
151
237
  rescue OptionParser::ParseError => e
@@ -154,30 +240,27 @@ def start
154
240
  puts "Please see '--help' for valid options."
155
241
  exit 1
156
242
  end
157
-
158
- if ARGV.empty?
159
- server_instances = ServerInstance.list
160
- if server_instances.empty?
161
- STDERR.puts("ERROR: Phusion Passenger doesn't seem to be running.")
162
- exit 2
163
- elsif server_instances.size == 1
164
- show_status(server_instances.first, options)
243
+
244
+ return options
245
+ end
246
+
247
+ def infer_command
248
+ if !ARGV[0] || ARGV[0] =~ /\A[0-9]+\Z/
249
+ return [:show_status, ARGV.dup]
250
+ else
251
+ command_name, *argv = ARGV
252
+ if respond_to?("command_#{command_name}")
253
+ return [command_name, argv]
165
254
  else
166
- puts "It appears that multiple Passenger instances are running. Please select a"
167
- puts "specific one by running:"
168
- puts
169
- puts " passenger-status <PID>"
170
- puts
171
- puts "The following Passenger instances are running:"
172
- server_instances.each do |instance|
173
- puts " PID: #{instance.pid}"
174
- end
175
- exit 1
255
+ abort "ERROR: unrecognized command '#{command_name}'"
176
256
  end
177
- else
178
- server_instance = ServerInstance.for_pid(ARGV[0].to_i)
179
- show_status(server_instance, options)
180
257
  end
181
258
  end
182
259
 
260
+ def start
261
+ options = parse_argv
262
+ command, argv = infer_command
263
+ send("command_#{command}", argv, options)
264
+ end
265
+
183
266
  start