passenger 4.0.33 → 4.0.34

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 (112) hide show
  1. checksums.yaml +15 -0
  2. checksums.yaml.gz.asc +12 -0
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +60 -0
  5. data/bin/passenger-config +1 -1
  6. data/bin/passenger-install-apache2-module +510 -40
  7. data/bin/passenger-install-nginx-module +26 -2
  8. data/build/cxx_tests.rb +1 -1
  9. data/build/documentation.rb +19 -21
  10. data/build/integration_tests.rb +39 -12
  11. data/build/misc.rb +18 -0
  12. data/build/packaging.rb +116 -56
  13. data/build/rpm.rb +20 -11
  14. data/build/ruby_tests.rb +2 -3
  15. data/build/test_basics.rb +9 -0
  16. data/debian.template/passenger.conf +2 -0
  17. data/debian.template/passenger.load +2 -0
  18. data/dev/run_travis.sh +3 -5
  19. data/dev/test_rpm_packaging.sh +28 -0
  20. data/doc/Users guide Apache.idmap.txt +6 -4
  21. data/doc/users_guide_snippets/installation.txt +20 -2
  22. data/doc/users_guide_snippets/tips.txt +1 -1
  23. data/ext/common/ApplicationPool2/Pool.h +1 -1
  24. data/ext/common/Constants.h +5 -1
  25. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
  26. data/ext/common/agents/Watchdog/AgentWatcher.cpp +20 -0
  27. data/ext/common/agents/Watchdog/Main.cpp +10 -0
  28. data/ext/ruby/passenger_native_support.c +23 -11
  29. data/helper-scripts/classic-rails-loader.rb +9 -3
  30. data/helper-scripts/classic-rails-preloader.rb +10 -4
  31. data/helper-scripts/download_binaries/extconf.rb +46 -22
  32. data/helper-scripts/meteor-loader.rb +0 -1
  33. data/helper-scripts/node-loader.js +2 -1
  34. data/helper-scripts/prespawn +7 -1
  35. data/helper-scripts/rack-loader.rb +32 -3
  36. data/helper-scripts/rack-preloader.rb +10 -4
  37. data/lib/phusion_passenger.rb +40 -21
  38. data/lib/phusion_passenger/abstract_installer.rb +7 -4
  39. data/lib/phusion_passenger/analytics_logger.rb +4 -3
  40. data/lib/phusion_passenger/config/about_command.rb +27 -6
  41. data/lib/phusion_passenger/{config.rb → config/main.rb} +3 -2
  42. data/lib/phusion_passenger/config/restart_app_command.rb +1 -1
  43. data/lib/phusion_passenger/config/validate_install_command.rb +231 -0
  44. data/lib/phusion_passenger/constants.rb +2 -0
  45. data/lib/phusion_passenger/loader_shared_helpers.rb +92 -19
  46. data/lib/phusion_passenger/native_support.rb +33 -11
  47. data/lib/phusion_passenger/packaging.rb +1 -0
  48. data/lib/phusion_passenger/platform_info.rb +5 -2
  49. data/lib/phusion_passenger/platform_info/apache.rb +229 -60
  50. data/lib/phusion_passenger/platform_info/apache_detector.rb +26 -31
  51. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +4 -4
  52. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +1 -1
  54. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +1 -1
  55. data/lib/phusion_passenger/platform_info/linux.rb +2 -1
  56. data/lib/phusion_passenger/platform_info/ruby.rb +7 -0
  57. data/lib/phusion_passenger/preloader_shared_helpers.rb +2 -1
  58. data/lib/phusion_passenger/request_handler.rb +2 -1
  59. data/lib/phusion_passenger/request_handler/thread_handler.rb +2 -1
  60. data/lib/phusion_passenger/standalone/runtime_installer.rb +35 -13
  61. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  62. data/lib/phusion_passenger/utils.rb +1 -23
  63. data/lib/phusion_passenger/utils/ansi_colors.rb +7 -1
  64. data/lib/phusion_passenger/utils/download.rb +36 -2
  65. data/lib/phusion_passenger/utils/native_support_utils.rb +65 -0
  66. data/resources/templates/apache2/apache_install_broken.txt.erb +20 -0
  67. data/resources/templates/apache2/config_snippets.txt.erb +2 -4
  68. data/resources/templates/apache2/present_choice_for_no_update_config.txt.erb +5 -0
  69. data/resources/templates/installer_common/cannot_access_files_as_root.txt.erb +15 -0
  70. data/resources/templates/installer_common/run_installer_as_root.txt.erb +6 -3
  71. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +1 -1
  72. data/resources/templates/nginx/other_nginx_installations_exist.txt.erb +17 -0
  73. data/rpm/apache-passenger.conf.in +26 -0
  74. data/rpm/config.json +30 -0
  75. data/rpm/passenger.logrotate +7 -0
  76. data/rpm/passenger.spec.template +456 -0
  77. data/rpm/passenger_dynamic_thread_group.patch +16 -0
  78. data/rpm/passenger_tests_default_config_example.patch +44 -0
  79. data/rpm/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +21 -0
  80. data/rpm/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +45 -0
  81. data/test/config.json.rpm-automation +15 -0
  82. data/test/integration_tests/downloaded_binaries_tests.rb +80 -2
  83. data/test/integration_tests/native_packaging_spec.rb +136 -44
  84. data/test/integration_tests/standalone_tests.rb +2 -11
  85. data/test/ruby/analytics_logger_spec.rb +65 -19
  86. data/test/ruby/utils_spec.rb +2 -0
  87. metadata +532 -548
  88. metadata.gz.asc +7 -7
  89. data/resources/templates/apache2/no_write_permission_to_passenger_root.txt.erb +0 -9
  90. data/rpm/README.rdoc +0 -117
  91. data/rpm/config/apache-passenger.conf.in +0 -19
  92. data/rpm/config/nginx-passenger.conf.in +0 -10
  93. data/rpm/config/rubygem-passenger.te +0 -10
  94. data/rpm/doc/README.nginx-alternatives +0 -5
  95. data/rpm/doc/example_yum_repository_htaccess +0 -5
  96. data/rpm/doc/footer.shtml +0 -12
  97. data/rpm/doc/header.shtml +0 -156
  98. data/rpm/nginx-alternatives.spec +0 -97
  99. data/rpm/passenger-release.spec +0 -91
  100. data/rpm/passenger.spec +0 -667
  101. data/rpm/patches/passenger-force-native.patch +0 -63
  102. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +0 -33
  103. data/rpm/release/build-release.sh +0 -35
  104. data/rpm/release/build.rb +0 -301
  105. data/rpm/release/create-mirrors.sh +0 -16
  106. data/rpm/release/mirrors +0 -1
  107. data/rpm/release/mock-repo/comps.xml +0 -21
  108. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  109. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  110. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  111. data/rpm/release/mocksetup-first.sh +0 -102
  112. data/rpm/release/mocksetup.sh +0 -67
