passenger 4.0.14 → 4.0.16

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 (121) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +69 -0
  3. data/bin/passenger-install-apache2-module +7 -1
  4. data/bin/passenger-install-nginx-module +18 -1
  5. data/build/apache2.rb +25 -1
  6. data/build/basics.rb +7 -4
  7. data/build/debian.rb +72 -25
  8. data/build/nginx.rb +24 -0
  9. data/build/packaging.rb +45 -3
  10. data/debian.template/{control → control.template} +17 -8
  11. data/debian.template/ruby-passenger.install.template +1 -0
  12. data/debian.template/rules.template +9 -3
  13. data/dev/run_travis.sh +14 -0
  14. data/doc/Users guide Apache.idmap.txt +64 -48
  15. data/doc/Users guide Apache.txt +127 -93
  16. data/doc/Users guide Nginx.idmap.txt +46 -28
  17. data/doc/Users guide Nginx.txt +100 -12
  18. data/doc/images/{conservative_spawning.png → direct_spawning.png} +0 -0
  19. data/doc/images/{conservative_spawning.svg → direct_spawning.svg} +0 -0
  20. data/doc/users_guide_snippets/installation.txt +107 -66
  21. data/doc/users_guide_snippets/passenger_spawn_method.txt +1 -1
  22. data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -12
  23. data/doc/users_guide_snippets/tips.txt +70 -3
  24. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +2 -0
  25. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +114 -0
  26. data/ext/apache2/Configuration.cpp +53 -101
  27. data/ext/apache2/Configuration.hpp +19 -41
  28. data/ext/apache2/ConfigurationCommands.cpp +95 -0
  29. data/ext/apache2/ConfigurationCommands.cpp.erb +91 -0
  30. data/ext/apache2/ConfigurationFields.hpp +59 -0
  31. data/ext/apache2/ConfigurationFields.hpp.erb +89 -0
  32. data/ext/apache2/ConfigurationSetters.cpp +223 -0
  33. data/ext/apache2/ConfigurationSetters.cpp.erb +126 -0
  34. data/ext/apache2/CreateDirConfig.cpp +50 -0
  35. data/ext/apache2/CreateDirConfig.cpp.erb +71 -0
  36. data/ext/apache2/Hooks.cpp +6 -0
  37. data/ext/apache2/MergeDirConfig.cpp +103 -0
  38. data/ext/apache2/MergeDirConfig.cpp.erb +81 -0
  39. data/ext/common/ApplicationPool2/AppTypes.cpp +2 -0
  40. data/ext/common/ApplicationPool2/AppTypes.h +2 -0
  41. data/ext/common/ApplicationPool2/Common.h +1 -1
  42. data/ext/common/ApplicationPool2/Group.h +56 -7
  43. data/ext/common/ApplicationPool2/Implementation.cpp +133 -31
  44. data/ext/common/ApplicationPool2/Options.h +23 -2
  45. data/ext/common/ApplicationPool2/Pool.h +8 -1
  46. data/ext/common/ApplicationPool2/Process.h +9 -0
  47. data/ext/common/ApplicationPool2/Session.h +1 -0
  48. data/ext/common/ApplicationPool2/Spawner.h +21 -19
  49. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  50. data/ext/common/Constants.h +21 -17
  51. data/ext/common/Constants.h.erb +1 -1
  52. data/ext/common/Exceptions.h +19 -0
  53. data/ext/common/ServerInstanceDir.h +8 -4
  54. data/ext/common/Utils.cpp +33 -1
  55. data/ext/common/Utils.h +14 -0
  56. data/ext/common/Utils/StrIntUtils.cpp +16 -0
  57. data/ext/common/Utils/StrIntUtils.h +5 -0
  58. data/ext/common/agents/HelperAgent/Main.cpp +5 -5
  59. data/ext/common/agents/HelperAgent/RequestHandler.h +94 -45
  60. data/ext/common/agents/LoggingAgent/Main.cpp +10 -26
  61. data/ext/common/agents/Watchdog/Main.cpp +4 -15
  62. data/ext/nginx/CacheLocationConfig.c +501 -0
  63. data/ext/nginx/CacheLocationConfig.c.erb +140 -0
  64. data/ext/nginx/Configuration.c +29 -453
  65. data/ext/nginx/Configuration.h +3 -21
  66. data/ext/nginx/ConfigurationCommands.c +501 -0
  67. data/ext/nginx/ConfigurationCommands.c.erb +136 -0
  68. data/ext/nginx/ConfigurationFields.h +89 -0
  69. data/ext/nginx/ConfigurationFields.h.erb +85 -0
  70. data/ext/nginx/ContentHandler.c +3 -166
  71. data/ext/nginx/CreateLocationConfig.c +146 -0
  72. data/ext/nginx/CreateLocationConfig.c.erb +70 -0
  73. data/ext/nginx/MergeLocationConfig.c +166 -0
  74. data/ext/nginx/MergeLocationConfig.c.erb +72 -0
  75. data/ext/nginx/config +4 -0
  76. data/ext/oxt/detail/tracable_exception_disabled.hpp +21 -1
  77. data/ext/oxt/detail/tracable_exception_enabled.hpp +4 -1
  78. data/ext/oxt/implementation.cpp +7 -1
  79. data/ext/oxt/macros.hpp +9 -7
  80. data/helper-scripts/backtrace-sanitizer.rb +23 -0
  81. data/helper-scripts/classic-rails-loader.rb +23 -0
  82. data/helper-scripts/classic-rails-preloader.rb +23 -0
  83. data/helper-scripts/download_binaries/extconf.rb +10 -5
  84. data/helper-scripts/meteor-loader.rb +127 -0
  85. data/helper-scripts/node-loader.js +1 -1
  86. data/helper-scripts/rack-preloader.rb +23 -0
  87. data/helper-scripts/system-memory-stats.py +22 -0
  88. data/helper-scripts/touch-dir.sh +48 -0
  89. data/lib/phusion_passenger.rb +1 -1
  90. data/lib/phusion_passenger/apache2/config_options.rb +104 -0
  91. data/lib/phusion_passenger/constants.rb +8 -0
  92. data/lib/phusion_passenger/native_support.rb +9 -1
  93. data/lib/phusion_passenger/nginx/config_options.rb +328 -0
  94. data/lib/phusion_passenger/packaging.rb +2 -2
  95. data/lib/phusion_passenger/platform_info/apache.rb +8 -0
  96. data/lib/phusion_passenger/platform_info/compiler.rb +2 -2
  97. data/lib/phusion_passenger/rails3_extensions/init.rb +19 -4
  98. data/lib/phusion_passenger/ruby_core_enhancements.rb +4 -1
  99. data/lib/phusion_passenger/standalone/app_finder.rb +3 -2
  100. data/lib/phusion_passenger/standalone/command.rb +1 -0
  101. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -6
  102. data/lib/phusion_passenger/standalone/runtime_locator.rb +9 -2
  103. data/lib/phusion_passenger/standalone/start_command.rb +45 -9
  104. data/lib/phusion_passenger/utils.rb +4 -1
  105. data/resources/templates/{nginx → installer_common}/run_installer_as_root.txt.erb +3 -1
  106. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +6 -0
  107. data/resources/templates/standalone/config.erb +8 -8
  108. data/test/cxx/ApplicationPool2/PoolTest.cpp +120 -3
  109. data/test/cxx/RequestHandlerTest.cpp +66 -3
  110. data/test/integration_tests/native_packaging_spec.rb +41 -0
  111. data/test/integration_tests/nginx_tests.rb +1 -0
  112. data/test/integration_tests/standalone_tests.rb +4 -0
  113. data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +22 -0
  114. data/test/stub/rails3.0/config/initializers/passenger.rb +2 -1
  115. data/test/stub/rails3.1/config/initializers/passenger.rb +2 -1
  116. data/test/stub/rails3.2/config/initializers/passenger.rb +2 -1
  117. data/test/stub/rails4.0/config/initializers/passenger.rb +5 -1
  118. data/test/stub/wsgi/passenger_wsgi.py +5 -0
  119. metadata +32 -7
  120. metadata.gz.asc +7 -7
  121. data/resources/templates/apache2/run_installer_as_root.txt.erb +0 -8
