Nginx server configuration when using passenger standalone

625 views
Skip to first unread message

Franck D'agostini

unread,
Nov 19, 2010, 1:00:24 PM11/19/10
to Phusion Passenger Discussions
Hi everyone,

I'm using passenger standalone to run several rails 2.x/ruby1.8.7
applications on the same machine.

I start passenger standalone using an home made init script and it
works great (see this thread :
http://groups.google.com/group/phusion-passenger/browse_thread/thread/d96d19fa645a6eae)

My problem is that when I deploy one of these apps via capistrano,
passenger standalone still use the previous app release. When I use my
init script to stop/start the app, the new release is taken now into
account.

Obviously, I don't want to stop the server everytime I deploy a new
release.

Tracking down the issue, I found this nginx configuration file created
on the fly when starting passenger standalone : /tmp/passenger-
standalone.27194.conf

Here is the content :

master_process on;
worker_processes 1;
daemon on;
error_log '/var/www/myapp/releases/20101119094011/log/passenger.
3000.log';
pid '/var/www/myapp/releases/20101119094011/tmp/pids/passenger.
3000.pid';


events {
worker_connections 1024;
}

http {
include '/home/deploy/.passenger/standalone/3.0.0-x86_64-ruby1.8.7-
linux-gcc4.4.3-1002/nginx-0.8.52/conf/mime.types';
client_body_temp_path '/home/deploy/.passenger/standalone/3.0.0-
x86_64-ruby1.8.7-linux-gcc4.4.3-1002/nginx-0.8.52/temp/client';
proxy_temp_path '/home/deploy/.passenger/standalone/3.0.0-x86_64-
ruby1.8.7-linux-gcc4.4.3-1002/nginx-0.8.52/temp/proxy';
passenger_ruby /usr/local/rvm/wrappers/ruby-1.8.7-p302/ruby;
passenger_root '/home/deploy/.passenger/standalone/3.0.0-x86_64-
ruby1.8.7-linux-gcc4.4.3-1002/support';
passenger_abort_on_startup_error on;
passenger_user_switching off;
passenger_max_pool_size 6;
passenger_min_instances 1;

default_type application/octet-stream;
client_max_body_size 50m;
access_log off;
keepalive_timeout 60;
gzip on;
gzip_comp_level 3;
gzip_min_length 150;
gzip_proxied any;
gzip_types text/plain text/css application/javascript application/
x-javascript;

server {
listen 127.0.0.1:3000;
server_name _;
root '/var/www/myapp/releases/20101119094011/public';
passenger_enabled on;
rails_env production;
passenger_spawn_method smart-lv2;
passenger_min_instances 1;
}
}



Oy ! Look at all this paths to my app : /var/www/myapp/releases/
20101119094011 here and there ... The path to my app is hard coded
inside the nginx configuration file created when passenger standalone
starts.

Indeed, I "cd" to the current release and then fire passenger command
to launch the server. The AppFinder class guess the path and find the
real path (/var/www/myapp/releases/xxxxxxx) when I would love to see
the symlink path (/var/www/myapp/current).

Am I missing something ? Does someone see a workaround ? Could we
imagine a additional configuration option such as "--app-root /var/www/
myapp/current" ?




Hongli Lai

unread,
Nov 19, 2010, 1:03:35 PM11/19/10
to phusion-...@googlegroups.com

That would not solve your problem. When the Ruby processes have
started, their current working directories will be tied to that of
your older release regardless of symlink changes. One *must* restart
the server in order for new deploys to have effect. The same is true
for Mongrel, Unicorn and Thin.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Reply all
Reply to author
Forward
0 new messages