@@ -0,0 +1,16 @@
1
+ diff --git a/test/oxt/dynamic_thread_group_test.cpp b/test/oxt/dynamic_thread_group_test.cpp
2
+ index 003b7ef..5a90463 100644
3
+ --- a/test/oxt/dynamic_thread_group_test.cpp
4
+ +++ b/test/oxt/dynamic_thread_group_test.cpp
5
+ @@ -103,9 +103,9 @@ namespace tut {
6
+ }
7
+
8
+ static void create_threads(dynamic_thread_group *group) {
9
+ - for (int i = 1000; i >= 0; i--) {
10
+ + for (int i = 100; i >= 0; i--) {
11
+ boost::function<void ()> f(boost::bind(do_nothing, i * 1000));
12
+ - group->create_thread(f, "", 256 * 1024);
13
+ + group->create_thread(f, "", 8 * 1024);
14
+ }
15
+ }
16
+
@@ -0,0 +1,44 @@
1
+ diff -up ./test/config.json.example.lindefault ./test/config.json.example
2
+ --- ./test/config.json.example.lindefault 2013-05-30 16:04:41.206533618 +0200
3
+ +++ ./test/config.json.example 2013-05-30 16:04:34.070449358 +0200
4
+ @@ -10,24 +10,24 @@
5
+ // otherwise the tests will fail.
6
+
7
+ //// Good values for OS X:
8
+ - "normal_user_1": "_www",
9
+ - "normal_user_2": "daemon",
10
+ - // Must not be "nobody".
11
+ - "default_user": "_sandbox",
12
+ - // Must not be normal_user_1's primary group.
13
+ - "normal_group_1": "daemon",
14
+ - // Must not be normal_user_2's primary group.
15
+ - "normal_group_2": "_sandbox",
16
+ - // Must not be default_user's primary group. Must not be "nobody".
17
+ - "default_group": "_www",
18
+ -
19
+ - ///// Good values for Linux and FreeBSD. Same restrictions apply.
20
+ - //"normal_user_1": "games",
21
+ + //"normal_user_1": "_www",
22
+ //"normal_user_2": "daemon",
23
+ - //"default_user": "man",
24
+ + //// Must not be "nobody".
25
+ + //"default_user": "_sandbox",
26
+ + //// Must not be normal_user_1's primary group.
27
+ //"normal_group_1": "daemon",
28
+ - //"normal_group_2": "man",
29
+ - //"default_group": "games",
30
+ + //// Must not be normal_user_2's primary group.
31
+ + //"normal_group_2": "_sandbox",
32
+ + //// Must not be default_user's primary group. Must not be "nobody".
33
+ + //"default_group": "_www",
34
+ +
35
+ + ///// Good values for Linux and FreeBSD. Same restrictions apply.
36
+ + "normal_user_1": "games",
37
+ + "normal_user_2": "daemon",
38
+ + "default_user": "man",
39
+ + "normal_group_1": "daemon",
40
+ + "normal_group_2": "man",
41
+ + "default_group": "games",
42
+
43
+ // A nonexistant username, group name, user ID and group ID.
44
+ "nonexistant_user": "xxxxxxxxxxxxxxxxxxx",
@@ -0,0 +1,21 @@
1
+ diff -urp passenger-release-4.0.18.orig/ext/boost/cstdint.hpp passenger-release-4.0.18/ext/boost/cstdint.hpp
2
+ --- passenger-release-4.0.18.orig/ext/boost/cstdint.hpp 2013-09-17 13:47:54.000000000 -0500
3
+ +++ passenger-release-4.0.18/ext/boost/cstdint.hpp 2013-09-23 16:34:02.074450639 -0500
4
+ @@ -41,7 +41,15 @@
5
+ // so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
6
+ // See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
7
+ //
8
+ -#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
9
+ +// This define has been dropped altogether in GLIBC 2.17. As of then,
10
+ +// support for long long is part of baseline requirements, and
11
+ +// [u]int64_t is always defined. See here:
12
+ +// http://sourceware.org/ml/libc-alpha/2013-01/msg00440.html
13
+ +//
14
+ +#if defined(BOOST_HAS_STDINT_H) \
15
+ + && (!defined(__GLIBC__) \
16
+ + || defined(__GLIBC_HAVE_LONG_LONG) \
17
+ + || (defined __GLIBC_PREREQ && __GLIBC_PREREQ(2,17)))
18
+
19
+ // The following #include is an implementation artifact; not part of interface.
20
+ # ifdef __hpux
21
+ Only in passenger-release-4.0.18/ext/boost: cstdint.hpp.glibc-long
@@ -0,0 +1,45 @@
1
+ diff -urp passenger-release-4.0.18.orig/ext/common/EventedMessageServer.h passenger-release-4.0.18/ext/common/EventedMessageServer.h
2
+ --- passenger-release-4.0.18.orig/ext/common/EventedMessageServer.h 2013-09-17 13:47:54.000000000 -0500
3
+ +++ passenger-release-4.0.18/ext/common/EventedMessageServer.h 2013-09-23 13:59:23.012484647 -0500
4
+ @@ -27,6 +27,7 @@
5
+
6
+ #include <boost/shared_ptr.hpp>
7
+ #include <ev++.h>
8
+ +#include <sys/types.h>
9
+ #include <cstdarg>
10
+ #include <cstdlib>
11
+ #include <EventedServer.h>
12
+ diff -urp passenger-release-4.0.18.orig/ext/common/FileDescriptor.h passenger-release-4.0.18/ext/common/FileDescriptor.h
13
+ --- passenger-release-4.0.18.orig/ext/common/FileDescriptor.h 2013-09-17 13:47:54.000000000 -0500
14
+ +++ passenger-release-4.0.18/ext/common/FileDescriptor.h 2013-09-23 13:59:23.013484647 -0500
15
+ @@ -30,6 +30,7 @@
16
+ #include <oxt/system_calls.hpp>
17
+
18
+ #include <utility>
19
+ +#include <sys/types.h>
20
+ #include <unistd.h>
21
+ #include <cerrno>
22
+
23
+ diff -urp passenger-release-4.0.18.orig/ext/common/Utils/BufferedIO.h passenger-release-4.0.18/ext/common/Utils/BufferedIO.h
24
+ --- passenger-release-4.0.18.orig/ext/common/Utils/BufferedIO.h 2013-09-17 13:47:54.000000000 -0500
25
+ +++ passenger-release-4.0.18/ext/common/Utils/BufferedIO.h 2013-09-23 13:59:23.014484646 -0500
26
+ @@ -1,6 +1,7 @@
27
+ #ifndef _PASSENGER_BUFFERED_IO_H_
28
+ #define _PASSENGER_BUFFERED_IO_H_
29
+
30
+ +#include <sys/types.h>
31
+ #include <string>
32
+ #include <utility>
33
+ #include <algorithm>
34
+ diff -urp passenger-release-4.0.18.orig/ext/common/Utils/StreamBoyerMooreHorspool.h passenger-release-4.0.18/ext/common/Utils/StreamBoyerMooreHorspool.h
35
+ --- passenger-release-4.0.18.orig/ext/common/Utils/StreamBoyerMooreHorspool.h 2013-09-17 13:47:54.000000000 -0500
36
+ +++ passenger-release-4.0.18/ext/common/Utils/StreamBoyerMooreHorspool.h 2013-09-23 13:59:23.015484645 -0500
37
+ @@ -189,7 +189,7 @@
38
+ #endif
39
+ #endif
40
+
41
+ -
42
+ +#include <sys/types.h>
43
+ #include <cstddef>
44
+ #include <cstring>
45
+ #include <cassert>
@@ -0,0 +1,15 @@
1
+ {
2
+ "normal_user_1": "games",
3
+ "normal_user_2": "daemon",
4
+ "default_user": "gopher",
5
+ "normal_group_1": "daemon",
6
+ "normal_group_2": "gopher",
7
+ "default_group": "games",
8
+
9
+ "nonexistant_user": "xxxxxxxxxxxxxxxxxxx",
10
+ "nonexistant_group": "xxxxxxxxxxxxxxxxxxx",
11
+ "nonexistant_uid": 9999,
12
+ "nonexistant_gid": 9999,
13
+
14
+ "nginx": "/tmp/nginx/sbin/nginx"
15
+ }
@@ -1,9 +1,37 @@
1
+ # encoding: utf-8
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013-2014 Phusion
4
+ #
5
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ # These tests are run by passenger_autobuilder, right after it has built binaries.
26
+ # passenger_autobuilder populates the download_cache directory and runs this test script.
27
+
1
28
  source_root = File.expand_path("../..", File.dirname(__FILE__))
2
29
  $LOAD_PATH.unshift("#{source_root}/lib")
3
30
  require 'phusion_passenger'
4
31
  PhusionPassenger.locate_directories
5
32
  require 'tmpdir'
6
33
  require 'fileutils'
34
+ require 'webrick'
7
35
  require 'open-uri'
8
36
 
9
37
  ENV['PATH'] = "#{PhusionPassenger.bin_dir}:#{ENV['PATH']}"
@@ -32,7 +60,20 @@ describe "Downloaded Phusion Passenger binaries" do
32
60
  end
33
61
  end
34
62
 
35
- it "works" do
63
+ def start_server(document_root)
64
+ server = WEBrick::HTTPServer.new(:BindAddress => '127.0.0.1',
65
+ :Port => 0,
66
+ :DocumentRoot => document_root,
67
+ :Logger => WEBrick::Log.new("/dev/null"),
68
+ :AccessLog => [])
69
+ Thread.new do
70
+ Thread.current.abort_on_exception = true
71
+ server.start
72
+ end
73
+ [server, "http://127.0.0.1:#{server.config[:Port]}"]
74
+ end
75
+
76
+ specify "Passenger Standalone is able to use the binaries" do
36
77
  Dir.mkdir("#{@temp_dir}/#{version}")
37
78
  Dir.chdir("#{@temp_dir}/#{version}") do
38
79
  tarballs = Dir["#{PhusionPassenger.download_cache_dir}/*.tar.gz"]
@@ -73,4 +114,41 @@ describe "Downloaded Phusion Passenger binaries" do
73
114
  end
74
115
  end
75
116
  end
76
- end
117
+
118
+ specify "helper-scripts/download_binaries/extconf.rb succeeds in downloading all necessary binaries" do
119
+ FileUtils.mkdir_p("server_root")
120
+ server, url_root = start_server("server_root")
121
+ File.rename("download_cache", "download_cache.old")
122
+ begin
123
+ FileUtils.cp_r("download_cache.old", "server_root/#{PhusionPassenger::VERSION_STRING}")
124
+ sh "cd #{PhusionPassenger.source_root} && " +
125
+ "env BINARIES_URL_ROOT=#{url_root} " +
126
+ "ruby helper-scripts/download_binaries/extconf.rb --abort-on-error"
127
+ Dir["download_cache/*"].should_not be_empty
128
+ ensure
129
+ File.unlink("Makefile") rescue nil
130
+ FileUtils.rm_rf("download_cache")
131
+ FileUtils.rm_rf("server_root")
132
+ File.rename("download_cache.old", "download_cache")
133
+ server.stop
134
+ end
135
+ end
136
+
137
+ specify "helper-scripts/download_binaries/extconf.rb fails at downloading all necessary binaries if one of them does not exist" do
138
+ FileUtils.mkdir_p("server_root")
139
+ server, url_root = start_server("server_root")
140
+ File.rename("download_cache", "download_cache.old")
141
+ begin
142
+ result = system "cd #{PhusionPassenger.source_root} && " +
143
+ "env BINARIES_URL_ROOT=#{url_root} " +
144
+ "ruby helper-scripts/download_binaries/extconf.rb --abort-on-error"
145
+ result.should be_false
146
+ ensure
147
+ File.unlink("Makefile") rescue nil
148
+ FileUtils.rm_rf("download_cache")
149
+ FileUtils.rm_rf("server_root")
150
+ File.rename("download_cache.old", "download_cache")
151
+ server.stop
152
+ end
153
+ end
154
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2013 Phusion
3
+ # Copyright (c) 2013-2014 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -22,36 +22,90 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- # To run the native packaging tests:
26
- # rake debian:dev debian:dev:reinstall
27
- # rvmsudo env LOCATIONS_INI=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini \
28
- # rspec -f s -c test/integration_tests/native_packaging_spec.rb
29
-
30
- # Ensure that the natively installed tools are in PATH.
31
- ENV['PATH'] = "/usr/bin:#{ENV['PATH']}"
32
25
  LOCATIONS_INI = ENV['LOCATIONS_INI']
33
26
  abort "Please set the LOCATIONS_INI environment variable to the right locations.ini" if !LOCATIONS_INI
34
27
 
35
28
  NATIVE_PACKAGING_METHOD = ENV['NATIVE_PACKAGING_METHOD']
36
- abort "Please set NATIVE_PACKAGING_METHOD to either 'deb' or 'rpm'" if !["deb", "rpm"].include?(NATIVE_PACKAGING_METHOD)
29
+ if !["deb", "rpm", "homebrew"].include?(NATIVE_PACKAGING_METHOD)
30
+ abort "Please set NATIVE_PACKAGING_METHOD to either 'deb', 'rpm' or 'homebrew'"
31
+ end
37
32
 
38
33
  source_root = File.expand_path("../..", File.dirname(__FILE__))
39
34
  $LOAD_PATH.unshift("#{source_root}/lib")
40
35
  require 'phusion_passenger'
41
36
  PhusionPassenger.locate_directories
37
+ PhusionPassenger.require_passenger_lib 'config/validate_install_command'
42
38
  require 'tmpdir'
43
39
  require 'fileutils'
44
40
  require 'open-uri'
41
+ require 'pathname'
45
42
 
46
- BINDIR = "/usr/bin"
47
- SBINDIR = "/usr/sbin"
48
- INCLUDEDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/include"
49
- NGINX_ADDON_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
50
- DOCDIR = "/usr/share/doc/passenger"
51
- RESOURCESDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}"
52
- RUBY_EXTENSION_SOURCE_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
53
- AGENTS_DIR = "/usr/lib/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/agents"
54
- APACHE2_MODULE_PATH = "/usr/lib/apache2/modules/mod_passenger.so"
43
+
44
+ # Ensure that the natively installed tools are in PATH.
45
+ ENV['PATH'] = "/usr/bin:/usr/sbin:#{ENV['PATH']}"
46
+ # Force Rake to redirect stderr to stdout so that we can capture all output.
47
+ ENV['STDERR_TO_STDOUT'] = '1'
48
+
49
+
50
+ module PhusionPassenger
51
+
52
+ case NATIVE_PACKAGING_METHOD
53
+ when "deb"
54
+ BINDIR = "/usr/bin"
55
+ SBINDIR = "/usr/sbin"
56
+ INCLUDEDIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/include"
57
+ NGINX_ADDON_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
58
+ DOCDIR = "/usr/share/doc/passenger"
59
+ HELPER_SCRIPTS_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
60
+ RUBY_EXTENSION_SOURCE_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
61
+ AGENTS_DIR = "/usr/lib/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
62
+ APACHE2_MODULE_PATH = "/usr/lib/apache2/modules/mod_passenger.so"
63
+ SUPPORTS_COMPILING_APACHE_MODULE = false
64
+
65
+ APXS2 = "/usr/bin/apxs2"
66
+ APACHE2 = "/usr/sbin/apache2"
67
+ APACHE2CTL = "/usr/sbin/apache2ctl"
68
+ APACHE_CONFIG_FILE = "/etc/apache2/apache2.conf"
69
+ APACHE_ERROR_LOG = "/var/log/apache2/error.log"
70
+ when "rpm"
71
+ BINDIR = "/usr/bin"
72
+ SBINDIR = "/usr/sbin"
73
+ INCLUDEDIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/include"
74
+ NGINX_ADDON_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
75
+ DOCDIR = "/usr/share/doc/passenger"
76
+ HELPER_SCRIPTS_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/helper-scripts"
77
+ RUBY_EXTENSION_SOURCE_DIR = "/usr/share/#{GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
78
+ AGENTS_DIR = "/usr/lib64/#{GLOBAL_NAMESPACE_DIRNAME}/agents"
79
+ APACHE2_MODULE_PATH = "/usr/lib64/httpd/modules/mod_passenger.so"
80
+ SUPPORTS_COMPILING_APACHE_MODULE = false
81
+
82
+ APXS2 = "/usr/sbin/apxs"
83
+ APACHE2 = "/usr/sbin/httpd"
84
+ APACHE2CTL = "/usr/sbin/apachectl"
85
+ APACHE_CONFIG_FILE = "/etc/httpd/conf/httpd.conf"
86
+ APACHE_ERROR_LOG = "/etc/httpd/logs/error_log"
87
+ when "homebrew"
88
+ # Ensure that the Homebrew-installed Phusion Passenger is the first in PATH.
89
+ ENV['PATH'] = "/usr/local/bin:#{ENV['PATH']}"
90
+ root = "/usr/local/Cellar/passenger/#{VERSION_STRING}/libexec"
91
+
92
+ BINDIR = "#{root}/bin"
93
+ SBINDIR = BINDIR
94
+ INCLUDEDIR = "#{root}/ext"
95
+ NGINX_ADDON_DIR = "#{root}/ext/nginx"
96
+ DOCDIR = "#{root}/doc"
97
+ HELPER_SCRIPTS_DIR = "#{root}/helper-scripts"
98
+ RUBY_EXTENSION_SOURCE_DIR = "#{root}/ext/ruby"
99
+ AGENTS_DIR = "#{root}/buildout/agents"
100
+ APACHE2_MODULE_PATH = "#{root}/buildout/apache2/mod_passenger.so"
101
+ SUPPORTS_COMPILING_APACHE_MODULE = true
102
+
103
+ APXS2 = "/usr/sbin/apxs"
104
+ APACHE2 = "/usr/sbin/httpd"
105
+ APACHE2CTL = "/usr/sbin/apachectl"
106
+ APACHE_CONFIG_FILE = "/private/etc/apache2/httpd.conf"
107
+ APACHE_ERROR_LOG = "/private/var/log/apache2/error_log"
108
+ end
55
109
 
