passenger 4.0.48 → 4.0.49

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 (218) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +36 -2
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG +16 -0
  7. data/Rakefile +0 -1
  8. data/build/apache2.rb +4 -4
  9. data/build/common_library.rb +18 -18
  10. data/build/cplusplus_support.rb +2 -2
  11. data/build/documentation.rb +1 -1
  12. data/build/integration_tests.rb +12 -4
  13. data/build/misc.rb +12 -7
  14. data/build/packaging.rb +14 -14
  15. data/build/preprocessor.rb +10 -10
  16. data/build/rake_extensions.rb +11 -11
  17. data/build/ruby_extension.rb +2 -2
  18. data/dev/ci/inituidgid +24 -0
  19. data/dev/ci/run_jenkins.sh +57 -0
  20. data/dev/ci/run_rpm_tests.sh +77 -0
  21. data/dev/{run_travis.sh → ci/run_travis.sh} +60 -4
  22. data/doc/Users guide Nginx.txt +2 -2
  23. data/doc/users_guide_snippets/environment_variables.txt +0 -2
  24. data/doc/users_guide_snippets/tips.txt +20 -1
  25. data/ext/apache2/Bucket.cpp +18 -18
  26. data/ext/apache2/Bucket.h +4 -4
  27. data/ext/apache2/Configuration.cpp +7 -7
  28. data/ext/apache2/Configuration.hpp +43 -43
  29. data/ext/apache2/DirectoryMapper.h +5 -5
  30. data/ext/apache2/Hooks.cpp +142 -142
  31. data/ext/apache2/MergeDirConfig.cpp +40 -40
  32. data/ext/common/Account.h +17 -17
  33. data/ext/common/AccountsDatabase.h +9 -9
  34. data/ext/common/AgentsStarter.cpp +2 -2
  35. data/ext/common/AgentsStarter.h +40 -40
  36. data/ext/common/ApplicationPool2/Common.h +10 -6
  37. data/ext/common/ApplicationPool2/ComponentInfo.h +2 -2
  38. data/ext/common/ApplicationPool2/DirectSpawner.h +17 -17
  39. data/ext/common/ApplicationPool2/DummySpawner.h +5 -5
  40. data/ext/common/ApplicationPool2/Group.h +54 -38
  41. data/ext/common/ApplicationPool2/Implementation.cpp +76 -49
  42. data/ext/common/ApplicationPool2/Options.h +98 -91
  43. data/ext/common/ApplicationPool2/Pool.h +70 -69
  44. data/ext/common/ApplicationPool2/Process.h +21 -21
  45. data/ext/common/ApplicationPool2/Session.h +11 -11
  46. data/ext/common/ApplicationPool2/SmartSpawner.h +60 -60
  47. data/ext/common/ApplicationPool2/Socket.h +19 -19
  48. data/ext/common/ApplicationPool2/Spawner.h +64 -72
  49. data/ext/common/ApplicationPool2/SpawnerFactory.h +4 -4
  50. data/ext/common/ApplicationPool2/SuperGroup.h +41 -41
  51. data/ext/common/BackgroundEventLoop.cpp +1 -1
  52. data/ext/common/BackgroundEventLoop.h +2 -2
  53. data/ext/common/Constants.h +1 -1
  54. data/ext/common/EventedBufferedInput.h +5 -5
  55. data/ext/common/EventedClient.h +51 -51
  56. data/ext/common/EventedMessageServer.h +39 -39
  57. data/ext/common/EventedServer.h +32 -32
  58. data/ext/common/Exceptions.h +23 -23
  59. data/ext/common/FileDescriptor.h +18 -18
  60. data/ext/common/Logging.cpp +1 -1
  61. data/ext/common/MessageClient.h +27 -27
  62. data/ext/common/MessageReadersWriters.h +79 -79
  63. data/ext/common/MessageServer.h +59 -59
  64. data/ext/common/RandomGenerator.h +12 -12
  65. data/ext/common/ResourceLocator.h +8 -8
  66. data/ext/common/SafeLibev.h +54 -25
  67. data/ext/common/ServerInstanceDir.h +31 -31
  68. data/ext/common/StaticString.h +50 -48
  69. data/ext/common/Utils.cpp +73 -78
  70. data/ext/common/Utils.h +6 -6
  71. data/ext/common/Utils/Base64.cpp +3 -3
  72. data/ext/common/Utils/Base64.h +7 -7
  73. data/ext/common/Utils/BlockingQueue.h +9 -9
  74. data/ext/common/Utils/BufferedIO.h +17 -17
  75. data/ext/common/Utils/CachedFileStat.hpp +16 -16
  76. data/ext/common/Utils/Dechunker.h +25 -25
  77. data/ext/common/Utils/FileChangeChecker.h +10 -10
  78. data/ext/common/Utils/MemZeroGuard.h +5 -5
  79. data/ext/common/Utils/MemoryBarrier.h +1 -1
  80. data/ext/common/Utils/MessageIO.h +61 -61
  81. data/ext/common/Utils/ProcessMetricsCollector.h +40 -40
  82. data/ext/common/Utils/ScopeGuard.h +7 -7
  83. data/ext/common/Utils/SpeedMeter.h +1 -1
  84. data/ext/common/Utils/StrIntUtils.cpp +13 -13
  85. data/ext/common/Utils/StrIntUtils.h +3 -3
  86. data/ext/common/Utils/StringScanning.h +5 -5
  87. data/ext/common/Utils/SystemMetricsCollector.h +2 -2
  88. data/ext/common/Utils/SystemTime.h +10 -10
  89. data/ext/common/Utils/Template.h +2 -2
  90. data/ext/common/Utils/Timer.h +6 -6
  91. data/ext/common/Utils/VariantMap.h +29 -29
  92. data/ext/common/agents/Base.cpp +19 -19
  93. data/ext/common/agents/HelperAgent/AgentOptions.h +1 -1
  94. data/ext/common/agents/HelperAgent/FileBackedPipe.h +6 -6
  95. data/ext/common/agents/HelperAgent/Main.cpp +44 -43
  96. data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
  97. data/ext/common/agents/HelperAgent/RequestHandler.h +29 -28
  98. data/ext/common/agents/HelperAgent/ScgiRequestParser.h +56 -50
  99. data/ext/common/agents/LoggingAgent/AdminController.h +8 -8
  100. data/ext/common/agents/LoggingAgent/DataStoreId.h +17 -17
  101. data/ext/common/agents/LoggingAgent/FilterSupport.h +167 -167
  102. data/ext/common/agents/LoggingAgent/LoggingServer.h +122 -122
  103. data/ext/common/agents/LoggingAgent/Main.cpp +7 -7
  104. data/ext/common/agents/LoggingAgent/RemoteSender.h +54 -54
  105. data/ext/common/agents/SpawnPreparer.cpp +4 -4
  106. data/ext/common/agents/TempDirToucher.c +2 -2
  107. data/ext/common/agents/Watchdog/AgentWatcher.cpp +47 -47
  108. data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +7 -7
  109. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +7 -7
  110. data/ext/common/agents/Watchdog/Main.cpp +22 -22
  111. data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +9 -9
  112. data/ext/libeio/eio.c +1 -1
  113. data/ext/nginx/Configuration.c +30 -30
  114. data/ext/nginx/Configuration.h +1 -1
  115. data/ext/nginx/ContentHandler.c +54 -54
  116. data/ext/nginx/ContentHandler.h +3 -3
  117. data/ext/nginx/StaticContentHandler.c +2 -2
  118. data/ext/nginx/ngx_http_passenger_module.c +21 -21
  119. data/ext/oxt/detail/backtrace_enabled.hpp +1 -1
  120. data/ext/oxt/detail/context.hpp +1 -1
  121. data/ext/oxt/detail/spin_lock_darwin.hpp +4 -4
  122. data/ext/oxt/detail/spin_lock_gcc_x86.hpp +3 -3
  123. data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
  124. data/ext/oxt/detail/tracable_exception_disabled.hpp +1 -1
  125. data/ext/oxt/dynamic_thread_group.hpp +18 -18
  126. data/ext/oxt/implementation.cpp +9 -8
  127. data/ext/oxt/macros.hpp +2 -2
  128. data/ext/oxt/system_calls.cpp +11 -11
  129. data/ext/oxt/system_calls.hpp +13 -13
  130. data/ext/oxt/thread.hpp +22 -14
  131. data/ext/ruby/passenger_native_support.c +55 -55
  132. data/lib/phusion_passenger.rb +24 -24
  133. data/lib/phusion_passenger/common_library.rb +2 -0
  134. data/lib/phusion_passenger/loader_shared_helpers.rb +18 -18
  135. data/lib/phusion_passenger/packaging.rb +9 -4
  136. data/lib/phusion_passenger/platform_info/apache.rb +45 -31
  137. data/lib/phusion_passenger/platform_info/compiler.rb +11 -11
  138. data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  139. data/lib/phusion_passenger/request_handler/thread_handler.rb +8 -8
  140. data/lib/phusion_passenger/standalone/app_finder.rb +16 -16
  141. data/lib/phusion_passenger/standalone/command.rb +22 -22
  142. data/packaging/rpm/LICENSE.txt +19 -0
  143. data/packaging/rpm/Makefile +13 -0
  144. data/packaging/rpm/README.md +41 -0
  145. data/packaging/rpm/Vagrantfile +38 -0
  146. data/{rpm/Vagrantfile → packaging/rpm/Vagrantfile.centos} +0 -0
  147. data/packaging/rpm/build +170 -0
  148. data/packaging/rpm/create_project +41 -0
  149. data/packaging/rpm/git_update +88 -0
  150. data/packaging/rpm/image/Dockerfile +37 -0
  151. data/packaging/rpm/image/Gemfile +3 -0
  152. data/packaging/rpm/image/Gemfile.lock +12 -0
  153. data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +19 -0
  154. data/packaging/rpm/image/amazon2014-i386.cfg +96 -0
  155. data/packaging/rpm/image/amazon2014-x86_64.cfg +96 -0
  156. data/packaging/rpm/image/site-defaults.cfg +168 -0
  157. data/packaging/rpm/internal/build_tasks.rb +238 -0
  158. data/packaging/rpm/internal/dummygpg +11 -0
  159. data/packaging/rpm/internal/exec_build +42 -0
  160. data/packaging/rpm/internal/get_distro_arch +14 -0
  161. data/packaging/rpm/internal/get_distro_id +10 -0
  162. data/packaging/rpm/internal/git_update +27 -0
  163. data/packaging/rpm/internal/inituidgid +17 -0
  164. data/packaging/rpm/internal/my_init +344 -0
  165. data/packaging/rpm/internal/python27 +3 -0
  166. data/packaging/rpm/internal/repo_update +46 -0
  167. data/packaging/rpm/internal/setuser +26 -0
  168. data/packaging/rpm/internal/tracking_helper +40 -0
  169. data/packaging/rpm/jenkins_release +99 -0
  170. data/packaging/rpm/lib/build_tasks_support.rb +402 -0
  171. data/packaging/rpm/lib/preprocessor.rb +341 -0
  172. data/packaging/rpm/nginx_spec/404.html +119 -0
  173. data/packaging/rpm/nginx_spec/50x.html +119 -0
  174. data/packaging/rpm/nginx_spec/index.html +116 -0
  175. data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +13 -0
  176. data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
  177. data/packaging/rpm/nginx_spec/nginx-upgrade +13 -0
  178. data/packaging/rpm/nginx_spec/nginx-upgrade.8 +151 -0
  179. data/packaging/rpm/nginx_spec/nginx.conf +131 -0
  180. data/packaging/rpm/nginx_spec/nginx.init +144 -0
  181. data/packaging/rpm/nginx_spec/nginx.logrotate +13 -0
  182. data/packaging/rpm/nginx_spec/nginx.service +15 -0
  183. data/packaging/rpm/nginx_spec/nginx.spec.template +559 -0
  184. data/packaging/rpm/nginx_spec/nginx.sysconfig +4 -0
  185. data/packaging/rpm/nginx_spec/passenger.conf +9 -0
  186. data/packaging/rpm/nginx_spec/poweredby.png +0 -0
  187. data/{rpm → packaging/rpm/passenger_spec}/apache-passenger.conf.in +0 -0
  188. data/{rpm → packaging/rpm/passenger_spec}/config.json +0 -0
  189. data/{rpm → packaging/rpm/passenger_spec}/passenger.logrotate +0 -0
  190. data/{rpm → packaging/rpm/passenger_spec}/passenger.spec.template +58 -31
  191. data/{rpm → packaging/rpm/passenger_spec}/passenger_dynamic_thread_group.patch +0 -0
  192. data/{rpm → packaging/rpm/passenger_spec}/passenger_tests_default_config_example.patch +0 -0
  193. data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -0
  194. data/{rpm → packaging/rpm/passenger_spec}/rubygem-passenger-4.0.18-gcc47-include-sys_types.patch +0 -0
  195. data/packaging/rpm/repo_update +114 -0
  196. data/packaging/rpm/setup-system +60 -0
  197. data/packaging/rpm/shell +10 -0
  198. data/resources/templates/standalone/config.erb +3 -1
  199. data/test/config.json.rpm-automation +1 -1
  200. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +11 -11
  201. data/test/cxx/ApplicationPool2/OptionsTest.cpp +5 -5
  202. data/test/cxx/ApplicationPool2/PoolTest.cpp +129 -89
  203. data/test/cxx/ApplicationPool2/ProcessTest.cpp +15 -15
  204. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +22 -22
  205. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +11 -11
  206. data/test/cxx/ScgiRequestParserTest.cpp +75 -61
  207. data/test/cxx/UtilsTest.cpp +86 -85
  208. data/test/gdbinit.example +3 -0
  209. data/test/integration_tests/nginx_tests.rb +3 -3
  210. data/test/integration_tests/source_packaging_test.rb +3 -1
  211. data/test/stub/nginx/nginx.conf.erb +8 -1
  212. data/test/support/nginx_controller.rb +7 -7
  213. metadata +62 -17
  214. metadata.gz.asc +7 -7
  215. data/build/rpm.rb +0 -128
  216. data/dev/rpmtool +0 -21
  217. data/dev/test_rpm_packaging.sh +0 -28
  218. data/rpm/get_distro_id.py +0 -4
