How to stop rails nginx-passenger application?
Asked Answered
H

2

5

I use the passenger spawned by nginx. There are many other rails applications on the server that uses passenger (each has own virtual host in nginx).

I can restart the Rails/Nginx/Passenger application like this:

touch tmp/restart.txt

How I can stop it?

This doesn't work:

touch tmp/stop.txt
touch tmp/shutdown.txt
Heavenward answered 22/10, 2013 at 18:43 Comment(3)
passenger is unstoppable!! have to stop the server. If you force kill the passenger spawner it will start it up again.Pantelleria
Are you using passenger standalone, or are your passenger instances spawned by nginx?Unclinch
@ZachKemp nginx spawns passengerHeavenward
H
8

Method 1

Remove your app's virtual host entry and restart Nginx. Phusion Passenger will no longer serve it.

Method 2

In case you want to keep your app's virtual host entry, but not actually run the app.

Set the following option and restart Nginx:

passenger_min_instances 0;

Phusion Passenger will now shut down your app if it hasn't seen traffic for a while (~10 minutes). It'll be started again if traffic comes in for that app.

With passenger_min_instances 0, you can also kill the application processes manually. Look up the PIDs with passenger-status, then run kill <PID>.

Hahn answered 22/10, 2013 at 21:15 Comment(3)
I have other applications so I can't kill the passenger.Heavenward
To activate passenger_min_instances you have to restart Nginx. You can also just try killing the PIDs. As long as it's not the only PID for that app (i.e. the default passenger_min_instances 1 constraint hasn't been violated yet), the process will be successfully killed.Hahn
If you remove your app's virtual host entry (or comment it), it should be enough to reload nginx. This would allow you to not drop connections for all other virtual hosts.Colander
C
0

Passenger is built to auto-run at all times.

As a workaround, you can stop the webserver entirely, or stop serving the particular app that you don't want to be served by removing the virtual host entry for it.

You could also uninstall passenger if you're really desperate

Chiclayo answered 22/10, 2013 at 19:14 Comment(1)
you might be of some help on this one : how to then serve an app through a proxy with a standalone passenger process (phusionpassenger.com/library/deploy/standalone/…). Or should there be 2 processes running ?Rachealrachel

© 2022 - 2024 — McMap. All rights reserved.