56
110
  describe "A natively packaged Phusion Passenger" do
57
111
  def capture_output(command)
@@ -67,12 +121,33 @@ describe "A natively packaged Phusion Passenger" do
67
121
  return capture_output("which #{command}")
68
122
  end
69
123
 
124
+ def realpath(path)
125
+ Pathname.new(path).realpath.to_s
126
+ end
127
+
70
128
  def sh(*command)
71
129
  if !system(*command)
72
130
  abort "Command failed: #{command.join(' ')}"
73
131
  end
74
132
  end
75
133
 
134
+ def install_apache2_module
135
+ orig_mtime = File.stat(APACHE2_MODULE_PATH).mtime
136
+ output = capture_output("passenger-install-apache2-module --auto 2>&1")
137
+ output.should include("Almost there!")
138
+ output.should include("LoadModule passenger_module #{APACHE2_MODULE_PATH}\n")
139
+ output.should include("PassengerRoot #{LOCATIONS_INI}\n")
140
+ File.stat(APACHE2_MODULE_PATH).mtime.should_not == orig_mtime
141
+ end
142
+
143
+ def install_nginx_module
144
+ Dir.mktmpdir do |path|
145
+ output = capture_output("passenger-install-nginx-module --auto --prefix=#{path} --auto-download 2>&1")
146
+ output.should include("passenger_root #{LOCATIONS_INI};")
147
+ File.exist?("#{path}/sbin/nginx").should be_true
148
+ end
149
+ end
150
+
76
151
  specify "locations.ini only refers to existent filesystem locations" do
