Re: [phusion-passenger] Passenger 4 and bash_profile

97 views
Skip to first unread message

Hongli Lai

unread,
May 8, 2013, 12:53:47 PM5/8/13
to phusion-passenger
Yes Phusion Passenger 4 loads .bash_profile. It actually executes all
apps through "bash -l". This is because a lot of people set
environment variables in their bashrc/bash_profile, not knowing that
they wouldn't be inherited by the web server. We wanted that way to
set environment variables to work out of the box.

You should only run interactive stuff when there's a TTY. On most OSes
bash_profile is already written in such a way that some things only
start when there's a TTY. Your code could look like this:

if tty -s; then
$(gpg-agent --daemon)
fi

On Wed, May 8, 2013 at 5:33 PM, Jonathan Rochkind <roch...@jhu.edu> wrote:
> Has Passenger between 3 and 4 changed how it loads the environment, and
> which .dotfiles it might load when forking an app?
>
> I had a .bash_profile with some interactive stuff in it (ssh-agent related),
> in the account that my app was running in.
>
> Under Passenger 3.x, this did not cause a problem.
>
> Under Passenger 4.0.2 -- I got an error from Passenger when trying to access
> the app, that it tried to start up the app but couldn't (error message being
> the "Enter passphrase" prompt from ssh-agent, yeah, if it's executing the
> .bash_profile that has that interactive stuff in it, of course it won't
> work).
>
> So, have things changed with regard to what dotfiles get executed on app
> launch in Passenger 3 to Passenger 4? Any docs on this, and on how I should
> think about it, and where I should put my stuff that really should only be
> for interactive shells and not for Passenger running on the same account?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/phusion-passenger?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Patrick Gibson

unread,
Jul 17, 2013, 1:21:05 PM7/17/13
to phusion-...@googlegroups.com
Is this documented somewhere? I just updated to Passenger 4 and when none of my apps would start, the first thing I looked for were notes about upgrading from 3 and 4. I didn't see anything and after about an hour of debugging, finally figured out that it was my shell's .profile file that was preventing my apps from starting. (My shell issues a prompt under certain circumstances, and it held Passenger up waiting for console input.) Putting if tty -s; then ... fi around everything did fix it (thanks for that tip), but this seems like an important enough change to put front and center.

Hongli Lai

unread,
Jul 17, 2013, 1:24:19 PM7/17/13
to phusion-passenger
On Wed, Jul 17, 2013 at 7:21 PM, Patrick Gibson <patric...@gmail.com> wrote:
Is this documented somewhere? I just updated to Passenger 4 and when none of my apps would start, the first thing I looked for were notes about upgrading from 3 and 4. I didn't see anything and after about an hour of debugging, finally figured out that it was my shell's .profile file that was preventing my apps from starting. (My shell issues a prompt under certain circumstances, and it held Passenger up waiting for console input.) Putting if tty -s; then ... fi around everything did fix it (thanks for that tip), but this seems like an important enough change to put front and center.

It's documented in this troubleshooting document, although the documentation could be better. https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems
There's an ongoing effort to improve the documentation.
 

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Patrick Gibson

unread,
Jul 17, 2013, 1:30:45 PM7/17/13
to phusion-...@googlegroups.com
Okay, thanks. I wasn't actually even aware this document/wiki existed. It would be great to add a link to the official Nginx and Apache guides, as that's what Google refers people to for documentation.

Hongli Lai

unread,
Jul 17, 2013, 4:55:42 PM7/17/13
to phusion-passenger
Yes, that's the plan. It was written a couple of days ago so it hasn't been integrated into the main documentation yet. The entire troubleshooting section needs a major overhaul.
Reply all
Reply to author
Forward
0 new messages