@@ -24,7 +24,7 @@
24
24
 
25
25
  # Implements a simple preprocessor language which combines elements in the C
26
26
  # preprocessor with ERB:
27
- #
27
+ #
28
28
  # Today
29
29
  # #if @today == :fine
30
30
  # is a fine day.
@@ -35,20 +35,20 @@
35
35
  # #endif
36
36
  # Let's go walking.
37
37
  # Today is <%= Time.now %>.
38
- #
38
+ #
39
39
  # When run with...
40
- #
40
+ #
41
41
  # Preprocessor.new.start('input.txt', 'output.txt', :today => :fine)
42
- #
42
+ #
43
43
  # ...will produce:
44
- #
44
+ #
45
45
  # Today
46
46
  # is a fine day.
47
47
  # Let's go walking.
48
48
  # Today is 2013-08-11 22:37:06 +0200.
49
- #
49
+ #
50
50
  # Highlights:
51
- #
51
+ #
52
52
  # * #if blocks can be nested.
53
53
  # * Expressions are Ruby expressions, evaluated within the binding of a
54
54
  # Preprocessor::Evaluator object.
@@ -228,7 +228,7 @@ private
228
228
  return false if table1 != table2
229
229
  v1 = table1[@distribution]
230
230
  v2 = table2[name]