@@ -34,6 +34,10 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
34
34
  ${ngx_addon_dir}/StaticContentHandler.c"
35
35
  NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
36
36
  ${ngx_addon_dir}/Configuration.h \
37
+ ${ngx_addon_dir}/ConfigurationCommands.c \
38
+ ${ngx_addon_dir}/CreateLocationConfig.c \
39
+ ${ngx_addon_dir}/MergeLocationConfig.c \
40
+ ${ngx_addon_dir}/CacheLocationConfig.c \
37
41
  ${ngx_addon_dir}/ContentHandler.h \
38
42
  ${ngx_addon_dir}/StaticContentHandler.h \
39
43
  ${ngx_addon_dir}/ngx_http_passenger_module.h \
@@ -2,7 +2,7 @@
2
2
  * OXT - OS eXtensions for boosT
3
3
  * Provides important functionality necessary for writing robust server software.
4
4
  *
5
- * Copyright (c) 2010 Phusion
5
+ * Copyright (c) 2010-2013 Phusion
6
6
  *
7
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  * of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +33,26 @@ namespace oxt {
33
33
 
34
34
  class tracable_exception: public std::exception {
35
35
  public:
36
+ struct no_backtrace { };
37
+
38
+ tracable_exception()
39
+ : std::exception()
40
+ {
41
+ // Do nothing.
42
+ }
43
+
44
+ tracable_exception(const tracable_exception &other)
45
+ : std::exception(other)
46
+ {
47
+ // Do nothing.
48
+ }
49
+
50
+ tracable_exception(const no_backtrace &tag)
51
+ : std::exception()
52
+ {
53
+ // Do nothing.
54
+ }
55
+
36
56
  virtual std::string backtrace() const throw() {
37
57
  return " (backtrace support disabled during compile time)\n";
38
58
  }
@@ -2,7 +2,7 @@
2
2
  * OXT - OS eXtensions for boosT
3
3
  * Provides important functionality necessary for writing robust server software.
4
4
  *
5
- * Copyright (c) 2010 Phusion
5
+ * Copyright (c) 2010-2013 Phusion
6
6
  *
7
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  * of this software and associated documentation files (the "Software"), to deal
@@ -37,8 +37,11 @@ class tracable_exception: public std::exception {
37
37
  private:
38
38
  std::vector<trace_point *> backtrace_copy;
39
39
  public:
40
+ struct no_backtrace { };
41
+
40
42
  tracable_exception();
41
43
  tracable_exception(const tracable_exception &other);
44
+ tracable_exception(const no_backtrace &tag);
42
45
  virtual ~tracable_exception() throw();
43
46
  virtual std::string backtrace() const throw();
44
47
  virtual const char *what() const throw();
@@ -2,7 +2,7 @@
2
2
  * OXT - OS eXtensions for boosT
3
3
  * Provides important functionality necessary for writing robust server software.
4
4
  *
5
- * Copyright (c) 2008-2012 Phusion
5
+ * Copyright (c) 2008-2013 Phusion
6
6
  *
7
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  * of this software and associated documentation files (the "Software"), to deal
@@ -204,6 +204,12 @@ tracable_exception::tracable_exception(const tracable_exception &other)
204
204
  }
205
205
  }
206
206
 
207
+ tracable_exception::tracable_exception(const no_backtrace &tag)
208
+ : std::exception()
209
+ {
210
+ // Do nothing.
211
+ }
212
+
207
213
  tracable_exception::~tracable_exception() throw() {
208
214
  vector<trace_point *>::iterator it, end = backtrace_copy.end();
209
215
  for (it = backtrace_copy.begin(); it != end; it++) {
@@ -98,13 +98,15 @@
98
98
  * On MacOS X, neither gcc nor llvm-gcc support the __thread keyword, but Clang
99
99
  * does. It works on at least clang >= 3.0.
100
100
  */
101
- #if defined(__APPLE__)
102
- #if defined(__clang__) && __clang_major__ >= 3
103
- #define OXT_THREAD_LOCAL_KEYWORD_SUPPORTED
104
- #endif
105
- #elif defined(__GNUC__) && OXT_GCC_VERSION >= 40102
106
- #if !defined(__SOLARIS__) && !defined(__OpenBSD__)
107
- #define OXT_THREAD_LOCAL_KEYWORD_SUPPORTED
101
+ #ifndef PASSENGER_DISABLE_THREAD_LOCAL_STORAGE
102
+ #if defined(__APPLE__)
103
+ #if defined(__clang__) && __clang_major__ >= 3
104
+ #define OXT_THREAD_LOCAL_KEYWORD_SUPPORTED
105
+ #endif
106
+ #elif defined(__GNUC__) && OXT_GCC_VERSION >= 40102
107
+ #if !defined(__SOLARIS__) && !defined(__OpenBSD__)
108
+ #define OXT_THREAD_LOCAL_KEYWORD_SUPPORTED
109
+ #endif
108
110
  #endif
109
111
  #endif
110
112
 
@@ -1,4 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 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
+
2
25
  # Parses output of the glibc backtrace() function and
3
26
  # translates addresses into function names and source
4
27
  # file locations.
@@ -1,4 +1,27 @@
1
1
  #!/usr/bin/env ruby
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 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
+
2
25
  module PhusionPassenger
3
26
  module App
4
27
  def self.options
@@ -1,5 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
+ # Phusion Passenger - https://www.phusionpassenger.com/
4
+ # Copyright (c) 2013 Phusion
5
+ #
6
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+
3
26
  GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
4
27
 
5
28
  module PhusionPassenger
@@ -24,11 +24,6 @@
24
24
 
25
25
  # This script is called during 'gem install'. Its role is to download
26
26
  # Phusion Passenger binaries.
27
- source_root = File.expand_path("../..", File.dirname(__FILE__))
28
- $LOAD_PATH.unshift("#{source_root}/lib")
29
- require 'phusion_passenger'
30
- PhusionPassenger.locate_directories
31
- require 'fileutils'
32
27
 
33
28
  # Create a dummy Makefile to prevent 'gem install' from borking out.
34
29
  File.open("Makefile", "w") do |f|
@@ -38,6 +33,16 @@ File.open("Makefile", "w") do |f|
38
33
  f.puts " true"
39
34
  end
40
35
 
36
+ # Don't do anything on Windows. We don't support Windows but exiting now
37
+ # will at least prevent the gem from being not installable on Windows.
38
+ exit if RUBY_PLATFORM =~ /mswin/i || RUBY_PLATFORM =~ /win32/i
39
+
40
+ source_root = File.expand_path("../..", File.dirname(__FILE__))
41
+ $LOAD_PATH.unshift("#{source_root}/lib")
42
+ require 'phusion_passenger'
43
+ PhusionPassenger.locate_directories
44
+ require 'fileutils'
45
+
41
46
  if PhusionPassenger.natively_packaged?
42
47
  puts "Binary downloading is only available when originally packaged. Stopping."
43
48
  exit 0
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: binary
3
+ # Phusion Passenger - https://www.phusionpassenger.com/
4
+ # Copyright (c) 2013 Phusion
5
+ #
6
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+
26
+ require 'socket'
27
+
28
+ module PhusionPassenger
29
+ module App
30
+ def self.options
31
+ return @@options
32
+ end
33
+
34
+ def self.exit_code_for_exception(e)
35
+ if e.is_a?(SystemExit)
36
+ return e.status
37
+ else
38
+ return 1
39
+ end
40
+ end
41
+
42
+ def self.handshake_and_read_startup_request
43
+ STDOUT.sync = true
44
+ STDERR.sync = true
45
+ puts "!> I have control 1.0"
46
+ abort "Invalid initialization header" if STDIN.readline != "You have control 1.0\n"
47
+
48
+ @@options = {}
49
+ while (line = STDIN.readline) != "\n"
50
+ name, value = line.strip.split(/: */, 2)
51
+ @@options[name] = value
52
+ end
53
+ end
54
+
55
+ def self.ping_port(port)
56
+ socket_domain = Socket::Constants::AF_INET
57
+ sockaddr = Socket.pack_sockaddr_in(port, '127.0.0.1')
58
+ begin
59
+ socket = Socket.new(socket_domain, Socket::Constants::SOCK_STREAM, 0)
60
+ begin
61
+ socket.connect_nonblock(sockaddr)
62
+ rescue Errno::ENOENT, Errno::EINPROGRESS, Errno::EAGAIN, Errno::EWOULDBLOCK
63
+ if select(nil, [socket], nil, 0.1)
64
+ begin
65
+ socket.connect_nonblock(sockaddr)
66
+ rescue Errno::EISCONN
67
+ end
68
+ else
69
+ raise Errno::ECONNREFUSED
70
+ end
71
+ end
72
+ return true
73
+ rescue Errno::ECONNREFUSED, Errno::ENOENT
74
+ return false
75
+ ensure
76
+ socket.close if socket
77
+ end
78
+ end
79
+
80
+ def self.load_app
81
+ port = nil
82
+ tries = 0
83
+ while port.nil? && tries < 200
84
+ port = 1024 + rand(9999)
85
+ if ping_port(port) || ping_port(port + 1) || ping_port(port + 2)
86
+ port = nil
87
+ tries += 1
88
+ end
89
+ end
90
+ if port.nil?
91
+ abort "Cannot find a suitable port to start Meteor on"
92
+ end
93
+
94
+ production = options["environment"] == "production" ? "production" : ""
95
+ pid = fork do
96
+ Process.setpgrp
97
+ exec("meteor run -p #{port} #{production}")
98
+ end
99
+ $0 = options["process_title"] if options["process_title"]
100
+ $0 = "#{$0} (#{pid})"
101
+ return [pid, port]
102
+ end
103
+
104
+
105
+ ################## Main code ##################
106
+
107
+
108
+ handshake_and_read_startup_request
109
+ pid, port = load_app
110
+ begin
111
+ while !ping_port(port)
112
+ sleep 0.01
113
+ end
114
+ puts "!> Ready"
115
+ puts "!> socket: main;tcp://127.0.0.1:#{port};http_session;0"
116
+ puts "!> "
117
+ begin
118
+ STDIN.readline
119
+ rescue EOFError
120
+ end
121
+ ensure
122
+ Process.kill('INT', -pid) rescue nil
123
+ Process.waitpid(pid) rescue nil
124
+ end
125
+
126
+ end # module App
127
+ end # module PhusionPassenger
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2012 Phusion
3
+ * Copyright (c) 2010-2013 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -1,5 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: binary
3
+ # Phusion Passenger - https://www.phusionpassenger.com/
4
+ # Copyright (c) 2013 Phusion
5
+ #
6
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+
3
26
  GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
4
27
 
5
28
  module PhusionPassenger
@@ -1,4 +1,26 @@
1
1
  #!/usr/bin/env python
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 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.
2
24
  import sys
3
25
 
4
26
  if sys.version_info[0] >= 3:
@@ -0,0 +1,48 @@
1
+ #!/bin/sh
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2013 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
+ # This script touches everything in a directory every 30 minutes to prevent
26
+ # /tmp cleaners from removing it.
27
+
28
+ set -e
29
+
30
+ dir="$1"
31
+ while true; do
32
+ # Sleep for approx 1800 seconds, quit if directory no longer exists.
33
+ i=0
34
+ while test $i -lt 900; do
35
+ sleep 2
36
+ if ! test -e "$dir"; then
37
+ exit
38
+ fi
39
+ i=$((i+1))
40
+ done
41
+
42
+ # Touch directory, then try loop again.
43
+ if test -e "$dir"; then
44
+ find "$dir" | xargs touch
45
+ else
46
+ exit
47
+ fi
48
+ done