77
152
  File.read(LOCATIONS_INI).split("\n").each do |line|
78
153
  if line =~ /=/
@@ -89,7 +164,7 @@ describe "A natively packaged Phusion Passenger" do
89
164
  end
90
165
 
91
166
  specify "passenger-status is in #{SBINDIR}" do
92
- which("passenger-status").should == "#{SBINDIR}/passenger-status"
167
+ realpath(which("passenger-status")).should == "#{SBINDIR}/passenger-status"
93
168
  end
94
169
 
95
170
  specify "the Nginx runtime library headers exist" do
@@ -107,9 +182,9 @@ describe "A natively packaged Phusion Passenger" do
107
182
  File.file?("#{DOCDIR}/Users guide Apache.html").should be_true
108
183
  end
109
184
 
110
- specify "the resources directory exists" do
111
- File.directory?(RESOURCESDIR).should be_true
112
- File.file?("#{RESOURCESDIR}/helper-scripts/rack-loader.rb").should be_true
185
+ specify "the helper-scripts directory exists" do
186
+ File.directory?(HELPER_SCRIPTS_DIR).should be_true
187
+ File.file?("#{HELPER_SCRIPTS_DIR}/rack-loader.rb").should be_true
113
188
  end
114
189
 
115
190
  specify "the Ruby extension source directory exists" do
