mardi 28 juin 2016

debian capistrano 3 default PATH environment variable

I dont know why but during

cap production deploy 

echo $PATH prints

/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

instead off

PATH=/usr/local/rvm/gems/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/rvm/bin

My deploy.rb

# config valid only for current version of Capistrano
lock '3.5.0'

set :application, 'app'
set :branch, "master"
set :repo_url, 'git@github.com:url/repo.git'
set :deploy_to, "/home/deploy/app"
set :unicorn_conf, "#{deploy_to}/current/config/unicorn.rb"
set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid"

set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log pids system tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}

namespace :deploy do
   task :restart do
   on roles :all do
   execute "echo $PATH; if [ -f '/home/deploy/app/shared/pids/unicorn.pid' ] && [ -e /proc/$(cat '/home/deploy/app/shared/pids/unicorn.pid') ]; then kill -9 `cat /home/deploy/app/shared/pids/unicorn.pid`; cd /home/deploy/app/current &&  bundle exec unicorn_rails -E production -c config/unicorn.rb -D; else cd /home/deploy/app/current && bundle exec unicorn_rails -E production -c config/unicorn.rb -D; fi"
end
end
    after :publishing, :restart
end

And as i have default PATH variable during deploy bundle cant find unicorn_rails, althouth it is installed.

Aucun commentaire:

Enregistrer un commentaire