231
-
231
+
232
232
  case comparator
233
233
  when ">"
234
234
  return v1 > v2
@@ -259,7 +259,7 @@ private
259
259
  yield line.chomp
260
260
  end
261
261
  end
262
-
262
+
263
263
  def recognize_command(line)
264
264
  if line =~ /^([\s\t]*)#(.+)/
265
265
  indentation_str = $1
@@ -309,7 +309,7 @@ private
309
309
  # Declare tabs as equivalent to 4 spaces. This is necessary for
310
310
  # Makefiles in which the use of tabs is required.
311
311
  found = $1.to_s.gsub("\t", " ").size
312
-
312
+
313
313
  if found >= @indentation
314
314
  # Tab-friendly way to remove indentation.
315
315
  remaining = @indentation
@@ -34,7 +34,7 @@ module RakeExtensions
34
34
  # sh 'gcc foo.c -shared -fPIC -o libfoo.so'
35
35
  # end
36
36
  # end
37
- #
37
+ #
38
38
  # subdir 'bar' do
39
39
  # file 'bar' => ['bar.c', '../foo/libfoo.so'] do
40
40
  # sh 'gcc bar.c -o bar -L../foo -lfoo'
@@ -48,7 +48,7 @@ module RakeExtensions
48
48
  # sh 'gcc foo.c -shared -fPIC -o libfoo.so'