@@ -129,7 +204,7 @@ describe "A natively packaged Phusion Passenger" do
129
204
 
130
205
  describe "passenger-config" do
131
206
  it "passenger-config is in #{BINDIR}" do
132
- which("passenger-config").should == "#{BINDIR}/passenger-config"
207
+ realpath(which("passenger-config")).should == "#{BINDIR}/passenger-config"
133
208
  end
134
209
 
135
210
  it "shows the path to locations.ini" do
@@ -152,19 +227,19 @@ describe "A natively packaged Phusion Passenger" do
152
227
  output = capture_output("passenger-config --detect-apache2")
153
228
  output.gsub!(/.*Final autodetection results\n/m, '')
154
229
  output.scan(/\* Found Apache .*\!/).size.should == 1
155
- output.should include("apxs2 : /usr/bin/apxs2\n")
156
- output.should include("Main executable: /usr/sbin/apache2\n")
157
- output.should include("Control command: /usr/sbin/apache2ctl\n")
158
- output.should include("Config file : /etc/apache2/apache2.conf\n")
159
- output.should include("Error log file : /var/log/apache2/error.log\n")
230
+ output.should include("apxs2 : #{APXS2}\n")
231
+ output.should include("Main executable: #{APACHE2}\n")
232
+ output.should include("Control command: #{APACHE2CTL}\n")
233
+ output.should include("Config file : #{APACHE_CONFIG_FILE}\n")
234
+ output.should include("Error log file : #{APACHE_ERROR_LOG}\n")
160
235
  output.should include(%Q{
161
236
  To start, stop or restart this specific Apache version:
162
- /usr/sbin/apache2ctl start
163
- /usr/sbin/apache2ctl stop
164
- /usr/sbin/apache2ctl restart})
237
+ #{APACHE2CTL} start
238
+ #{APACHE2CTL} stop
239
+ #{APACHE2CTL} restart})
165
240
  output.should include(%Q{
166
241
  To troubleshoot, please read the logs in this file:
167
- /var/log/apache2/error.log})
242
+ #{APACHE_ERROR_LOG}})
168
243
  end
