passenger 4.0.35 → 4.0.36
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/NEWS +19 -0
- data/build/packaging.rb +16 -11
- data/doc/Users guide Apache.txt +8 -2
- data/doc/Users guide Nginx.txt +8 -2
- data/doc/Users guide Standalone.idmap.txt +4 -0
- data/doc/Users guide Standalone.txt +186 -0
- data/doc/users_guide_snippets/installation.txt +2 -1
- data/ext/common/ApplicationPool2/Group.h +2 -1
- data/ext/common/ApplicationPool2/Options.h +9 -3
- data/ext/common/Constants.h +1 -1
- data/ext/common/agents/HelperAgent/Main.cpp +4 -1
- data/ext/common/agents/LoggingAgent/Main.cpp +3 -0
- data/ext/common/agents/TempDirToucher.c +22 -5
- data/ext/common/agents/Watchdog/Main.cpp +23 -8
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/standalone/command.rb +7 -2
- data/lib/phusion_passenger/standalone/start_command.rb +1 -5
- data/resources/templates/standalone/config.erb +2 -1
- metadata +2 -2
- metadata.gz.asc +7 -7
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTQyM2E1ZmM5N2JlM2VlZjY5ZjUwZWUyZTU5NWFlZDZlZWE3NGU0Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWZiMzg5YmI0MDEyOTRhZDBmZTg1ODNjZGRlMjk2MTFjNDgxNWI2Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDYyNjlkYTdlMjY0ZmM0ODYyODk3NmQ5NjdlZjhiMGE0NjgwMTk2ZTAzNTg1
|
10
|
+
ZjRkNWEwNmM5M2Y2YzBhZTFkZTllNGVkZWI4YjVlYTU3MGIyNGU3NTEyYmJi
|
11
|
+
ZjllODk5M2Q0ZjVjOGY4OGQxYzE2NGIzNTEyNmUzZWYzZGIzM2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTkwMTZmMzIzNWM1YTk3NTA1NTMzYmZjNGZmNjc5ZmY0MTQ2NGNiZmQxYTI2
|
14
|
+
MGFlNjMzZGE0YTE5NWQxNjhlYjA0NmY2NzQzNDc0NTU3ZTVmOTk0OGFmNDdl
|
15
|
+
YWU1MTc0Y2UxZTkxMjMyY2UxMjFlMTdjZmQ2OTg0OTEyM2Y3NzQ=
|
checksums.yaml.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABAgAGBQJS4syLAAoJECrHRaUKISqMsVsIAIfwEwJO7MHIz8Q1ct4QuKHC
|
6
|
+
Ll99P56zwQ/trV4PyAEDC1NB9cpbf85vzA+45hlFx6iMqN9oLA33eQVoVvKtI3qG
|
7
|
+
lBtC4SIdWRvQZBoBhTgDjmzDzGGc3UHtc9siAaxty7a2vkGZBqKXpX/okS6DYAV0
|
8
|
+
TfoH8ImWg/2qBVFffKLv2ApRcMcjXdh+C0rGtLOTzU4AiTrIlFytQkDBZuMtsZOp
|
9
|
+
B2jHoLhyzzZ1ZHkUpxMDA2S9jiLbzh+MQ93/kNe1eDa6WH7Gz1Z9GXGNSwo1behJ
|
10
|
+
b9gp40pdnIxFFuPphiRevfrcCEprGi7a2s5q3sdYF7UVNRQBbuyauXUSI4K3a24=
|
11
|
+
=zcR9
|
12
12
|
-----END PGP SIGNATURE-----
|
data.tar.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABAgAGBQJS4syKAAoJECrHRaUKISqM92QH/2/DJsZccgKyRyhPpBF8Bl41
|
6
|
+
zhKzJTnxddS7Q/qd5N+NL1Xqp3+P0crS8CHHV+QNjZh6jXWBBGe+1Ftcp3TZGxpw
|
7
|
+
EYFzDkX8bIQQ83RxwCYah2Vj/uGuy7XKlDk0kEMSNeLlVOmBWR1yi78DomFJzcXc
|
8
|
+
wPsvwRr8ZYr3++2o61LeReEhPjNSMb+tlzb3sIDrKsAMx9B0012RGFc8t9bb2Qny
|
9
|
+
9bTmJSKj8cwCBmyFvvM+Dh6wfse3wCHT6/rH0n7K40l85NNftidwUI0zhYUC3/8H
|
10
|
+
Y7TcFqFBq5NzNrYlMcsyzsteePOd5HW7c6NSiGIuu6zFfLGEETWP5W5fdsps6ok=
|
11
|
+
=4drC
|
12
12
|
-----END PGP SIGNATURE-----
|
data/NEWS
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
Release 4.0.36
|
2
|
+
--------------
|
3
|
+
|
4
|
+
* [Enterprise] Fixed some Mass Deployment bugs.
|
5
|
+
* [Enterprise] Fixed a bug that causes an application group to be put into
|
6
|
+
Deployment Error Resistance Mode if rolling restarting fails while
|
7
|
+
deployment error resistance is off. Deployment Error Resistance Mode is
|
8
|
+
now only activated if it's explicitly turned on.
|
9
|
+
* Passenger Standalone now gzips JSON responses.
|
10
|
+
* Fixed some cases in which Passenger Standalone does not to properly cleanup
|
11
|
+
its temporary files.
|
12
|
+
|
13
|
+
|
14
|
+
Release 4.0.35
|
15
|
+
--------------
|
16
|
+
|
17
|
+
* Fixed some unit tests.
|
18
|
+
|
19
|
+
|
1
20
|
Release 4.0.34
|
2
21
|
--------------
|
3
22
|
|
data/build/packaging.rb
CHANGED
@@ -136,11 +136,13 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
|
|
136
136
|
abort "*** ERROR: Please 'brew install hub' first"
|
137
137
|
end
|
138
138
|
|
139
|
-
if
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
139
|
+
if is_open_source?
|
140
|
+
if boolean_option('HOMEBREW_UPDATE', true)
|
141
|
+
puts "Updating Homebrew formula..."
|
142
|
+
Rake::Task['package:update_homebrew'].invoke
|
143
|
+
else
|
144
|
+
puts "HOMEBREW_UPDATE set to false, not updating Homebrew formula."
|
145
|
+
end
|
144
146
|
end
|
145
147
|
|
146
148
|
sh "git tag -s #{git_tag} -u 0A212A8C -m 'Release #{version}'"
|
@@ -178,11 +180,13 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
|
|
178
180
|
puts "Building OS X binaries..."
|
179
181
|
Rake::Task['package:build_osx_binaries'].invoke
|
180
182
|
|
181
|
-
if boolean_option('
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
183
|
+
if boolean_option('HOMEBREW_UPDATE', true)
|
184
|
+
if boolean_option('HOMEBREW_DRY_RUN', false)
|
185
|
+
puts "HOMEBREW_DRY_RUN set, not submitting pull request. Please find the repo in /tmp/homebrew."
|
186
|
+
else
|
187
|
+
puts "Submitting Homebrew pull request..."
|
188
|
+
sh "cd #{homebrew_dir} && hub pull-request 'Update passenger to version #{version}' -b Homebrew:master"
|
189
|
+
end
|
186
190
|
end
|
187
191
|
|
188
192
|
puts "--------------"
|
@@ -208,7 +212,8 @@ task 'package:release' => ['package:set_official', 'package:gem', 'package:tarba
|
|
208
212
|
|
209
213
|
puts "Initiating building of binaries"
|
210
214
|
command = "cd /srv/passenger_autobuilder/app && " +
|
211
|
-
"/tools/silence-unless-failed
|
215
|
+
"/tools/silence-unless-failed -f /tmp/passenger_autobuilder.log " +
|
216
|
+
"chpst -l /var/cache/passenger_ci/lock " +
|
212
217
|
"./autobuild-with-pbuilder #{enterprise_git_url} passenger-enterprise --tag=#{git_tag}"
|
213
218
|
sh "ssh psg_autobuilder_run@juvia-helper.phusion.nl at now <<<'#{command}'"
|
214
219
|
|
data/doc/Users guide Apache.txt
CHANGED
@@ -822,7 +822,12 @@ Rolling restarts have a few caveat however that you should be aware of:
|
|
822
822
|
been restarted. It is for this reason that you should not use rolling
|
823
823
|
restarts in development, only in production.
|
824
824
|
|
825
|
-
|
825
|
+
If Passenger Enterprise could not rolling restart a process (let's call it 'A') because it is unable to spawn a new process (let's call it 'B'), then Passenger Enterprise will give up trying to rolling restart that particular process 'A'. What happens next depends on whether <<PassengerResistDeploymentErrors,deployment error resistance>> is enabled:
|
826
|
+
|
827
|
+
- If deployment error resistance is disabled (the default), then Passenger Enterprise will proceed with trying to restart the remaining processes.
|
828
|
+
- If deployment error resistance is enabled, the Passenger Enterprise will give up rolling restarting immediately. The application group will be put into Deployment Error Resistance Mode.
|
829
|
+
|
830
|
+
Please note that `PassengerRollingRestarts` is completely unrelated to the `passenger-config restart-app` command. That command always initiates a blocking restart, unless `--rolling-restart` is given.
|
826
831
|
|
827
832
|
This option may occur in the following places:
|
828
833
|
|
@@ -833,6 +838,7 @@ This option may occur in the following places:
|
|
833
838
|
|
834
839
|
In each place, it may be specified at most once. The default value is 'off'.
|
835
840
|
|
841
|
+
[[PassengerResistDeploymentErrors]]
|
836
842
|
==== PassengerResistDeploymentErrors <on|off>
|
837
843
|
:version: 3.0.0
|
838
844
|
include::users_guide_snippets/enterprise_only.txt[]
|
@@ -845,7 +851,7 @@ By enabling deployment error resistance, Phusion Passenger Enterprise would inst
|
|
845
851
|
|
846
852
|
- It passes the request to one of the existing application processes (that belong to the previous version of the application). The visitor will not see a Phusion Passenger process spawning error message.
|
847
853
|
- It logs the error to the global web server error log file.
|
848
|
-
- 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.
|
854
|
+
- It sets an internal flag (Deployment Error Resistance Mode) 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.
|
849
855
|
|
850
856
|
This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched.
|
851
857
|
|
data/doc/Users guide Nginx.txt
CHANGED
@@ -823,7 +823,12 @@ Rolling restarts have a few caveat however that you should be aware of:
|
|
823
823
|
been restarted. It is for this reason that you should not use rolling
|
824
824
|
restarts in development, only in production.
|
825
825
|
|
826
|
-
|
826
|
+
If Passenger Enterprise could not rolling restart a process (let's call it 'A') because it is unable to spawn a new process (let's call it 'B'), then Passenger Enterprise will give up trying to rolling restart that particular process 'A'. What happens next depends on whether <<PassengerResistDeploymentErrors,deployment error resistance>> is enabled:
|
827
|
+
|
828
|
+
- If deployment error resistance is disabled (the default), then Passenger Enterprise will proceed with trying to restart the remaining processes.
|
829
|
+
- If deployment error resistance is enabled, the Passenger Enterprise will give up rolling restarting immediately. The application group will be put into Deployment Error Resistance Mode.
|
830
|
+
|
831
|
+
Please note that `passenger_rolling_restarts` is completely unrelated to the `passenger-config restart-app` command. That command always initiates a blocking restart, unless `--rolling-restart` is given.
|
827
832
|
|
828
833
|
This option may occur in the following places:
|
829
834
|
|
@@ -834,6 +839,7 @@ This option may occur in the following places:
|
|
834
839
|
|
835
840
|
In each place, it may be specified at most once. The default value is 'off'.
|
836
841
|
|
842
|
+
[[PassengerResistDeploymentErrors]]
|
837
843
|
==== passenger_resist_deployment_errors <on|off>
|
838
844
|
:version: 3.0.0
|
839
845
|
include::users_guide_snippets/enterprise_only.txt[]
|
@@ -846,7 +852,7 @@ By enabling deployment error resistance, Phusion Passenger Enterprise would inst
|
|
846
852
|
|
847
853
|
- It passes the request to one of the existing application processes (that belong to the previous version of the application). The visitor will not see a Phusion Passenger process spawning error message.
|
848
854
|
- It logs the error to the global web server error log file.
|
849
|
-
- 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.
|
855
|
+
- 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.
|
850
856
|
|
851
857
|
This way, visitors will suffer minimally from deployment errors. Phusion Passenger will attempt to restart the application again next time restart.txt is touched.
|
852
858
|
|
@@ -80,6 +80,10 @@
|
|
80
80
|
|
81
81
|
5.1. Starting Passenger Standalone at system boot => starting-passenger-standalone-at-system-boot-jpem2b
|
82
82
|
|
83
|
+
5.2. Sharing the same port between multiple Passenger Standalone instances => sharing-the-same-port-between-multiple-passenger-standalone-instances-3lcmc5
|
84
|
+
|
85
|
+
5.3. Installing Passenger Standalone behind Nginx => installing-passenger-standalone-behind-nginx-1xylsfk
|
86
|
+
|
83
87
|
6. Mass deployment => mass-deployment-1xqriy4
|
84
88
|
|
85
89
|
7. Troubleshooting => troubleshooting-o7g75o
|
@@ -144,6 +144,192 @@ cd /path-to-your-webapp
|
|
144
144
|
passenger start --daemonize --port 80 --user someusername
|
145
145
|
------------------------------------------
|
146
146
|
|
147
|
+
To stop Passenger Standalone, run:
|
148
|
+
|
149
|
+
[source,sh]
|
150
|
+
------------------------------------------
|
151
|
+
cd /path-to-your-webapp
|
152
|
+
|
153
|
+
# If you use RVM, use 'rvmsudo' instead of 'sudo'
|
154
|
+
sudo passenger stop
|
155
|
+
------------------------------------------
|
156
|
+
|
157
|
+
|
158
|
+
[[sharing_port]]
|
159
|
+
=== Sharing the same port between multiple Passenger Standalone instances
|
160
|
+
|
161
|
+
If you have multiple applications on your server then it is desirable to have all of them listen on the same port (e.g. port 80), with the HTTP request's host name determining which Passenger Standalone instance should handle the request. There are three ways to achieve this.
|
162
|
+
|
163
|
+
1. The first way is to use the <<mass_deployment,Mass deployment>> feature, which allows Passenger Standalone to directly host multiple applications at the same time. Please refer to that section to learn more.
|
164
|
+
2. The second way is to run multiple Passenger Standalone instances -- one for each application -- and to put all of them behind a *reverse proxy* or *load balancer*. The reverse proxy/load balancer can for example be Nginx, Apache or HAProxy. The reverse proxy/load balancer listens on port 80, determines which Passenger Standalone instance should handle the request, and forwards the request to that instance.
|
165
|
+
3. The third way is to use link:Users%20guide%20Nginx.html[Phusion Passenger for Nginx] or link:Users%20guide%20Apache.html[Phusion Passenger for Apache]. These are two modes of Phusion Passenger that are distinct from the Standalone mode, which this document describes. In the Nginx and Apache modes, Phusion Passenger integrates directly into Nginx and Apache, and makes it very easy to host multiple applications directly on Nginx or Apache.
|
166
|
+
+
|
167
|
+
Compared method 2 -- putting Passenger Standalone behind a reverse proxy or load balancer -- the Nginx or Apache modes are easier to use and require less configuration. On the other hand, the Nginx modes requires reinstalling or recompiling Nginx, while the Apache mode requires that the Phusion Passenger Apache module is installed.
|
168
|
+
|
169
|
+
**The rest of this subsection describes method 2.**
|
170
|
+
|
171
|
+
[float]
|
172
|
+
==== Step 1: starting all applications
|
173
|
+
|
174
|
+
Putting Passenger Standalone behind a reverse proxy requires three steps. First, you must start all Passenger Standalone instances that you want. Each one must be listening on a different port, because two applications can't listen on the same port. Suppose that you have two applications, `/webapps/foo` and `/webapps/bar`. Here's how you may start them:
|
175
|
+
|
176
|
+
[source,sh]
|
177
|
+
------------------------------
|
178
|
+
# Start foo on port 4000
|
179
|
+
cd /webapps/foo
|
180
|
+
passenger start --daemonize --address 127.0.0.1 --port 4000
|
181
|
+
|
182
|
+
# Start bar on port 4010
|
183
|
+
cd /webapps/bar
|
184
|
+
passenger start --daemonize --address 127.0.0.1 --port 4010
|
185
|
+
------------------------------
|
186
|
+
|
187
|
+
Notice the fact that we pass `--address 127.0.0.1`, which tells Passenger Standalone to only listen for requests that originate from the local machine. This is because the reverse proxy/load balancer, not Passenger Standalone, is supposed to be responsible for receiving external HTTP requests. The reverse proxy/load balancer will be running on the same machine only, so limiting Passenger Standalone in this manner improves security.
|
188
|
+
|
189
|
+
[float]
|
190
|
+
==== Step 2: install and configure the reverse proxy/load balancer
|
191
|
+
|
192
|
+
The next step is to **install a reverse proxy/load balancer**, and to **configure** it to do the following:
|
193
|
+
|
194
|
+
* To listen on port 80.
|
195
|
+
* To forward requests to either 'foo' or 'bar', depending on the request's HTTP host name.
|
196
|
+
|
197
|
+
You can use any reverse proxy/load balancer you want, but we're going to show an example using link:http://www.nginx.org/[Nginx] because it's a pretty popular choice. Install Nginx as follows:
|
198
|
+
|
199
|
+
|======================================================================
|
200
|
+
| Debian, Ubuntu | `sudo apt-get update` +
|
201
|
+
`sudo apt-get install nginx-extras`
|
202
|
+
| Red Hat, CentOS, ScientificLinux, Amazon Linux | Enable link:http://fedoraproject.org/wiki/EPEL[EPEL], then run as root: +
|
203
|
+
`yum install nginx`
|
204
|
+
| Mac OS X (Homebrew) | `brew install nginx`
|
205
|
+
| Other operating systems | Install Nginx from link:http://www.nginx.org/[the Nginx website].
|
206
|
+
|======================================================================
|
207
|
+
|
208
|
+
Open the Nginx configuration file:
|
209
|
+
|
210
|
+
|======================================================================
|
211
|
+
| Debian, Ubuntu | `/etc/nginx/nginx.conf`
|
212
|
+
| Red Hat, CentOS, ScientificLinux, Amazon Linux | `/etc/nginx/nginx.conf`
|
213
|
+
| Mac OS X (Homebrew) | `/usr/local/etc/nginx/nginx.conf`
|
214
|
+
| Other operating systems | It depends on how you installed Nginx, but it's usually `$PREFIX/conf/nginx.conf`, where `$PREFIX` is the prefix you installed Nginx to.
|
215
|
+
|======================================================================
|
216
|
+
|
217
|
+
Add virtual host entries for your applications foo and bar. While making the virtual host entries, you must determine what host names foo and bar should respond to. Let's say that foo should respond to 'www.foo.com' and bar should respond to 'www.bar.com'. Then the following entries will tell Nginx to listen on port 80, and to handle requests for the domains 'www.foo.com' and 'www.bar.com' differently.
|
218
|
+
|
219
|
+
--------------------------
|
220
|
+
http {
|
221
|
+
...
|
222
|
+
|
223
|
+
# These are some "magic" Nginx configuration options that aid in making
|
224
|
+
# WebSockets work properly with Passenger Standalone. Please learn more
|
225
|
+
# at http://nginx.org/en/docs/http/websocket.html
|
226
|
+
map $http_upgrade $connection_upgrade {
|
227
|
+
default upgrade;
|
228
|
+
'' close;
|
229
|
+
}
|
230
|
+
|
231
|
+
server {
|
232
|
+
listen 80;
|
233
|
+
server_name www.foo.com;
|
234
|
+
|
235
|
+
# Tells Nginx to serve static assets from this directory.
|
236
|
+
root /webapps/foo/public;
|
237
|
+
|
238
|
+
location / {
|
239
|
+
# Tells Nginx to forward all requests for www.foo.com
|
240
|
+
# to the Passenger Standalone instance listening on port 4000.
|
241
|
+
proxy_pass http://127.0.0.1:4000;
|
242
|
+
|
243
|
+
# These are "magic" Nginx configuration options that
|
244
|
+
# should be present in order to make the reverse proxying
|
245
|
+
# work properly. Also contains some options that make WebSockets
|
246
|
+
# work properly with Passenger Standalone. Please learn more at
|
247
|
+
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html
|
248
|
+
proxy_http_version 1.1;
|
249
|
+
proxy_set_header Host $http_host;
|
250
|
+
proxy_set_header Upgrade $http_upgrade;
|
251
|
+
proxy_set_header Connection $connection_upgrade;
|
252
|
+
proxy_buffering off;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
# We handle bar in a similar manner.
|
257
|
+
server {
|
258
|
+
listen 80;
|
259
|
+
server_name www.bar.com;
|
260
|
+
|
261
|
+
root /webapps/bar/public;
|
262
|
+
|
263
|
+
location / {
|
264
|
+
# bar is listening on port 4010 instead of 4000, we
|
265
|
+
# change the URL here.
|
266
|
+
proxy_pass http://127.0.0.1:4010;
|
267
|
+
|
268
|
+
proxy_http_version 1.1;
|
269
|
+
proxy_set_header Host $http_host;
|
270
|
+
proxy_set_header Upgrade $http_upgrade;
|
271
|
+
proxy_set_header Connection $connection_upgrade;
|
272
|
+
proxy_buffering off;
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
--------------------------
|
277
|
+
|
278
|
+
Once you're done editing the Nginx configuration file, restart Nginx:
|
279
|
+
|
280
|
+
|======================================================================
|
281
|
+
| Debian, Ubuntu | `sudo /etc/init.d/nginx restart`
|
282
|
+
| Red Hat, CentOS, ScientificLinux, Amazon Linux | `sudo service nginx restart`
|
283
|
+
| Mac OS X (Homebrew) | 1. Run `sudo kill $(cat /usr/local/var/run/nginx.pid)` +
|
284
|
+
2. You you installed the Nginx launchd plist that Homebrew provides (see `brew info nginx` to learn more), then you don't have to do anything, and launchd will automatically restart Nginx. Otherwise, you have to manually start Nginx again: `sudo /usr/local/bin/nginx`.
|
285
|
+
| Other operating systems | It depends on how you installed Nginx, but it's usually as follows:
|
286
|
+
|
287
|
+
1. Lookup the PID of the Nginx master process using `ps aux`. +
|
288
|
+
2. Run `sudo kill <PID>` +
|
289
|
+
3. Start Nginx again: `sudo $PREFIX/sbin/nginx`, where `$PREFIX` is the prefix you installed Nginx to.
|
290
|
+
|======================================================================
|
291
|
+
|
292
|
+
[float]
|
293
|
+
==== Step 3: testing
|
294
|
+
|
295
|
+
Nginx should now be listening on port 80, and should forward requests to foo and bar respectively. Let's test it out by accessing http://www.foo.com and http://www.bar.com. But first, we need to ensure that any requests to 'www.foo.com' and 'www.bar.com', that originate from the local machine, actually end up at the local host, and not at the IP address specified in the DNS records. To do this, edit `/etc/hosts` and add:
|
296
|
+
|
297
|
+
--------------------------------
|
298
|
+
127.0.0.1 www.foo.com www.bar.com
|
299
|
+
--------------------------------
|
300
|
+
|
301
|
+
Now visit http://www.foo.com and http://www.bar.com, and verify that it works.
|
302
|
+
|
303
|
+
[float]
|
304
|
+
==== Step 4: making all apps start at system boot
|
305
|
+
|
306
|
+
Once you restart the server, the reverse proxy/load balancer will no longer be able to serve 'www.foo.com' or 'www.bar.com' because the Passenger Standalone instances that host them are no longer running. You must therefore configure the system to start Passenger Standalone at system boot. Please refer to <<starting_at_system_boot,Starting Passenger Standalone at system boot>> for more information.
|
307
|
+
|
308
|
+
For example, you can put this in `/etc/rc.local` to make the system start foo and bar at system boot:
|
309
|
+
|
310
|
+
[source,sh]
|
311
|
+
-----------------------------------
|
312
|
+
# If you installed Phusion Passenger from tarball, add its `bin` directory to PATH.
|
313
|
+
#export PATH=/path-to-passenger/bin:$PATH
|
314
|
+
|
315
|
+
cd /webapps/foo
|
316
|
+
passenger start --daemonize --port 4000 --user someusername1
|
317
|
+
|
318
|
+
cd /webapps/bar
|
319
|
+
passenger start --daemonize --port 4010 --user someusername2
|
320
|
+
-----------------------------------
|
321
|
+
|
322
|
+
[float]
|
323
|
+
==== Step 5: wrapping up
|
324
|
+
|
325
|
+
Edit `/etc/hosts` and remove the entry that you added in step 3.
|
326
|
+
|
327
|
+
|
328
|
+
=== Installing Passenger Standalone behind Nginx
|
329
|
+
|
330
|
+
This is described in <<sharing_port,Sharing the same port between multiple Passenger Standalone instances>>.
|
331
|
+
|
332
|
+
|
147
333
|
|
148
334
|
[[mass_deployment]]
|
149
335
|
== Mass deployment
|
@@ -750,7 +750,7 @@ endif::[]
|
|
750
750
|
ifdef::nginx[]
|
751
751
|
=== Installing as a normal Nginx module without using the installer
|
752
752
|
|
753
|
-
You can also install Phusion Passenger the way you install any other Nginx module, e.g. with `--add-module`. This installation mode is useful if you already have an Nginx tarball somewhere
|
753
|
+
You can also install Phusion Passenger the way you install any other Nginx module, e.g. with `--add-module`. This installation mode is useful if you already have an Nginx tarball somewhere.
|
754
754
|
|
755
755
|
You need to run Nginx's configure script with `--add-module=/path-to-passenger-nginx-addon-dir`. The right value for `/path-to-passenger-nginx-addon-dir` can be obtained with the command:
|
756
756
|
|
@@ -773,6 +773,7 @@ passenger-config --root
|
|
773
773
|
|
774
774
|
After having modified the Nginx configuration file, restart Nginx.
|
775
775
|
|
776
|
+
|
776
777
|
[[nginx_init_script]]
|
777
778
|
=== Creating an Nginx init script
|
778
779
|
|
@@ -63,7 +63,8 @@ using namespace oxt;
|
|
63
63
|
* so only access within ApplicationPool lock.
|
64
64
|
*/
|
65
65
|
class Group: public boost::enable_shared_from_this<Group> {
|
66
|
-
private
|
66
|
+
// Actually private, but marked public so that unit tests can access the fields.
|
67
|
+
public:
|
67
68
|
friend class Pool;
|
68
69
|
friend class SuperGroup;
|
69
70
|
|
@@ -146,7 +146,7 @@ private:
|
|
146
146
|
}
|
147
147
|
|
148
148
|
public:
|
149
|
-
/*********** Spawn options that should be set
|
149
|
+
/*********** Spawn options that should be set by the caller ***********
|
150
150
|
* These are the options that are relevant while spawning an application
|
151
151
|
* process. These options are only used during spawning.
|
152
152
|
*/
|
@@ -297,7 +297,7 @@ public:
|
|
297
297
|
bool raiseInternalError;
|
298
298
|
|
299
299
|
|
300
|
-
/*********** Per-group pool options that should be set
|
300
|
+
/*********** Per-group pool options that should be set by the caller ***********
|
301
301
|
* These options dictate how Pool will manage processes, routing, etc. within
|
302
302
|
* a single Group. These options are not process-specific, only group-specific.
|
303
303
|
*/
|
@@ -348,7 +348,11 @@ public:
|
|
348
348
|
/*-----------------*/
|
349
349
|
|
350
350
|
|
351
|
-
/*********** Per-request options that should be set
|
351
|
+
/*********** Per-request pool options that should be set by the caller ***********
|
352
|
+
* These options also dictate how Pool will manage processes, etc. Unlike the
|
353
|
+
* per-group options, these options are customizable on a per-request basis.
|
354
|
+
* Their effects also don't persist longer than a single request.
|
355
|
+
*/
|
352
356
|
|
353
357
|
/** Current request host name. */
|
354
358
|
StaticString hostName;
|
@@ -576,6 +580,8 @@ public:
|
|
576
580
|
appendKeyValue4(vec, "analytics", analytics);
|
577
581
|
|
578
582
|
appendKeyValue (vec, "group_secret", groupSecret);
|
583
|
+
|
584
|
+
/*********************************/
|
579
585
|
}
|
580
586
|
if (fields & PER_GROUP_POOL_OPTIONS) {
|
581
587
|
appendKeyValue3(vec, "min_processes", minProcesses);
|
data/ext/common/Constants.h
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
#include <cstring>
|
31
31
|
#include <cassert>
|
32
32
|
#include <cerrno>
|
33
|
+
#include <stdlib.h>
|
33
34
|
#include <unistd.h>
|
34
35
|
#include <limits.h>
|
35
36
|
#include <pwd.h>
|
@@ -372,6 +373,8 @@ private:
|
|
372
373
|
"privilege to that of user '") + username +
|
373
374
|
"': cannot set user ID", e);
|
374
375
|
}
|
376
|
+
|
377
|
+
setenv("HOME", userEntry->pw_dir, 1);
|
375
378
|
}
|
376
379
|
|
377
380
|
void onSigquit(ev::sig &signal, int revents) {
|
@@ -551,7 +554,7 @@ public:
|
|
551
554
|
poolLoop.start("Pool event loop", 0);
|
552
555
|
requestLoop.start("Request event loop", 0);
|
553
556
|
|
554
|
-
|
557
|
+
|
555
558
|
/* Wait until the watchdog closes the feedback fd (meaning it
|
556
559
|
* was killed) or until we receive an exit message.
|
557
560
|
*/
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include <cstdlib>
|
35
35
|
#include <cstring>
|
36
36
|
#include <cerrno>
|
37
|
+
#include <stdlib.h>
|
37
38
|
#include <signal.h>
|
38
39
|
|
39
40
|
#include <agents/Base.h>
|
@@ -205,6 +206,8 @@ lowerPrivilege(const string &username, const struct passwd *user, gid_t gid) {
|
|
205
206
|
"': cannot set user ID: " << strerror(e) <<
|
206
207
|
" (" << e << ")");
|
207
208
|
}
|
209
|
+
|
210
|
+
setenv("HOME", user->pw_dir, 1);
|
208
211
|
}
|
209
212
|
|
210
213
|
static void
|
@@ -45,13 +45,17 @@ static char *dir;
|
|
45
45
|
/**
|
46
46
|
* When Passenger Standalone is started with --daemonize, then it will
|
47
47
|
* pass --cleanup to this tool so that this tool is responsible
|
48
|
-
* for cleaning up the Standalone temp dir.
|
48
|
+
* for cleaning up the Standalone temp dir. This is because Passenger
|
49
|
+
* Standalone may be started in daemonize mode, which makes it exit asap
|
50
|
+
* in order to conserve memory. Passenger Standalone can therefore not
|
51
|
+
* be responsible for cleaning up the temp dir.
|
49
52
|
*/
|
50
53
|
static int shouldCleanup = 0;
|
51
54
|
static int shouldDaemonize = 0;
|
52
55
|
static const char *pidFile = NULL;
|
53
56
|
static const char *logFile = NULL;
|
54
57
|
static int terminationPipe[2];
|
58
|
+
static sig_atomic_t shouldIgnoreNextTermSignal = 0;
|
55
59
|
|
56
60
|
|
57
61
|
static void
|
@@ -148,10 +152,19 @@ initialize(int argc, char *argv[]) {
|
|
148
152
|
|
149
153
|
static void
|
150
154
|
exitHandler(int signo) {
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
+
if (shouldIgnoreNextTermSignal) {
|
156
|
+
shouldIgnoreNextTermSignal = 0;
|
157
|
+
} else {
|
158
|
+
int ret = write(terminationPipe[1], "x", 1);
|
159
|
+
// We can't do anything about failures, so ignore
|
160
|
+
// compiler warnings about not using the result.
|
161
|
+
(void) ret;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
static void
|
166
|
+
ignoreNextTermSignalHandler(int signo) {
|
167
|
+
shouldIgnoreNextTermSignal = 1;
|
155
168
|
}
|
156
169
|
|
157
170
|
static void
|
@@ -163,6 +176,10 @@ installSignalHandlers() {
|
|
163
176
|
sigemptyset(&action.sa_mask);
|
164
177
|
sigaction(SIGINT, &action, NULL);
|
165
178
|
sigaction(SIGTERM, &action, NULL);
|
179
|
+
|
180
|
+
action.sa_handler = ignoreNextTermSignalHandler;
|
181
|
+
action.sa_flags = SA_RESTART;
|
182
|
+
sigaction(SIGHUP, &action, NULL);
|
166
183
|
}
|
167
184
|
|
168
185
|
static void
|
@@ -303,6 +303,19 @@ readCleanupPids(const WorkingObjectsPtr &wo) {
|
|
303
303
|
return result;
|
304
304
|
}
|
305
305
|
|
306
|
+
static void
|
307
|
+
killCleanupPids(const vector<pid_t> &cleanupPids) {
|
308
|
+
foreach (pid_t pid, cleanupPids) {
|
309
|
+
P_DEBUG("Sending SIGTERM to cleanup PID " << pid);
|
310
|
+
kill(pid, SIGTERM);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
static void
|
315
|
+
killCleanupPids(const WorkingObjectsPtr &wo) {
|
316
|
+
killCleanupPids(readCleanupPids(wo));
|
317
|
+
}
|
318
|
+
|
306
319
|
static void
|
307
320
|
cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers, char *argv[]) {
|
308
321
|
this_thread::disable_interruption di;
|
@@ -389,10 +402,8 @@ cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &
|
|
389
402
|
wo->serverInstanceDir->destroy();
|
390
403
|
|
391
404
|
// Notify given PIDs about our shutdown.
|
392
|
-
|
393
|
-
|
394
|
-
kill(pid, SIGTERM);
|
395
|
-
}
|
405
|
+
killCleanupPids(cleanupPids);
|
406
|
+
|
396
407
|
strcpy(argv[0], "PassengerWatchdog (cleaning up 6...)");
|
397
408
|
_exit(0);
|
398
409
|
} catch (const std::exception &e) {
|
@@ -418,7 +429,7 @@ cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &
|
|
418
429
|
}
|
419
430
|
|
420
431
|
static void
|
421
|
-
forceAllAgentsShutdown(vector<AgentWatcherPtr> &watchers) {
|
432
|
+
forceAllAgentsShutdown(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
|
422
433
|
vector<AgentWatcherPtr>::iterator it;
|
423
434
|
|
424
435
|
for (it = watchers.begin(); it != watchers.end(); it++) {
|
@@ -428,6 +439,7 @@ forceAllAgentsShutdown(vector<AgentWatcherPtr> &watchers) {
|
|
428
439
|
for (it = watchers.begin(); it != watchers.end(); it++) {
|
429
440
|
(*it)->forceShutdown();
|
430
441
|
}
|
442
|
+
killCleanupPids(wo);
|
431
443
|
}
|
432
444
|
|
433
445
|
static string
|
@@ -640,7 +652,7 @@ startAgents(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
|
|
640
652
|
"Watchdog startup error",
|
641
653
|
e.what(),
|
642
654
|
NULL);
|
643
|
-
forceAllAgentsShutdown(watchers);
|
655
|
+
forceAllAgentsShutdown(wo, watchers);
|
644
656
|
exit(1);
|
645
657
|
}
|
646
658
|
// Allow other exceptions to propagate and crash the watchdog.
|
@@ -657,7 +669,7 @@ beginWatchingAgents(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watche
|
|
657
669
|
"Watchdog startup error",
|
658
670
|
e.what(),
|
659
671
|
NULL);
|
660
|
-
forceAllAgentsShutdown(watchers);
|
672
|
+
forceAllAgentsShutdown(wo, watchers);
|
661
673
|
exit(1);
|
662
674
|
}
|
663
675
|
// Allow other exceptions to propagate and crash the watchdog.
|
@@ -701,6 +713,9 @@ main(int argc, char *argv[]) {
|
|
701
713
|
"Watchdog startup error",
|
702
714
|
e.what(),
|
703
715
|
NULL);
|
716
|
+
if (wo != NULL) {
|
717
|
+
killCleanupPids(wo);
|
718
|
+
}
|
704
719
|
return 1;
|
705
720
|
}
|
706
721
|
// Allow other exceptions to propagate and crash the watchdog.
|
@@ -736,7 +751,7 @@ main(int argc, char *argv[]) {
|
|
736
751
|
cleanupAgentsInBackground(wo, watchers, argv);
|
737
752
|
} else {
|
738
753
|
UPDATE_TRACE_POINT();
|
739
|
-
forceAllAgentsShutdown(watchers);
|
754
|
+
forceAllAgentsShutdown(wo, watchers);
|
740
755
|
}
|
741
756
|
UPDATE_TRACE_POINT();
|
742
757
|
runHookScriptAndThrowOnError("after_watchdog_shutdown");
|
data/lib/phusion_passenger.rb
CHANGED
@@ -30,7 +30,7 @@ module PhusionPassenger
|
|
30
30
|
|
31
31
|
PACKAGE_NAME = 'passenger'
|
32
32
|
# Run 'rake ext/common/Constants.h' after changing this number.
|
33
|
-
VERSION_STRING = '4.0.
|
33
|
+
VERSION_STRING = '4.0.36'
|
34
34
|
|
35
35
|
PREFERRED_NGINX_VERSION = '1.4.4'
|
36
36
|
NGINX_SHA256_CHECKSUM = '7c989a58e5408c9593da0bebcd0e4ffc3d892d1316ba5042ddb0be5b0b4102b9'
|
@@ -183,12 +183,17 @@ private
|
|
183
183
|
def write_nginx_config_file
|
184
184
|
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
185
185
|
PhusionPassenger.require_passenger_lib 'utils/tmpio'
|
186
|
-
@temp_dir
|
186
|
+
# @temp_dir may already be set because we're redeploying
|
187
|
+
# using Mass Deployment.
|
188
|
+
@temp_dir ||= PhusionPassenger::Utils.mktmpdir(
|
187
189
|
"passenger-standalone.")
|
188
190
|
@config_filename = "#{@temp_dir}/config"
|
189
191
|
location_config_filename = "#{@temp_dir}/locations.ini"
|
190
192
|
File.chmod(0755, @temp_dir)
|
191
|
-
|
193
|
+
begin
|
194
|
+
Dir.mkdir("#{@temp_dir}/logs")
|
195
|
+
rescue Errno::EEXIST
|
196
|
+
end
|
192
197
|
|
193
198
|
locations_ini_fields =
|
194
199
|
PhusionPassenger::REQUIRED_LOCATIONS_INI_FIELDS +
|
@@ -422,11 +422,7 @@ private
|
|
422
422
|
end
|
423
423
|
|
424
424
|
def should_wait_until_nginx_has_exited?
|
425
|
-
return !@options[:daemonize]
|
426
|
-
end
|
427
|
-
|
428
|
-
def should_cleanup_temp_dir?
|
429
|
-
return @temp_dir && !@options[:daemonize]
|
425
|
+
return !@options[:daemonize] || @app_finder.multi_mode?
|
430
426
|
end
|
431
427
|
|
432
428
|
# Returns the URL that Nginx will be listening on.
|
@@ -68,7 +68,8 @@ http {
|
|
68
68
|
gzip_comp_level 3;
|
69
69
|
gzip_min_length 150;
|
70
70
|
gzip_proxied any;
|
71
|
-
gzip_types text/plain text/css
|
71
|
+
gzip_types text/plain text/css text/json text/javascript \
|
72
|
+
application/javascript application/x-javascript application/json;
|
72
73
|
|
73
74
|
<% if @apps.size > 1 %>
|
74
75
|
# Default server entry.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passenger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phusion - http://www.phusion.nl/
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
metadata.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABAgAGBQJS4syKAAoJECrHRaUKISqMpZoH/iwKVIdh40yt8z9zma0e7w8R
|
6
|
+
olvsvhYmjAtX+Jigosb5hXPr3pF4ZOtuuAJlyrU/JZkcseOFqmigGf2Junl6mN03
|
7
|
+
v7E6RbiTJSAsEZZpOEqhSiqDINlolChmWtXWKi1D6tV1RtFzwR+xclsks3m+Dm7O
|
8
|
+
mB9y1pCwW3EQvZr4dKpS4f22z/QBiDm9ieC1NVpfEy0u9d2N+W7Wty0ExNzP1jjP
|
9
|
+
STWpMcV1G8hUbZ2ZJ2epObCQeHGLT3SKoD9q2WV8p6+m7+eo9MxeJgqjcKob7Hb5
|
10
|
+
2pwmBFkwzmlV4FblJ42rFcs5W/BUL2U3tUpYTQJ2zeO7oQRhoulhsmLZnG8j44o=
|
11
|
+
=JXVh
|
12
12
|
-----END PGP SIGNATURE-----
|