Passenger doesn't seem to be running (Capistrano/Rails/Apache/Ubuntu)
Asked Answered
G

2

9

Deploying a Rails app using Capistrano to an Ubuntu VM running Apache with Passenger enabled.

I followed this tutorial: https://www.phusionpassenger.com/library/install/apache/install/oss/trusty/ with a few changes given that I'm on 17.04, not 14.04 LTS.

passenger-config validate-install says everything looks fine with both Passenger and Apache. passenger-memory-stats shows both Passenger and Apache processes.

I have sudo apache2ctl restarted several times, with no warnings. But passenger-status, and therefore the passenger-config restart-app that Capistrano runs, reports that Passenger "doesn't seem to be running." So my deploy stops.

There's only one Ruby on the machine, ruby-2.4.1 installed using ruby-install. I have apt-get update and upgraded in case of version mismatches.

Apache logs don't show any errors, certainly none related to Passenger.

Why would Passenger internally disagree, saying that it's both configured properly and there are processes running, but then later saying that it's not running?

Ghat answered 5/9, 2017 at 15:34 Comment(16)
There's a 17.04 tutorial here: phusionpassenger.com/library/install/apache/install/oss/zestyGarth
What users are you testing with vs running capistrano as? and can you dump the shell env here for both?Garth
Camden thanks, the steps in the tutorial are the same as far as I can see. Only one user for the moment for both setup and deploy. There's a couple semi-sensitive things in the ENV, but I can give you PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin. Nothing in there specifically related to Passenger (like customizing the instance registry directory). Let me know if any other ENV values would help you.Ghat
Is $TMPDIR the same in both envs?Garth
Sorry, I misunderstood your question before. I have one remote and one local user. On the server (Ubuntu) $TMPDIR is not set. Locally (OSX) it's /var/folders/50/m8x23f6s7lg6pb2sxpx_47g4m2j3m8/T/.Ghat
You have to test the commands via ssh on the server, your local osx user environment isn't relevant. When I asked about the users I meant the user capistrano uses and the ssh user you log in as to run commands on the server.Garth
Ah, okay. Then I didn't misunderstand. Just one remote user, whose $TMPDIR is unset. The PATH I gave you was remote as well.Ghat
Do you set the PassengerInstanceRegistryDir? If so then your CLI tools need the PASSENGER_INSTANCE_REGISTRY_DIR env var set to the same value.Garth
No, I haven't set that value anywhere.Ghat
Then is there a passenger.randomstring dir in /tmp?Garth
you might have multiple passenger installationsStanwood
Camden, no, that was locally (OSX).Ghat
Saiqul — how would I check? I believe I have only one Ruby on the machine at all.Ghat
#40611568Chlorosis
Tony, thanks, I'll try customizing the instance registry directory.Ghat
Tony, that worked. Specifically I did have to do the final step of configuring the environment variable in my passenger settings. If you want to submit that as an answer here, I'd be happy to credit you with the bounty.Ghat
G
5

I needed to customize the instance registry directory, as suggested by Tony Vincent:

/etc/apache2/mods-enabled/passenger.conf on the server:

PassengerInstanceRegistryDir /home/MYUSER/passenger_temp

config/deploy/production.rb in the Rails app:

set :default_env, { 'PASSENGER_INSTANCE_REGISTRY_DIR' => '/home/MYUSER/passenger_temp' }
Ghat answered 14/9, 2017 at 16:23 Comment(4)
I ran into this problem after upgrading my server from Debian Jessie to Debian Stretch (which upgraded Apache). This worked for me to fix it. Thanks!Meaning
I also encountered this problem when installing phusion passenger in Debian Stretch for apache2. This seems like a defect in Phusion's operating system and server technology specific installation instructions. This information is necessary to get passenger-status to work properly.Churinga
You are the champion. +100000Ruyle
Passenger will complain because the directory given isn't safe. The fundamental issue here is that systemd sets up private tmp directories, so the actual path to a file that's in /tmp cannot be known ahead of time. I use method #1 from this writeup on the subject: pistolfly.com/weblog/en/2016/01/… I do not recommend putting Passenger's registry directory in a standard path as shown in this answer.Episcopalian
G
0

Sorry to harp on this but did you run passenger-config validate-install on the ubuntu server (not osx)? Same for passenger-memory-stats and sudo apache2ctl restart.

Based on /tmp not having a passenger.randomstring dir, it sounds like you are confusing local and remote commands. /tmp is the default location for PassengerInstanceRegistryDirs on Ubuntu so if Passenger is running there should be a dir in /tmp that starts with passenger..

Garth answered 11/9, 2017 at 15:8 Comment(1)
No, I just misunderstood whether that was what you were asking. The only thing I'm running locally is cap production deploy. passenger-config validate-install, passenger-memory-stats and apache2ctl restart were all run remotely. ls /tmp remotely does not give me anything related to passenger.Ghat

© 2022 - 2024 — McMap. All rights reserved.