169
244
 
170
245
  it "shows the directory to the runtime library headers" do
@@ -182,11 +257,16 @@ describe "A natively packaged Phusion Passenger" do
182
257
  File.file?(lib).should be_true
183
258
  end
184
259
  end
260
+
261
+ it "validates the install as working" do
262
+ system("passenger-config validate-install >/dev/null 2>/dev/null")
263
+ [0, Config::ValidateInstallCommand::WARN_EXIT_CODE].should include($?.exitstatus)
264
+ end
185
265
  end
186
266
 
187
267
  describe "passenger-memory-stats" do
188
268
  it "is in #{SBINDIR}" do
189
- which("passenger-memory-stats").should == "#{SBINDIR}/passenger-memory-stats"
269
+ realpath(which("passenger-memory-stats")).should == "#{SBINDIR}/passenger-memory-stats"
190
270
  end
191
271
 
192
272
  it "works" do
@@ -196,32 +276,42 @@ describe "A natively packaged Phusion Passenger" do
196
276
 
197
277
  describe "passenger-install-apache2-module" do
198
278
  it "is in #{BINDIR}" do
199
- which("passenger-install-apache2-module").should == "#{BINDIR}/passenger-install-apache2-module"
279
+ realpath(which("passenger-install-apache2-module")).should == "#{BINDIR}/passenger-install-apache2-module"
200
280
  end
