passenger 4.0.10 → 4.0.13

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 (224) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +66 -0
  3. data/.travis.yml +2 -5
  4. data/CONTRIBUTORS +2 -1
  5. data/NEWS +24 -0
  6. data/README.md +5 -10
  7. data/bin/passenger +1 -0
  8. data/bin/passenger-config +29 -3
  9. data/bin/passenger-install-nginx-module +1 -1
  10. data/build/basics.rb +8 -2
  11. data/build/debian.rb +22 -0
  12. data/build/integration_tests.rb +16 -2
  13. data/build/misc.rb +3 -0
  14. data/build/packaging.rb +77 -29
  15. data/build/preprocessor.rb +13 -10
  16. data/build/test_basics.rb +6 -0
  17. data/debian.template/locations.ini.template +13 -0
  18. data/debian.template/ruby-passenger-dev.install.template +3 -0
  19. data/debian.template/ruby-passenger-doc.install.template +2 -0
  20. data/debian.template/ruby-passenger.install.template +12 -0
  21. data/debian.template/rules.template +1 -0
  22. data/dev/run_travis.sh +46 -14
  23. data/doc/Architectural overview.html +25 -34
  24. data/doc/Packaging.html +31 -23
  25. data/doc/Packaging.txt.md +32 -23
  26. data/doc/Security of user switching support.html +16 -18
  27. data/doc/Users guide Apache.html +231 -239
  28. data/doc/Users guide Nginx.html +219 -227
  29. data/doc/Users guide Standalone.html +12 -15
  30. data/doc/users_guide_snippets/installation.txt +3 -2
  31. data/ext/common/ApplicationPool2/Implementation.cpp +6 -16
  32. data/ext/common/Constants.h +1 -1
  33. data/ext/common/ResourceLocator.h +6 -6
  34. data/ext/common/UnionStation.h +11 -15
  35. data/ext/common/Utils/ProcessMetricsCollector.h +7 -4
  36. data/ext/common/agents/HelperAgent/AgentOptions.h +6 -0
  37. data/ext/common/agents/HelperAgent/Main.cpp +5 -0
  38. data/ext/common/agents/HelperAgent/RequestHandler.h +9 -1
  39. data/ext/common/agents/LoggingAgent/Main.cpp +4 -0
  40. data/ext/common/agents/Watchdog/Main.cpp +7 -0
  41. data/ext/nginx/config +1 -1
  42. data/ext/oxt/Readme.txt +15 -0
  43. data/helper-scripts/download_binaries/extconf.rb +83 -0
  44. data/lib/phusion_passenger.rb +78 -80
  45. data/lib/phusion_passenger/abstract_installer.rb +22 -8
  46. data/lib/phusion_passenger/console_text_template.rb +1 -1
  47. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -1
  48. data/lib/phusion_passenger/native_support.rb +22 -9
  49. data/lib/phusion_passenger/packaging.rb +7 -2
  50. data/lib/phusion_passenger/platform_info.rb +28 -1
  51. data/lib/phusion_passenger/platform_info/apache.rb +246 -26
  52. data/lib/phusion_passenger/platform_info/apache_detector.rb +232 -0
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +4 -0
  54. data/lib/phusion_passenger/platform_info/linux.rb +7 -0
  55. data/lib/phusion_passenger/public_api.rb +11 -2
  56. data/lib/phusion_passenger/standalone/command.rb +11 -14
  57. data/lib/phusion_passenger/standalone/runtime_installer.rb +313 -275
  58. data/lib/phusion_passenger/standalone/runtime_locator.rb +163 -0
  59. data/lib/phusion_passenger/standalone/start_command.rb +38 -46
  60. data/lib/phusion_passenger/utils/json.rb +329 -0
  61. data/lib/phusion_passenger/utils/tmpio.rb +1 -0
  62. data/passenger.gemspec +4 -0
  63. data/resources/mime.types +1 -0
  64. data/resources/oss-binaries.phusionpassenger.com.crt +84 -0
  65. data/resources/release.txt +0 -0
  66. data/resources/templates/standalone/download_tool_missing.txt.erb +18 -0
  67. data/rpm/README.rdoc +117 -0
  68. data/rpm/config/apache-passenger.conf.in +19 -0
  69. data/rpm/config/nginx-passenger.conf.in +10 -0
  70. data/rpm/config/rubygem-passenger.te +10 -0
  71. data/rpm/doc/README.nginx-alternatives +5 -0
  72. data/rpm/doc/example_yum_repository_htaccess +5 -0
  73. data/rpm/doc/footer.shtml +12 -0
  74. data/rpm/doc/header.shtml +156 -0
  75. data/rpm/nginx-alternatives.spec +97 -0
  76. data/rpm/passenger-release.spec +91 -0
  77. data/rpm/passenger.spec +667 -0
  78. data/rpm/patches/passenger-force-native.patch +63 -0
  79. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +33 -0
  80. data/rpm/release/build-release.sh +35 -0
  81. data/rpm/release/build.rb +301 -0
  82. data/rpm/release/create-mirrors.sh +16 -0
  83. data/rpm/release/mirrors +1 -0
  84. data/rpm/release/mock-repo/comps.xml +21 -0
  85. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  86. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  87. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  88. data/rpm/release/mocksetup-first.sh +102 -0
  89. data/rpm/release/mocksetup.sh +67 -0
  90. data/test/integration_tests/apache2_tests.rb +1 -1
  91. data/test/integration_tests/downloaded_binaries_tests.rb +76 -0
  92. data/test/integration_tests/native_packaging_spec.rb +38 -6
  93. data/test/integration_tests/source_packaging_test.rb +198 -0
  94. data/test/integration_tests/standalone_tests.rb +275 -0
  95. data/test/ruby/admin_tools_spec.rb +1 -1
  96. data/test/ruby/rails4.0/loader_spec.rb +28 -0
  97. data/test/ruby/rails4.0/preloader_spec.rb +34 -0
  98. data/test/ruby/spec_helper.rb +5 -1
  99. data/test/ruby/standalone/runtime_installer_spec.rb +399 -0
  100. data/test/ruby/standalone/runtime_locator_spec.rb +214 -0
  101. data/test/stub/apache2/httpd.conf.erb +18 -1
  102. data/test/stub/rack/tmp/.gitignore +0 -0
  103. data/test/stub/rails2.3/log/.gitignore +1 -0
  104. data/test/stub/rails2.3/public/.gitignore +1 -0
  105. data/test/stub/rails2.3/tmp/cache/.gitignore +1 -0
  106. data/test/stub/rails2.3/tmp/pids/.gitignore +1 -0
  107. data/test/stub/rails2.3/tmp/sessions/.gitignore +1 -0
  108. data/test/stub/rails2.3/tmp/sockets/.gitignore +1 -0
  109. data/test/stub/rails3.0/.gitignore +4 -0
  110. data/test/stub/rails3.0/Gemfile +1 -1
  111. data/test/stub/rails3.0/Gemfile.lock +1 -1
  112. data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
  113. data/test/stub/rails3.0/log/.gitignore +0 -0
  114. data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
  115. data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
  116. data/test/stub/rails3.1/.gitignore +15 -0
  117. data/test/stub/rails3.1/Gemfile +1 -1
  118. data/test/stub/rails3.1/Gemfile.lock +1 -1
  119. data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
  120. data/test/stub/rails3.1/app/models/.gitkeep +0 -0
  121. data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
  122. data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
  123. data/test/stub/rails3.1/log/.gitkeep +0 -0
  124. data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
  125. data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
  126. data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
  127. data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
  128. data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
  129. data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
  130. data/test/stub/rails3.2/.gitignore +15 -0
  131. data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
  132. data/test/stub/rails3.2/app/models/.gitkeep +0 -0
  133. data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
  134. data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
  135. data/test/stub/rails3.2/log/.gitkeep +0 -0
  136. data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
  137. data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
  138. data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
  139. data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
  140. data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
  141. data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
  142. data/test/stub/rails4.0/.gitignore +16 -0
  143. data/test/stub/rails4.0/Gemfile +45 -0
  144. data/test/stub/rails4.0/Gemfile.lock +126 -0
  145. data/test/stub/rails4.0/README.rdoc +28 -0
  146. data/test/stub/rails4.0/Rakefile +6 -0
  147. data/test/stub/rails4.0/app/assets/images/.keep +0 -0
  148. data/test/stub/rails4.0/app/assets/javascripts/application.js +16 -0
  149. data/test/stub/rails4.0/app/assets/stylesheets/application.css +13 -0
  150. data/test/stub/rails4.0/app/controllers/application_controller.rb +5 -0
  151. data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
  152. data/test/stub/rails4.0/app/helpers/application_helper.rb +2 -0
  153. data/test/stub/rails4.0/app/mailers/.keep +0 -0
  154. data/test/stub/rails4.0/app/models/.keep +0 -0
  155. data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
  156. data/test/stub/rails4.0/app/views/layouts/application.html.erb +14 -0
  157. data/test/stub/rails4.0/bin/bundle +3 -0
  158. data/test/stub/rails4.0/bin/rails +4 -0
  159. data/test/stub/rails4.0/bin/rake +4 -0
  160. data/test/stub/rails4.0/config.ru +4 -0
  161. data/test/stub/rails4.0/config/application.rb +23 -0
  162. data/test/stub/rails4.0/config/boot.rb +4 -0
  163. data/test/stub/rails4.0/config/database.yml +25 -0
  164. data/test/stub/rails4.0/config/environment.rb +5 -0
  165. data/test/stub/rails4.0/config/environments/development.rb +29 -0
  166. data/test/stub/rails4.0/config/environments/production.rb +80 -0
  167. data/test/stub/rails4.0/config/environments/test.rb +36 -0
  168. data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +7 -0
  169. data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +4 -0
  170. data/test/stub/rails4.0/config/initializers/inflections.rb +16 -0
  171. data/test/stub/rails4.0/config/initializers/mime_types.rb +5 -0
  172. data/test/stub/rails4.0/config/initializers/passenger.rb +1 -0
  173. data/test/stub/rails4.0/config/initializers/secret_token.rb +12 -0
  174. data/test/stub/rails4.0/config/initializers/session_store.rb +3 -0
  175. data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +14 -0
  176. data/test/stub/rails4.0/config/locales/en.yml +23 -0
  177. data/test/stub/rails4.0/config/routes.rb +57 -0
  178. data/test/stub/rails4.0/db/seeds.rb +7 -0
  179. data/test/stub/rails4.0/lib/assets/.keep +0 -0
  180. data/test/stub/rails4.0/lib/tasks/.keep +0 -0
  181. data/test/stub/rails4.0/log/.keep +0 -0
  182. data/test/stub/rails4.0/public/404.html +58 -0
  183. data/test/stub/rails4.0/public/422.html +58 -0
  184. data/test/stub/rails4.0/public/500.html +57 -0
  185. data/test/stub/rails4.0/public/favicon.ico +0 -0
  186. data/test/stub/rails4.0/public/robots.txt +5 -0
  187. data/test/stub/rails4.0/test/controllers/.keep +0 -0
  188. data/test/stub/rails4.0/test/fixtures/.keep +0 -0
  189. data/test/stub/rails4.0/test/helpers/.keep +0 -0
  190. data/test/stub/rails4.0/test/integration/.keep +0 -0
  191. data/test/stub/rails4.0/test/mailers/.keep +0 -0
  192. data/test/stub/rails4.0/test/models/.keep +0 -0
  193. data/test/stub/rails4.0/test/test_helper.rb +15 -0
  194. data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
  195. data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
  196. data/test/stub/rails_apps/1.2/empty/.gitignore +3 -0
  197. data/test/stub/rails_apps/1.2/empty/app/models/.gitignore +0 -0
  198. data/test/stub/rails_apps/1.2/empty/db/.gitignore +0 -0
  199. data/test/stub/rails_apps/1.2/empty/public/.htaccess +40 -0
  200. data/test/stub/rails_apps/1.2/empty/public/stylesheets/.gitignore +0 -0
  201. data/test/stub/rails_apps/2.0/empty/.gitignore +3 -0
  202. data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
  203. data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
  204. data/test/stub/rails_apps/2.0/empty/public/.htaccess +40 -0
  205. data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
  206. data/test/stub/rails_apps/2.2/empty/.gitignore +3 -0
  207. data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
  208. data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
  209. data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
  210. data/test/stub/rails_apps/2.3/empty/.gitignore +3 -0
  211. data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
  212. data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
  213. data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
  214. data/test/stub/rails_apps/2.3/mycook/public/.htaccess +42 -0
  215. data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
  216. data/test/stub/wsgi/tmp/.gitignore +0 -0
  217. data/test/valgrind-osx.supp +7 -0
  218. metadata +162 -8
  219. metadata.gz.asc +7 -7
  220. data/debian.template/locations.ini +0 -12
  221. data/debian.template/ruby-passenger-dev.install +0 -3
  222. data/debian.template/ruby-passenger-doc.install +0 -2
  223. data/debian.template/ruby-passenger.install +0 -11
  224. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +0 -19