49
49
  # end
50
50
  # end
51
- #
51
+ #
52
52
  # file 'bar/bar' => ['bar/bar.c', 'foo/libfoo.so'] do
53
53
  # Dir.chdir('bar') do
54
54
  # sh 'gcc bar.c -o bar -L../foo -lfoo'
@@ -62,11 +62,11 @@ module RakeExtensions
62
62
  #
63
63
  # subdir 'foo' do
64
64
  # task 'super_app' => ['super_app:compile', 'super_app:unit_test']
65
- #
65
+ #
66
66
  # task 'super_app:compile' do
67
67
  # ...
68
68
  # end
69
- #
69
+ #
70
70
  # task 'super_app:unit_test' do
71
71
  # ...
72
72
  # end
@@ -77,11 +77,11 @@ module RakeExtensions
77
77
  # subdir 'foo' do
78
78
  # # !!!!!!!
79
79
  # task 'super_app' => ['foo/super_app:compile', 'foo/super_app:unit_test']
80
- #
80
+ #
81
81
  # task 'super_app:compile' do
82
82
  # ...
83
83
  # end
84
- #
84
+ #
85
85
  # task 'super_app:unit_test' do
86
86
  # ...
87
87
  # end
@@ -108,12 +108,12 @@ class Subdir # :nodoc:
108
108
  # aren't available in Object anymore.
109
109
  # See: https://github.com/jimweirich/rake/issues/33#issuecomment-1213705
110
110
  include Rake::DSL if defined?(Rake::DSL)
111
-
111
+
112
112
  def initialize(dir)
113
113
  @dir = dir
114
114
  @toplevel_dir = Pathname.getwd
115
115
  end
116
-
116
+
117
117
  def file(args, &block)
118
118
  case args
119
119
  when String
@@ -131,7 +131,7 @@ class Subdir # :nodoc:
131
131
  puts ""
132
132
  end
133
133
  end
134
-
134
+
135
135
  def task(*args, &block)
136
136
  if !args.empty? && args[0].is_a?(Hash)
137
137
  target = args[0].keys[0]
@@ -156,7 +156,7 @@ private
156
156
  path = File.expand_path(path)
157
157
  return Pathname.new(path).relative_path_from(@toplevel_dir).to_s
158
158
  end
159
-
159
+
160
160
  def mangle_path_array(array)
161
161
  array = array.dup
162
162
  array.each_with_index do |item, i|