201
281
 
202
- it "checks whether the Apache module is installed" do
203
- output = capture_output("passenger-install-apache2-module --auto")
204
- output.should =~ /Apache module is correctly installed/
282
+ if SUPPORTS_COMPILING_APACHE_MODULE
283
+ it "is able to compile the Apache module and doesn't break passenger-install-nginx-module" do
284
+ install_apache2_module
285
+ install_nginx_module
286
+ end
287
+ else
288
+ it "checks whether the Apache module is installed" do
289
+ output = capture_output("passenger-install-apache2-module --auto 2>&1")
290
+ output.should =~ /Apache module is correctly installed/
291
+ end
205
292
  end
206
293
  end
207
294
 
208
295
  describe "passenger-install-nginx-module" do
209
296
  it "is in #{BINDIR}" do
210
- which("passenger-install-nginx-module").should == "#{BINDIR}/passenger-install-nginx-module"
297
+ realpath(which("passenger-install-nginx-module")).should == "#{BINDIR}/passenger-install-nginx-module"
211
298
  end
212
299
 
213
- it "is able to compile Nginx" do
214
- Dir.mktmpdir do |path|
215
- output = capture_output("passenger-install-nginx-module --auto --prefix=#{path} --auto-download 2>&1")
216
- output.should include("passenger_root #{LOCATIONS_INI};")
217
- File.exist?("#{path}/sbin/nginx").should be_true
300
+ if SUPPORTS_COMPILING_APACHE_MODULE
301
+ it "is able to compile Nginx and doesn't break passenger-install-apache2-module" do
302
+ install_nginx_module
303
+ install_apache2_module
304
+ end
305
+ else
306
+ it "is able to compile Nginx" do
307
+ install_nginx_module
218
308
  end
219
309
  end
220
310
  end
221
311
 
222
312
  describe "Passenger Standalone" do
223
313
  it "is in #{BINDIR}" do
224
- which("passenger").should == "#{BINDIR}/passenger"
314
+ realpath(which("passenger")).should == "#{BINDIR}/passenger"
225
315
  end
226
316
 
227
317
  it "works" do
@@ -251,3 +341,5 @@ describe "A natively packaged Phusion Passenger" do
251
341
  end
252
342
  end
253
343
  end
344
+
345
+ end # module PhusionPassenger