@@ -0,0 +1 @@
1
+ http://passenger.stealthymonkeys.com/
@@ -0,0 +1,21 @@
1
+ <comps>
2
+ <!-- <meta> -->
3
+ <!-- Meta information will go here eventually -->
4
+ <!-- </meta> -->
5
+ <group>
6
+ <id>build-passenger</id>
7
+ <name>BuildPassenger</name>
8
+ <default>true</default>
9
+ <description>Build Requirements for Passenger</description>
10
+ <uservisible>true</uservisible>
11
+ <packagelist>
12
+ <packagereq type="default">rubygems</packagereq>
13
+ <packagereq type="default">pcre-devel</packagereq>
14
+ <packagereq type="default">perl-ExtUtils-Embed</packagereq>
15
+ <!-- For the passenger-standalone build -->
16
+ <packagereq type="default">rubygem-file-tail</packagereq>
17
+ <packagereq type="default">rubygem-daemon_controller</packagereq>
18
+ <packagereq type="optional">rubygem-rake</packagereq>
19
+ </packagelist>
20
+ </group>
21
+ </comps>
@@ -0,0 +1,102 @@
1
+ #!/bin/bash -e
2
+ # Checks whether all the prerequities for the package:rpm task are available.
3
+
4
+ BUILD_VERBOSITY=${BUILD_VERBOSITY:-0}
5
+ [ $BUILD_VERBOSITY -ge 3 ] && set -x
6
+
7
+ declare -a required_packages=(mock)
8
+ if grep -iq fedora /etc/redhat-release ; then
9
+ # fedora-packager has rpmbuild-md5 for the SRPM
10
+ required_packages=( ${required_packages[@]} fedora-packager )
11
+ else
12
+ required_packages=( ${required_packages[@]} rpm-build )
13
+ fi
14
+
15
+ while getopts ':p:' opt
16
+ do
17
+ case $opt in
18
+ p)
19
+ required_packages=( ${required_packages[@]} $OPTARG )
20
+ ;;
21
+ \?)
22
+ echo "Invalid flag -$OPTARG" >&2
23
+ exit 255
24
+ ;;
25
+ \:)
26
+ echo "missing argument to -$OPTARG" >&2
27
+ exit 127
28
+ ;;
29
+ esac
30
+ done
31
+ shift $(($OPTIND - 1))
32
+
33
+ repo=${1:-/var/lib/mock/passenger-build-repo}
34
+ etc=${2:-/etc/mock}
35
+
36
+ if [ "$(id -u)" == "0" ]; then
37
+ cat <<-EOF >&2
38
+ It is a very bad idea to run this build as root.
39
+ Use a less-privileged user. If that user is not a sudoer, you may need to run
40
+ a few commands as root before the first run. (Those commands will be determined
41
+ the first time through)
42
+ EOF
43
+ exit 1
44
+ fi
45
+
46
+ mock_installed=`rpm -q mock | grep -v 'not installed' | wc -l`
47
+ cfg_count=`ls -1 $etc/passenger-* 2>/dev/null | wc -l`
48
+ in_mock_group=`groups | grep mock | wc -l`
49
+
50
+ # Fedora has a utility to do this, but I don't know if RHEL does, plus it requires another package install, just do it by hand
51
+ mkdir -p `rpm -E '%{_topdir}'`/{SOURCES,SPECS,SRPMS,RPMS}
52
+
53
+ if [[ ( $cfg_count == 0 && ! -w $etc ) || ! ( -d $etc || -w $etc/.. ) || ! ( -w $repo || -w $repo/.. ) ]] ; then
54
+ run_setup=1
55
+ fi
56
+
57
+ declare -a yum_pkgs
58
+
59
+ for pkg in "${required_packages[@]}"
60
+ do
61
+ if [ `rpm -q $pkg | grep -v 'not installed' | wc -l` -eq 0 ] ; then
62
+ yum_pkgs=(${yum_pkgs[@]} $pkg)
63
+ fi
64
+ done
65
+
66
+ if [[ "$run_setup" = "1" || ! $in_mock_group == 1 || ${#yum_pkgs[@]} != 0 ]] ; then
67
+ echo "There is some setup required before building packages."
68
+ echo "We will run sudo to do the following:"
69
+
70
+ if [[ ${#yum_pkgs[@]} != 0 ]] ; then
71
+ echo " # yum -y install ${yum_pkgs[@]}"
72
+ fi
73
+
74
+ if [[ ! "$in_mock_group" == "1" ]] ; then
75
+ echo " # usermod -a -G mock $USER"
76
+ echo " (add you to the mock group, you will need to log back in for this to take effect)"
77
+ fi
78
+
79
+ if [[ "$run_setup" == "1" ]] ; then
80
+ echo " # `dirname $0`/mocksetup.sh"
81
+ echo " (sets up the dependencies for mock)"
82
+ fi
83
+ echo
84
+ echo "Hit return to continue, ^C to cancel"
85
+ read
86
+
87
+ if [[ ! $mock_installed == 1 || ! $createrepo_installed == 1 ]] ; then
88
+ sudo yum -y install "${yum_pkgs[@]}"
89
+ fi
90
+ if [[ ! "$in_mock_group" == "1" ]] ; then
91
+ sudo usermod -a -G mock $USER
92
+ fi
93
+ if [[ "$run_setup" == "1" ]] ; then
94
+ sudo `dirname $0`/mocksetup.sh $repo $etc
95
+ fi
96
+
97
+ if [[ ! "$in_mock_group" == "1" ]] ; then
98
+ echo "You have been added to the mock group. Please relogin for this to take effect, and re-run 'rake package:rpm'."
99
+ exit 4
100
+ fi
101
+ fi
102
+
@@ -0,0 +1,67 @@
1
+ #!/bin/sh
2
+
3
+ BUILD_VERBOSITY=${BUILD_VERBOSITY:-0}
4
+ [ $BUILD_VERBOSITY -ge 3 ] && set -x
5
+ set -e
6
+
7
+ repo=${1:-/var/lib/mock/passenger-build-repo}
8
+ etc=${2:-/etc/mock}
9
+ # For the written files & dirs, we want g+w, this isn't consistent enough
10
+ # umask 002
11
+
12
+ # For the non-groupinstall configs, pull the members out of the mock-comps.xml
13
+ prereqs=`egrep 'packagereq.*default' $(dirname $0)/mock-repo/comps.xml | cut -d\> -f2 | cut -d\< -f1 | tr '\n' ' '`
14
+
15
+ for cfg in $etc/{fedora-{13,14},epel-5}-*.cfg
16
+ do
17
+ [ $BUILD_VERBOSITY -ge 2 ] && echo $cfg
18
+ dir=`dirname $cfg`
19
+ base=`basename $cfg`
20
+ new=$dir/passenger-$base
21
+ perl -p - $repo "$prereqs" $cfg <<-'EOF' > $new
22
+ # Warning <<- only kills TABS (ASCII 0x9) DO NOT CONVERT THESE
23
+ # TABS TO SPACES -- IT WILL BREAK
24
+
25
+ sub BEGIN {
26
+ our $repo = shift;
27
+ our $prereqs = shift;
28
+ }
29
+
30
+ s{opts\['root'\]\s*=\s*'}{${&}passenger-}; #';
31
+ s{groupinstall [^']+}{$& Ruby build-passenger}; #'
32
+ s{\binstall buildsys-build}{$& ruby ruby-devel $prereqs};
33
+ s{^"""}{<<EndRepo . $&}e; #"
34
+
35
+ [build-passenger]
36
+ name=build-passenger
37
+ baseurl=file://$repo
38
+ EndRepo
39
+ EOF
40
+ chgrp mock $new 2>/dev/null || true
41
+ chmod g+w $new 2>/dev/null || true
42
+ done
43
+
44
+ mkdir -p $repo
45
+ chmod g+s $repo 2>/dev/null || true
46
+
47
+ if [ $BUILD_VERBOSITY -ge 1 ]; then
48
+ rsync_volume='-v'
49
+ if [ $BUILD_VERBOSITY -ge 2 ]; then
50
+ rsync_volume='-v --progress'
51
+ fi
52
+ fi
53
+
54
+ cp -ra `dirname $0`/mock-repo/* $repo
55
+ chgrp -R mock $repo 2>/dev/null || true
56
+
57
+ createrepo_volume=
58
+ if [ $BUILD_VERBOSITY -gt 1 ]; then
59
+ createrepo_volume='-v'
60
+ else
61
+ if [ $BUILD_VERBOSITY -le 0 ]; then
62
+ createrepo_volume='-q'
63
+ fi
64
+ fi
65
+
66
+ createrepo $createrepo_volume -g comps.xml $repo
67
+ chmod -R g+w $repo 2>/dev/null || true
@@ -408,7 +408,7 @@ describe "Apache 2 module" do
408
408
  end
409
409
  end
410
410
 
411
- describe "HelperServer" do
411
+ describe "HelperAgent" do
412
412
  AdminTools = PhusionPassenger::AdminTools
413
413
 
414
414
  before :all do
@@ -0,0 +1,76 @@
1
+ source_root = File.expand_path("../..", File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift("#{source_root}/lib")
3
+ require 'phusion_passenger'
4
+ PhusionPassenger.locate_directories
5
+ require 'tmpdir'
6
+ require 'fileutils'
7
+ require 'open-uri'
8
+
9
+ ENV['PATH'] = "#{PhusionPassenger.bin_dir}:#{ENV['PATH']}"
10
+ # This environment variable changes Passenger Standalone's behavior,
11
+ # so ensure that it's not set.
12
+ ENV.delete('PASSENGER_DEBUG')
13
+
14
+ describe "Downloaded Phusion Passenger binaries" do
15
+ before :each do
16
+ @temp_dir = Dir.mktmpdir
17
+ File.open("#{PhusionPassenger.resources_dir}/release.txt", "w").close
18
+ end
19
+
20
+ after :each do
21
+ FileUtils.remove_entry_secure(@temp_dir)
22
+ File.unlink("#{PhusionPassenger.resources_dir}/release.txt")
23
+ end
24
+
25
+ let(:version) { PhusionPassenger::VERSION_STRING }
26
+ let(:nginx_version) { PhusionPassenger::PREFERRED_NGINX_VERSION }
27
+ let(:compat_id) { PhusionPassenger::PlatformInfo.cxx_binary_compatibility_id }
28
+
29
+ def sh(*command)
30
+ if !system(*command)
31
+ abort "Command failed: #{command.join(' ')}"
32
+ end
33
+ end
34
+
35
+ it "works" do
36
+ Dir.mkdir("#{@temp_dir}/#{version}")
37
+ Dir.chdir("#{@temp_dir}/#{version}") do
38
+ tarballs = Dir["#{PhusionPassenger.download_cache_dir}/*.tar.gz"]
39
+ tarballs.should_not be_empty
40
+
41
+ File.open("config.ru", "w") do |f|
42
+ f.write(%Q{
43
+ app = lambda do |env|
44
+ [200, { "Content-Type" => "text/plain" }, ["ok"]]
45
+ end
46
+ run app
47
+ })
48
+ end
49
+ Dir.mkdir("public")
50
+ Dir.mkdir("tmp")
51
+ Dir.mkdir("log")
52
+
53
+ begin
54
+ sh("passenger start " +
55
+ "-p 4000 " +
56
+ "-d " +
57
+ "--no-compile-runtime " +
58
+ "--binaries-url-root http://127.0.0.1:4001 " +
59
+ "--runtime-dir '#{@temp_dir}' >log/start.log")
60
+ rescue Exception
61
+ system("cat log/start.log")
62
+ raise
63
+ end
64
+ begin
65
+ open("http://127.0.0.1:4000/") do |f|
66
+ f.read.should == "ok"
67
+ end
68
+ rescue
69
+ system("cat log/passenger.4000.log")
70
+ raise
71
+ ensure
72
+ sh "passenger stop -p 4000"
73
+ end
74
+ end
75
+ end
76
+ end
@@ -22,19 +22,28 @@
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
+
25
30
  # Ensure that the natively installed tools are in PATH.
26
31
  ENV['PATH'] = "/usr/bin:#{ENV['PATH']}"
27
32
  LOCATIONS_INI = ENV['LOCATIONS_INI']
28
33
  abort "Please set the LOCATIONS_INI environment variable to the right locations.ini" if !LOCATIONS_INI
29
34
 
35
+ source_root = File.expand_path("../..", File.dirname(__FILE__))
36
+ $LOAD_PATH.unshift("#{source_root}/lib")
37
+ require 'phusion_passenger'
38
+
30
39
  BINDIR = "/usr/bin"
31
40
  SBINDIR = "/usr/sbin"
32
- INCLUDEDIR = "/usr/share/passenger/include"
33
- NGINX_ADDON_DIR = "/usr/share/passenger/ngx_http_passenger_module"
41
+ INCLUDEDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/include"
42
+ NGINX_ADDON_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
34
43
  DOCDIR = "/usr/share/doc/ruby-passenger"
35
- RESOURCESDIR = "/usr/share/passenger"
36
- RUBY_EXTENSION_SOURCE_DIR = "/usr/share/passenger/ruby_extension_source"
37
- AGENTS_DIR = "/usr/lib/passenger/agents"
44
+ RESOURCESDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}"
45
+ RUBY_EXTENSION_SOURCE_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
46
+ AGENTS_DIR = "/usr/lib/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/agents"
38
47
  APACHE2_MODULE_PATH = "/usr/lib/apache2/modules/mod_passenger.so"
39
48
 
40
49
  describe "A natively packaged Phusion Passenger" do
@@ -43,7 +52,7 @@ describe "A natively packaged Phusion Passenger" do
43
52
  if $?.exitstatus == 0
44
53
  return output
45
54
  else
46
- abort "Command #{command.join(' ')} exited with status #{$?.exitstatus}"
55
+ abort "Command #{command} exited with status #{$?.exitstatus}"
47
56
  end
48
57
  end
49
58
 
@@ -122,6 +131,29 @@ describe "A natively packaged Phusion Passenger" do
122
131
  system("passenger-config --natively-packaged").should be_true
123
132
  end
124
133
 
134
+ it "recognizes the install as coming from an official package" do
135
+ system("passenger-config --installed-from-release-package").should be_true
136
+ end
137
+
138
+ it "recognizes the system's Apache" do
139
+ output = capture_output("passenger-config --detect-apache2")
140
+ output.gsub!(/.*Final autodetection results\n/m, '')
141
+ output.scan(/\* Found Apache .*\!/).size.should == 1
142
+ output.should include("apxs2 : /usr/bin/apxs2\n")
143
+ output.should include("Main executable: /usr/sbin/apache2\n")
144
+ output.should include("Control command: /usr/sbin/apache2ctl\n")
145
+ output.should include("Config file : /etc/apache2/apache2.conf\n")
146
+ output.should include("Error log file : /var/log/apache2/error.log\n")
147
+ output.should include(%Q{
148
+ To start, stop or restart this specific Apache version:
149
+ /usr/sbin/apache2ctl start
150
+ /usr/sbin/apache2ctl stop
151
+ /usr/sbin/apache2ctl restart})
152
+ output.should include(%Q{
153
+ To troubleshoot, please read the logs in this file:
154
+ /var/log/apache2/error.log})
155
+ end
156
+
125
157
  it "shows the directory to the runtime library headers" do
126
158
  capture_output("passenger-config --includedir").should == INCLUDEDIR
127
159
  end
@@ -0,0 +1,198 @@
1
+ # Phusion Passenger - https://www.phusionpassenger.com/
2
+ # Copyright (c) 2013 Phusion
3
+ #
4
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+
24
+ SOURCE_ROOT = File.expand_path("../..", File.dirname(__FILE__))
25
+ Dir.chdir(SOURCE_ROOT)
26
+ $LOAD_PATH.unshift("#{SOURCE_ROOT}/lib")
27
+ require 'phusion_passenger'
28
+ require 'phusion_passenger/packaging'
29
+ require 'rubygems'
30
+ require 'tmpdir'
31
+ require 'fileutils'
32
+ require 'yaml'
33
+
34
+ PACKAGE_NAME = PhusionPassenger::PACKAGE_NAME
35
+ VERSION = PhusionPassenger::VERSION_STRING
36
+ if RUBY_PLATFORM =~ /linux/
37
+ TAR = "tar --warning=none"
38
+ else
39
+ TAR = "tar"
40
+ end
41
+
42
+ def sh(*command)
43
+ if !system(*command)
44
+ abort "Command failed: #{command.join(' ')}"
45
+ end
46
+ end
47
+
48
+ shared_examples_for "a proper package" do
49
+ it "includes all files in the git repository" do
50
+ git_files = `git ls-files`.split("\n")
51
+ git_files.reject! { |filename| filename =~ /^Passenger.xcodeproj\// }
52
+ git_files.delete("ext/libeio/eio.3")
53
+ git_files.delete("ext/libeio/eio.pod")
54
+
55
+ package_files = {}
56
+ Dir.chdir(@pkg_contents_dir) do
57
+ `find .`.split("\n").each do |filename|
58
+ filename.sub!(/^.\//, '')
59
+ if !File.directory?(filename)
60
+ package_files[filename] = true
61
+ end
62
+ end
63
+ end
64
+
65
+ error = false
66
+ git_files.each do |filename|
67
+ if !package_files[filename]
68
+ error = true
69
+ puts "File \"#{filename}\" is not in the package"
70
+ end
71
+ end
72
+ raise "Some files are not in the package" if error
73
+ end
74
+
75
+ it "includes documentation HTML files" do
76
+ File.exist?("#{@pkg_contents_dir}/doc/Users guide Apache.html").should be_true
77
+ File.exist?("#{@pkg_contents_dir}/doc/Users guide Nginx.html").should be_true
78
+ File.exist?("#{@pkg_contents_dir}/doc/Users guide Standalone.html").should be_true
79
+ end
80
+ end
81
+
82
+ shared_examples_for "a user-generated package" do
83
+ it "isn't marked official" do
84
+ File.exist?("#{@pkg_contents_dir}/resources/release.txt").should be_false
85
+ end
86
+ end
87
+
88
+ shared_examples_for "an official package" do
89
+ it "is marked official" do
90
+ File.exist?("#{@pkg_contents_dir}/resources/release.txt").should be_true
91
+ end
92
+ end
93
+
94
+ describe "A user-generated gem" do
95
+ before :all do
96
+ ENV['PKG_DIR'] = @temp_dir = Dir.mktmpdir
97
+ basename = "#{PACKAGE_NAME}-#{VERSION}"
98
+ @pkg_contents_dir = "#{@temp_dir}/#{basename}"
99
+ Dir.chdir(SOURCE_ROOT) do
100
+ sh "rake", *PhusionPassenger::Packaging::PREGENERATED_FILES
101
+ sh "gem build #{PACKAGE_NAME}.gemspec"
102
+ sh "mv #{PACKAGE_NAME}-#{VERSION}.gem #{@temp_dir}/"
103
+ end
104
+ Dir.chdir(@temp_dir) do
105
+ sh "#{TAR} -xf #{basename}.gem"
106
+ sh "mkdir #{basename}"
107
+ sh "gunzip metadata.gz"
108
+ Dir.chdir(basename) do
109
+ sh "#{TAR} -xzf ../data.tar.gz"
110
+ end
111
+ end
112
+ end
113
+
114
+ after :all do
115
+ ENV.delete('PKG_DIR')
116
+ FileUtils.remove_entry_secure(@temp_dir)
117
+ end
118
+
119
+ it_behaves_like "a proper package"
120
+ it_behaves_like "a user-generated package"
121
+
122
+ it "doesn't invoke the binaries downloader upon gem installation" do
123
+ spec = YAML.load_file("#{@temp_dir}/metadata")
124
+ spec.extensions.should be_empty
125
+ end
126
+ end
127
+
128
+ describe "A user-generated tarball" do
129
+ before :all do
130
+ ENV['PKG_DIR'] = @temp_dir = Dir.mktmpdir
131
+ basename = "#{PACKAGE_NAME}-#{VERSION}"
132
+ @pkg_contents_dir = "#{@temp_dir}/#{basename}"
133
+ sh "rake package:tarball"
134
+ Dir.chdir(@temp_dir) do
135
+ sh "#{TAR} -xzf #{basename}.tar.gz"
136
+ end
137
+ end
138
+
139
+ after :all do
140
+ ENV.delete('PKG_DIR')
141
+ FileUtils.remove_entry_secure(@temp_dir)
142
+ end
143
+
144
+ it_behaves_like "a proper package"
145
+ it_behaves_like "a user-generated package"
146
+ end
147
+
148
+ describe "An officially-generated gem" do
149
+ before :all do
150
+ ENV['PKG_DIR'] = @temp_dir = Dir.mktmpdir
151
+ basename = "#{PACKAGE_NAME}-#{VERSION}"
152
+ @pkg_contents_dir = "#{@temp_dir}/#{basename}"
153
+ Dir.chdir(SOURCE_ROOT) do
154
+ sh "rake package:set_official package:gem SKIP_SIGNING=1"
155
+ end
156
+ Dir.chdir(@temp_dir) do
157
+ sh "#{TAR} -xf #{basename}.gem"
158
+ sh "mkdir #{basename}"
159
+ sh "gunzip metadata.gz"
160
+ Dir.chdir(basename) do
161
+ sh "#{TAR} -xzf ../data.tar.gz"
162
+ end
163
+ end
164
+ end
165
+
166
+ after :all do
167
+ ENV.delete('PKG_DIR')
168
+ FileUtils.remove_entry_secure(@temp_dir)
169
+ end
170
+
171
+ it_behaves_like "a proper package"
172
+ it_behaves_like "an official package"
173
+
174
+ it "invokes the binaries downloader upon gem installation" do
175
+ spec = YAML.load_file("#{@temp_dir}/metadata")
176
+ spec.extensions.should_not be_empty
177
+ end
178
+ end
179
+
180
+ describe "An officially-generated tarball" do
181
+ before :all do
182
+ ENV['PKG_DIR'] = @temp_dir = Dir.mktmpdir
183
+ basename = "#{PACKAGE_NAME}-#{VERSION}"
184
+ @pkg_contents_dir = "#{@temp_dir}/#{basename}"
185
+ sh "rake package:set_official package:tarball"
186
+ Dir.chdir(@temp_dir) do
187
+ sh "#{TAR} -xzf #{basename}.tar.gz"
188
+ end
189
+ end
190
+
191
+ after :all do
192
+ ENV.delete('PKG_DIR')
193
+ FileUtils.remove_entry_secure(@temp_dir)
194
+ end
195
+
196
+ it_behaves_like "a proper package"
197
+ it_behaves_like "an official package"
198
+ end