@@ -166,7 +166,7 @@ private
166
166
  end
167
167
  return array
168
168
  end
169
-
169
+
170
170
  def mangle_path_or_path_array(item)
171
171
  case item
172
172
  when String
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010-2013 Phusion
2
+ # Copyright (c) 2010-2014 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -56,6 +56,6 @@ else
56
56
  end
57
57
 
58
58
  task 'native_support:clean' do
59
- sh "echo rm -rf #{output_dir}"
59
+ sh "rm -rf #{output_dir}"
60
60
  end
61
61
  end
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ if grep -q docker_env /etc/group; then
5
+ delgroup docker_env >/dev/null
6
+ fi
7
+
8
+ chown -R "$APP_UID:$APP_GID" /home/appa
9
+ groupmod -g "$APP_GID" appa
10
+ usermod -u "$APP_UID" -g "$APP_GID" appa
11
+
12
+ groupmod -g "$DOCKER_GID" docker
13
+ usermod -a -G docker appa
14
+
15
+ # There's something strange with either Docker or the kernel, so that
16
+ # the 'appa' user cannot access its home directory even after a proper
17
+ # chown/chmod. We work around it like this.
18
+ mv /home/appa /home/appa2
19
+ cp -dpR /home/appa2 /home/appa
20
+ rm -rf /home/appa2
21
+
22
+ if [[ $# -gt 0 ]]; then
23
+ exec "$@"
24
+ fi
@@ -0,0 +1,57 @@
1
+ #!/bin/bash
2
+ # This script is run by Jenkins, to execute tests in the CI environment.
3
+
4
+ set -e
5
+
6
+ PASSENGER_ROOT=`dirname "$0"`
7
+ PASSENGER_ROOT=`cd "$PASSENGER_ROOT/../.." && pwd`
8
+
9
+ if [[ "$WORKSPACE" = "" ]]; then
10
+ echo "Please set WORKSPACE."
11
+ exit 1
12
+ fi
13
+
14
+ JENKINS_CACHE_DIR="$WORKSPACE/jenkins_cache"
15
+ mkdir -p "$JENKINS_CACHE_DIR"
16
+ if [[ "$TEST_RPM_BUILDING" != 0 ]]; then
17
+ rm -rf "$JENKINS_CACHE_DIR/passenger_rpm/output"
18
+ fi
19
+
20
+ function run_exec()
21
+ {
22
+ echo "$ $@"
23
+ exec "$@"
24
+ }
25
+
26
+ # We do not use the my_init inside the image to work around
27
+ # a bug in baseimage-docker 0.9.12: pressing Ctrl-C does
28
+ # not properly result in a non-zero exit status.
29
+ run_exec docker run --rm \
30
+ -v "$PASSENGER_ROOT:/passenger" \
31
+ -v /var/run/docker.sock:/docker.sock \
32
+ -v "$JENKINS_CACHE_DIR:/host_cache" \
33
+ -e "DOCKER_HOST=unix:///docker.sock" \
34
+ -e "DOCKER_GID=`getent group docker | cut -d: -f3`" \
35
+ -e "PASSENGER_ROOT_ON_DOCKER_HOST=$PASSENGER_ROOT" \
36
+ -e "CACHE_DIR_ON_DOCKER_HOST=$JENKINS_CACHE_DIR" \
37
+ -e "APP_UID=`id -u`" \
38
+ -e "APP_GID=`id -g`" \
39
+ -e "SUDO=$SUDO" \
40
+ -e "TEST_CXX=$TEST_CXX" \
41
+ -e "TEST_RUBY=$TEST_RUBY" \
42
+ -e "TEST_NODE=$TEST_NODE" \
43
+ -e "TEST_RUBY_VERSION=$TEST_RUBY_VERSION" \
44
+ -e "TEST_CLASSIC_RAILS=$TEST_CLASSIC_RAILS" \
45
+ -e "TEST_RUBYGEMS_VERSION=$TEST_RUBYGEMS_VERSION" \
46
+ -e "TEST_NGINX=$TEST_NGINX" \
47
+ -e "TEST_APACHE2=$TEST_APACHE2" \
48
+ -e "TEST_STANDALONE=$TEST_STANDALONE" \
49
+ -e "TEST_SOURCE_PACKAGING=$TEST_SOURCE_PACKAGING" \
50
+ -e "TEST_DEBIAN_PACKAGING=$TEST_DEBIAN_PACKAGING" \
51
+ -e "TEST_RPM_PACKAGING=$TEST_RPM_PACKAGING" \
52
+ -e "TEST_RPM_BUILDING=$TEST_RPM_BUILDING" \
53
+ phusion/apachai-hopachai-sandbox \
54
+ python /passenger/packaging/rpm/internal/my_init --skip-runit --skip-startup-files --quiet -- \
55
+ /passenger/dev/ci/inituidgid \
56
+ /sbin/setuser appa \
57
+ /bin/bash -lc "cd /passenger && exec ./dev/ci/run_travis.sh"
@@ -0,0 +1,77 @@
1
+ #!/bin/bash
2
+ # This script is run by run_travis.sh, to execute RPM packaging tests in the CI environment.
3
+
4
+ set -e
5
+
6
+ function run()
7
+ {
8
+ echo "$ $@"
9
+ "$@"
10
+ }
11
+
12
+ function retry_run()
13
+ {
14
+ local reset='\x1B[0m'
15
+ local red='\x1B[31m'
16
+ local yellow='\x1B[33m'
17
+
18
+ local max_tries="$1"
19
+ local number=2
20
+ shift
21
+
22
+ echo "$ $@"
23
+ while true; do
24
+ if "$@"; then
25
+ return 0
26
+ elif [[ $number -le $max_tries ]]; then
27
+ echo -e "${yellow}The command \"$@\" failed. Retrying, $number of $max_tries:${reset}"
28
+ (( number++ ))
29
+ else
30
+ echo -e "${red}The command \"$@\" failed after $max_tries attempts. Giving up.${reset}"
31
+ return 1
32
+ fi
33
+ done
34
+ }
35
+
36
+ function yum_install()
37
+ {
38
+ run yum install -y --skip-broken --enablerepo centosplus "$@"
39
+ }
40
+
41
+
42
+ export CACHING=false
43
+ export DEVDEPS_DEFAULT=no
44
+
45
+ echo '%_excludedocs 0' > /etc/rpm/macros.imgcreate
46
+ sed -i 's/nodocs//' /etc/yum.conf
47
+
48
+ cp /etc/hosts /etc/workaround-docker-2267/hosts
49
+ cat >> /etc/workaround-docker-2267/hosts <<EOF
50
+ 127.0.0.1 passenger.test
51
+ 127.0.0.1 mycook.passenger.test
52
+ 127.0.0.1 zsfa.passenger.test
53
+ 127.0.0.1 norails.passenger.test
54
+ 127.0.0.1 1.passenger.test 2.passenger.test 3.passenger.test
55
+ 127.0.0.1 4.passenger.test 5.passenger.test 6.passenger.test
56
+ 127.0.0.1 7.passenger.test 8.passenger.test 9.passenger.test
57
+ EOF
58
+
59
+ yum_install /packages/*.x86_64.rpm /packages/*.noarch.rpm
60
+ perl -pi -e 's:/etc/hosts:/cte/hosts:g' /lib64/libnss_files.so.2 /lib64/libc.so.6 /lib64/libresolv.so.2
61
+ sed -i 's|/etc/hosts|/cte/hosts|g' /usr/lib/ruby/1.8/resolv.rb
62
+ chown -R app: /var/log/nginx /var/lib/nginx
63
+
64
+
65
+ cd /passenger
66
+ retry_run 3 /system/internal/setuser app \
67
+ rake test:install_deps BASE_DEPS=yes SUDO=1
68
+ retry_run 3 /system/internal/setuser app \
69
+ scl enable nodejs010 'rake test:install_deps NODE_MODULES=yes'
70
+ run /system/internal/setuser app \
71
+ rake test:integration:native_packaging
72
+ run /system/internal/setuser app \
73
+ env PASSENGER_LOCATION_CONFIGURATION_FILE=/usr/lib/ruby/site_ruby/1.8/phusion_passenger/locations.ini \
74
+ scl enable python27 nodejs010 'rake test:integration:apache2'
75
+ run /system/internal/setuser app \
76
+ env PASSENGER_LOCATION_CONFIGURATION_FILE=/usr/lib/ruby/site_ruby/1.8/phusion_passenger/locations.ini \
77
+ scl enable python27 nodejs010 'rake test:integration:nginx'
@@ -3,12 +3,31 @@
3
3
 
4
4
  set -e
5
5
 
6
+ PASSENGER_ROOT=`dirname "$0"`
7
+ PASSENGER_ROOT=`cd "$PASSENGER_ROOT/../.." && pwd`
8
+ PASSENGER_ROOT_ON_DOCKER_HOST=${PASSENGER_ROOT_ON_DOCKER_HOST:-$PASSENGER_ROOT}
9
+
10
+ if [[ "$CACHE_DIR_ON_DOCKER_HOST" != "" ]]; then
11
+ CACHE_DIR=/host_cache
12
+ else
13
+ CACHE_DIR=/tmp
14
+ CACHE_DIR_ON_DOCKER_HOST=/tmp
15
+ fi
16
+
6
17
  export VERBOSE=1
7
18
  export TRACE=1
8
19
  export DEVDEPS_DEFAULT=no
9
20
  export rvmsudo_secure_path=1
10
21
 
11
- sudo sh -c 'cat >> /etc/hosts' <<EOF
22
+ if [[ -e /etc/workaround-docker-2267/hosts ]]; then
23
+ HOSTS_FILE=/etc/workaround-docker-2267/hosts
24
+ sudo workaround-docker-2267
25
+ find /usr/local/rvm/rubies/*/lib/ruby -name resolv.rb | sudo xargs sed -i 's|/etc/hosts|/cte/hosts|g'
26
+ else
27
+ HOSTS_FILE=/etc/hosts
28
+ fi
29
+
30
+ sudo sh -c "cat >> $HOSTS_FILE" <<EOF
12
31
  127.0.0.1 passenger.test
13
32
  127.0.0.1 mycook.passenger.test
14
33
  127.0.0.1 zsfa.passenger.test
@@ -92,14 +111,18 @@ function install_node_and_modules()
92
111
  fi
93
112
  }
94
113
 
114
+ if [[ "$MAGNUM" != "" ]]; then
115
+ run sudo sh -c "echo 127.0.0.1 magnum >> /etc/hosts"
116
+ fi
117
+
95
118
  run uname -a
96
119
  run lsb_release -a
97
- sudo tee /etc/dpkg/dpkg.cfg.d/02apt-speedup >/dev/null <<<"force-unsafe-io"
98
- cp test/config.json.travis test/config.json
120
+ run sudo tee /etc/dpkg/dpkg.cfg.d/02apt-speedup >/dev/null <<<"force-unsafe-io"
121
+ run cp test/config.json.travis test/config.json
99
122
 
100
123
  # Relax permissions on home directory so that the application root
101
124
  # permission checks pass.
102
- chmod g+x,o+x $HOME
125
+ run chmod g+x,o+x $HOME
103
126
 
104
127
  if [[ "$TEST_RUBY_VERSION" != "" ]]; then
105
128
  echo "$ rvm use $TEST_RUBY_VERSION"
@@ -172,6 +195,39 @@ if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then
172
195
  rake test:integration:apache2 SUDO=1
173
196
  fi
174
197
 
198
+ if [[ "$TEST_RPM_PACKAGING" = 1 ]]; then
199
+ if [[ "$TEST_RPM_BUILDING" != 0 ]]; then
200
+ pushd packaging/rpm
201
+ run mkdir -p "$CACHE_DIR/passenger_rpm"
202
+ run mkdir -p "$CACHE_DIR/passenger_rpm/cache"
203
+ run mkdir "$CACHE_DIR/passenger_rpm/output"
204
+ run ./build -S "$PASSENGER_ROOT_ON_DOCKER_HOST/packaging/rpm" \
205
+ -P "$PASSENGER_ROOT_ON_DOCKER_HOST" \
206
+ -o "$CACHE_DIR_ON_DOCKER_HOST/passenger_rpm/output" \
207
+ -c "$CACHE_DIR_ON_DOCKER_HOST/passenger_rpm/cache" \
208
+ -d el6 -a x86_64
209
+ popd >/dev/null
210
+ fi
211
+
212
+ echo "------------- Testing built RPMs -------------"
213
+ run cp "test/config.json.rpm-automation" "test/config.json"
214
+ run mkdir -p "$CACHE_DIR/passenger_rpm/output/el6-x86_64"
215
+ if [[ "$TEST_RPM_BUILDING" != 0 ]]; then
216
+ run rm "$CACHE_DIR/passenger_rpm/output/el6-x86_64"/*.src.rpm
217
+ fi
218
+ run docker run --rm \
219
+ -v "$PASSENGER_ROOT_ON_DOCKER_HOST/packaging/rpm:/system:ro" \
220
+ -v "$PASSENGER_ROOT_ON_DOCKER_HOST:/passenger" \
221
+ -v "$CACHE_DIR_ON_DOCKER_HOST/passenger_rpm/output/el6-x86_64:/packages:ro" \
222
+ -e "APP_UID=`id -u`" \
223
+ -e "APP_GID=`id -g`" \
224
+ phusion/passenger_rpm_automation \
225
+ /system/internal/my_init --skip-runit --skip-startup-files --quiet -- \
226
+ /system/internal/inituidgid \
227
+ /bin/bash -c "cd /passenger && exec ./dev/ci/run_rpm_tests.sh"
228
+ run cp "test/config.json.travis" "test/config.json"
229
+ fi
230
+
175
231
  if [[ "$TEST_SOURCE_PACKAGING" = 1 ]]; then
176
232
  apt_get_update
177
233
  run sudo apt-get install -y --no-install-recommends source-highlight
@@ -958,7 +958,7 @@ include::users_guide_snippets/enterprise_only.txt[]
958
958
 
959
959
  Enables or disables resistance against deployment errors.
960
960
 
961
- Suppose you've upgraded your application and you've issues a command to restart it (by touching restart.txt), but the application code contains an error that prevents Phusion Passenger from successfully spawning a process (e.g. a syntax error). Phusion Passenger would normally display an error message in response to this.
961
+ Suppose you've upgraded your application and you've issued a command to restart it (e.g. by touching restart.txt), but the application code contains an error that prevents Phusion Passenger from successfully spawning a process (e.g. a syntax error). Phusion Passenger would normally display an error message in response to this.
962
962
 
963
963
  By enabling deployment error resistance, Phusion Passenger Enterprise would instead do this:
964
964
 
@@ -966,7 +966,7 @@ By enabling deployment error resistance, Phusion Passenger Enterprise would inst
966
966
  - It logs the error to the global web server error log file.
967
967
  - It sets an internal flag so that no processes for this application will be spawned (even when the current traffic would normally result in more processes being spawned) and no processes will be idle cleaned. Processes *could* still be shutdown because of other events, e.g. because their <<PassengerMemoryLimit,memory limit>> have been reached. You can see whether the flag is set by invoking `passenger-status`. If you see the message "Resisting deployment error" then the flag is set.
968
968
 
969
- This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched.
969
+ This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched, or when you issue the `passenger-config restart-app` command.
970
970
 
971
971
  Enabling deployment error resistance only works if <<PassengerRollingRestarts,rolling restart>> is also enabled.
972
972
 
@@ -1,5 +1,3 @@
1
- The Phusion Passenger compilation process can be customized with environment variables.
2
-
3
1
  Environment variables are named values that affect how the system works. For example they tell the system where to look for commands (the `PATH` variable) or where to look for libraries (`LD_LIBRARY_PATH`). Their names are often in all-uppercase. Sometimes people refer to an environment variable with a dollar sign `$` in front, but that's the same thing: when people say "the $PATH environment variable" they mean "the PATH environment variable". This is because the dollar sign `$` is a shell syntax for refering to an environment variable, as you will learn later.
4
2
 
5
3
  Environment variables are set on a **per-process** basis, but they are **inherited** by child processes. This means that if you set environment variables in process A, another already running process B will not see these new environment variables. But if A spawns a child process C, then C will have all environment variables that A had. If you once again change the environment variables in A, then C will not see the changes.
@@ -460,7 +460,7 @@ Here are some of the environment variables which are passed to all hooks, unless
460
460
 
461
461
  ==== Blocking and concurrency
462
462
 
463
- All hooks block in the background. That is, while your hook command is running, Phusion Passenger can still handle web requests, but the background thread which is running your hook will be blocked and won't be able to perform any further operations. For example, if you wrote a hook script for the `attached_process` event, then Phusion Passenger won't be able to attach further processes until your hook script finishes. You should therefore be careful when writing hook scripts.
463
+ Except when otherwise documented, all hooks block in the background. That is, while your hook command is running, Phusion Passenger can still handle web requests, but the background thread which is running your hook will be blocked and won't be able to perform any further operations. For example, if you wrote a hook script for the `attached_process` event, then Phusion Passenger won't be able to attach further processes until your hook script finishes. You should therefore be careful when writing hook scripts.
464
464
 
465
465
  If you have a bug in your script and it blocks, then you will be able to see that using the command `passenger-status --show=backtraces` which prints the backtraces of all threads in the Phusion Passenger HelperAgent. Look for the `runSingleHookScript` function in the backtrace. The following example shows at line 2 that Phusion Passenger is waiting for the hook script `/home/phusion/badscript.sh`.
466
466
 
@@ -500,6 +500,25 @@ Because hooks are inherently tied to the implementation of Phusion Passenger, th
500
500
  +
501
501
  Extra environment variables: `PASSENGER_PROCESS_PID`, `PASSENGER_APP_ROOT`. Errors in the hook script are ignored.
502
502
 
503
+ `spawn_failed` (since 4.0.49)::
504
+ Called when an application process could not be spawned. This could happen when:
505
+ +
506
+ - The application failing to start. For example: bugs in the application, database problems causing the application to crash, incorrectly installed dependencies.
507
+ - Operating system-level problems, such as running out of memory.
508
+ - The application taking too long to start, and hitting Phusion Passenger's timeout.
509
+
510
+ +
511
+ Extra environment variables:
512
+ +
513
+ - `PASSENGER_APP_ROOT`: the path to the application that failed to spawn.
514
+ - `PASSENGER_APP_GROUP_NAME`: the configured app group name.
515
+ - `PASSENGER_ERROR_MESSAGE`: an error message that describes the problem.
516
+ - `PASSENGER_ERROR_ID`: a unique ID for this error event. If you search for this ID in the web server error log files, you should be able to find details about the error.
517
+ - `PASSENGER_APP_ERROR_MESSAGE`: output captured from the application at the time the error occurred.
518
+
519
+ +
520
+ This hook does not block because it's always run in an extra background thread. Errors in the hook script are ignored.
521
+
503
522
  `after_initialize_supergroup`::
504
523
  Called right after Phusion Passenger has allocated data structures for an application, and is about to spawn a process for the first time for this application. Errors in the hook script are ignored. Extra environment variables: `PASSENGER_APP_ROOT`.
505
524
  `before_destroy_supergroup`::