Phusion passenger-status: what value for passenger_instance_registry_dir?
Asked Answered
A

4

20

I've done a new install of nginx 1.6.3 and passenger 5.0.15 on Ubuntu 14.04 from source in order to add tracing components from AppNeta for my ROR 4.2 app on one of my servers. Nginx and passenger are running and serving pages. I am getting the trace data for server monitoring. All seems well,

However, when I run "passenger-status" (as root), I get the following:

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:

  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 passenger-status 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.

The problem with this is that it seems to be blocking capistrano deploys; this same error is displayed by cap before exiting.

Passenger is running (it's in the ps output and pages are being served). I just need to tell passenger-status where to find the current running instance. (This is from the Design and Architecture documentation.) Therefore, it seems that setting this instance registry directory value is the required step. But to what value?

According to the Nginx Reference, the defaults are /tmp and /var/run/passenger-instreg And I've found an instance directory in /tmp. So, I've tried setting the PASSENGER_INSTANCE_REGISTRY_DIR to a number of different values:

  • /tmp
  • /tmp/passenger.JxmCeiA (the current instance directory, but this changes with each startup of Nginx)

I've even tried creating a directory at /run/passenger, setting that value in the nginx configuration file and restarting nginx. The temporary directory is being created, but passenger-status still gives the same message. Even if I use the /opt/passenger-5.0.15/bin/passenger-status script to make sure I'm using the latest version of that script.

There are some configuration values in the original 'location.ini' directory for passenger, but none were the instance registry directory, so there was nothing to reuse.

Interestingly, the /opt/passenger-5.0.15/lib/phusion_passenger/nginx/config_options.rb file does not have an entry for passenger_instance_registory_dir. It has other nginx configuration options, I would have expected it to have this one as well.

I've tried setting the environment variable as well as the Nginx passenger_instance_registry_dir option, but I must be missing something in my understanding because I can't seem to connect the passenger-status command with the current running instance.

Any help would be greatly appreciated.

Afterimage answered 1/8, 2015 at 11:54 Comment(1)
Would be nice if the error message would contain the correct and the wrong path, or something along the lines.Groping
U
15

Passenger author here.

/tmp/passenger.JxmCeiA is an example of an instance directory. This changes indeed with every startup (because it is specific to an instance).

The parent directory (the directory in which instance directories are located) is the instance registry directory. So in your case, the instance registry directory that is being used is /tmp.

I'm guessing that you have some kind of Passenger installation version mismatch. We've changed the structure of the instance directory a few times in the past, and every time we did this we bump an internal version number to indicate that it's incompatible with previous Passenger versions. Can you double check the following?

  • Does Passenger appear to be otherwise running correctly?
  • What Passenger version is compiled inside Nginx?
  • What is your passenger_root set to? Does it match the Passenger version compiled inside Nginx?
  • Where is the full path to the first passenger-status in PATH? Does it match passenger_root?

You also seem to be mixing the Phusion Passenger APT repository with source tarball install. Having multiple installations around is generally a bad idea. Try cleaning up your other installs so that you only end up with one.

Also check whether you are setting the PASSENGER_INSTANCE_REGISTRY_DIR environment variable correctly. Note that sudo nukes environment variables, so you need to run passenger-status like this:

# Correct:
sudo env PASSENGER_INSTANCE_REGISTRY_DIR=/tmp passenger-status

# Incorrect, sudo nukes environment variables
export PASSENGER_INSTANCE_REGISTRY_DIR=/tmp
sudo passenger-status

Regarding lib/phusion_passenger/nginx/config_options.rb: that file mainly lists per-server and per-location config options. Many config options in the main context are either not yet ported to the config_options.rb system, or not possible because they require custom attention. At present, passenger_instance_registry_dir is implemented in ext/common/nginx/Configuration.c. As we continue to cleanup and refactor the codebase, this option may eventually be moved to config_options.rb.

Uzzia answered 2/8, 2015 at 8:4 Comment(6)
The correct command was: sudo env PASSENGER_INSTANCE_REGISTRY_DIR=/run/passenger /opt/passenger-5.0.15/bin/passenger-status. It should be possible now to set the environment correctly for capistrano to runAfterimage
Passenger is running correctly. It was compiled inside Nginx. "passenger_root" is set to /opt/passenger-5.0.15, which is the version compiled inside of Nginx. I've copied "passenger-status" to /usr/sbin, which is the first directory on the PATH. The challenge seems to be to get sudo passenger-status to run for the necessary deployer account. Perhaps restoring the default use of /tmp for the instance registry directory will solve that need.Afterimage
One more note; modify the PATH so that the new bin directory of the new passenger install (e.g. /opt/passenger-5.0.15/bin) is first in the PATH.Afterimage
The item "Where is the full path to the first passenger-status in PATH? Does it match passenger_root?" did the trick. The PATH was pointing to an older installation. Thanks.Ellipticity
So, what to do?Groping
Where do I find passenger_root? And how do I find out what version Nginx was compiled with?Groping
C
12

In case anyone else is having this problem when starting Passenger using a systemd service, this might be due to systemd's private /tmp. The problem was solved by adding PrivateTmp=false to the service file.

Source

Chancroid answered 11/1, 2017 at 12:22 Comment(3)
This indeed is the problem, and for others: instead of having a non-private /tmp, you can set PassengerInstanceRegistryDir /var/run/passenger-instreg (and create that directory of course).Self
If you choose to place the instance registry dir under /var/run, be prepared that this directory may disappear after every reboot. See this for an explanation and a remedy, and have a look at man tmpfiles.d.Systemize
Same issue happened to me on Ubuntu18.04 and @Chancroid answer fixed the problem.Compromise
H
7

step one check phusion passenger is installed correctly

sudo passenger-config validate-install

"if you see an ouput saying, 'Everything is looks good :-)'" then you are fine, if not you need to reinstall phusion passenger, refer to https://www.phusionpassenger.com/library/walkthroughs/start/

step two check the phusion passenger memory status

sudo passenger-memory-stats

"if you see processes running, then that's good, if not you either have to start some passenger app, or install nginx or apache with extra library for them. For nginx you need nginx and the nginx-extras".

step three uncomment the passenger_root in the nginx.conf file (for ubuntu it's usually /etc/nginx/nginx.conf) or the apache.conf file

restart nginx or apache

sudo service nginx restart # (or systemctl restart nginx, for new version of linux such as ubuntu 15.04, CentOS7)

now you can run

passenger-status 

the error should go away now. The mostly likely output you will get is saying "Phusion Passenger is currently not serving any applications."

Hogshead answered 16/8, 2015 at 0:15 Comment(0)
W
2

I'm running Passenger in Nginx integration mode, on Ubuntu 20.04 and I've installed it via apt from the official repos.

What worked for me was adding this to /etc/nginx/conf.d/mod-http-passenger.conf :

passenger_instance_registry_dir /tmp;

Restarting passenger the Capistrano way from the command line should now work:

$ passenger-config restart-app <your_app's_root_path> --ignore-app-not-running

If this works, Capistrano deployments should now work again.

Wrecker answered 26/11, 2020 at 10:2 Comment(1)
I just restarted Nginx after adding the line, but thank youHerc

© 2022 - 2024 — McMap. All rights reserved.