Skip to content

Instantly share code, notes, and snippets.

@jandudulski
Last active January 12, 2016 15:59
Show Gist options
  • Save jandudulski/b1818d3ae565d837d4d9 to your computer and use it in GitHub Desktop.
Save jandudulski/b1818d3ae565d837d4d9 to your computer and use it in GitHub Desktop.
Passenger multiple instances

So you want to restart your passenger standalone app

cd path/to/app && ./bin/passenger-config restart-app .

This works until you have multiple passenger apps...

./bin/passenger-config restart-app .
It appears that multiple Phusion Passenger instances are running. Please select
a specific one by passing:

  --instance 

The following Phusion Passenger instances are running:

Name                       Description
------------------------------------------------------------------
oithHie6                   nginx/1.8.0 Phusion_Passenger/5.0.14
uftk5e6O                   nginx/1.8.0 Phusion_Passenger/5.0.18

So you have to update Passengerfile.json

{
  "instance_reigstry_dir": "/path/to/instance"
}

PROTIP: long paths won't work - there're limits (sic!)

But you're not ready - it won't work either

./bin/passenger-config restart-app .
*** ERROR: Phusion Passenger doesn't seem to be running. If you are sure that it
is running, then the causes of this problem could be one of:

 1. You customized the instance registry directory using Apache's
    PassengerInstanceRegistryDir option, Nginx's
    passenger_instance_registry_dir option, or Phusion Passenger Standalone's
    --instance-registry-dir command line argument. If so, please set the
    environment variable PASSENGER_INSTANCE_REGISTRY_DIR to that directory
    and run this command again.
 2. The instance directory has been removed by an operating system background
    service. Please set a different instance registry directory using Apache's
    PassengerInstanceRegistryDir option, Nginx's passenger_instance_registry_dir
    option, or Phusion Passenger Standalone's --instance-registry-dir command
    line argument.

So you have to update bash variable...

export PASSENGER_INSTANCE_REGISTRY_DIR=/path/to/instance
Q: But I'm running two apps under one user!
A: Sorry, you're fucked

Or just run export in the deployment script, not in bashrc. And you guessed it - you cannot just pass --instance-registry-dir to the passenger-config command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment