passengerコマンドがエラーで使えない場合の対処法

2/22/2020

passengerコマンドを使う

$ 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.

ディレクトリを指定しないと使えない。

$ PASSENGER_INSTANCE_REGISTRY_DIR=/tmp/systemd-private-49bd2fdc80f5485baf57feab553b100d-apache2.service-eaNrct/tmp/ passenger-status

Version : 6.0.4
Date    : 2020-02-21 11:25:20 +0900
Instance: OtVnXscK (Apache/2.4.41 (Ubuntu) Phusion_Passenger/6.0.4)

Traceback (most recent call last):
	6: from /usr/sbin/passenger-status:349:in `<main>'
	5: from /usr/sbin/passenger-status:346:in `start'
	4: from /usr/sbin/passenger-status:62:in `command_show_status'
	3: from /usr/sbin/passenger-status:124:in `show_status'
	2: from /usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `http_request'
	1: from /usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `new'
/usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `initialize': too long unix socket path (117bytes given but 108bytes max) (ArgumentError)

ディレクトリ名が長くても使えない。
面倒なのでシンボリックリンクを作って環境変数にいれる。

cd /tmp/
ln -s /tmp/systemd-private-49bd2fdc80f5485baf57feab553b100d-apache2.service-eaNrct/tmp/ use_passenger_command

export PASSENGER_INSTANCE_REGISTRY_DIR="/tmp/use_passenger_command"

$ passenger-status

Version : 6.0.4
Date    : 2020-02-21 11:31:03 +0900
Instance: OtVnXscK (Apache/2.4.41 (Ubuntu) Phusion_Passenger/6.0.4)

----------- General information -----------
Max pool size : 6
App groups    : 1
Processes     : 3
Requests in top-level queue : 0

----------- Application groups -----------
/srv/www/rails/current :
  App root: /srv/www/rails/current
  Requests in queue: 0
  * PID: 28202   Sessions: 0       Processed: 7301    Uptime: 17h 9m 2s
    CPU: 0%      Memory  : 233M    Last used: 4s ago
  * PID: 28235   Sessions: 0       Processed: 22      Uptime: 17h 9m 2s
    CPU: 0%      Memory  : 189M    Last used: 2m 39s ag
  * PID: 28260   Sessions: 0       Processed: 0       Uptime: 17h 9m 1s
    CPU: 0%      Memory  : 175M    Last used: 17h 9m 1s

これで使える。

©️ 2020 ふじい Dev-Remo-Work.