Sig
Sig

Reputation: 5958

bundle not found when running services using upstart/foreman

I'm setting up a staging environment for a Rails 4 app on Ubuntu 12.04. I use: - rbenv for managing rubies - capistrano for deployemnt - foreman for managing services

In particular, I want to run que as a service. My Procfile looks like

que: bundle exec rake que:work

I have exported the Procfile for upstart successfully. My sapp-que-1.conf looks like

start on starting ft-id-que
stop on stopping ft-id-que
respawn

exec su - deployer -c 'cd /home/deployer/apps/sapp/releases/20140307080502; export PORT=5000; bundle exec rake que:work  >> /home/deployer/apps/sapp/current/log/que-1.log 2>&1'

When I try to start it (sudo start sapp) I get the following error:

-su: bundle: command not found

However if I cd into /home/deployer/apps/sapp/releases/20140307080502 and I manually run bundle exec rake que:work the rake is executed.

Am I missing anything here?

Thanks.

Upvotes: 1

Views: 934

Answers (1)

user3758624
user3758624

Reputation: 176

Could you have .bash_profile ?

The su does not read .bashrc.

[SOLVED] Special user, .bashrc not being executed upon login

I create .bash_profile with

# Load the default .profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" 

# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

Upvotes: 1

Related Questions