Capistrano Error: '/usr/bin/env ruby : No such file or directory' -


when try restart unicorn using capistrano:

$ cap production deploy:restart_unicorn 

i got error:

debug [c65b4a92]  /usr/bin/env: debug [c65b4a92]  ruby debug [c65b4a92]  : no such file or directory 

my environment:

  • mac osx 10.9.2
  • capistrano version: 3.2.1 (rake version: 10.3.1)
  • rvm 1.25.25 (stable)
  • ruby 2.1.2p95
  • rails 4.1.1
  • bundler 1.6.2

my server environment:

  • ubuntu 14.04 lts (gnu/linux 3.13.0-24-generic x86_64)

my config/deploy.rb:

lock '3.2.1'  set :application, 'my_app' set :repo_url,    'git@gitrepo.com:my_app.git' set :deploy_to,   '/var/www/my_app'  set :linked_files, %w{.env} set :linked_dirs, %w{bin log tmp/pids tmp/cache public/system} set :rvm_ruby_version, '2.1.2'  namespace :deploy   desc 'restart application'   task :restart_unicorn     on roles :app, in: :sequence, wait: 5       execute 'service unicorn upgrade'     end   end    after :publishing, :restart_unicorn end 

my unicorn init script:

#!/bin/sh set -e . /etc/environment  timeout=${timeout-60} app_root=/var/www/my_app/current pid=$app_root/tmp/pids/unicorn.pid cmd="$app_root/bin/unicorn -d -c $app_root/config/unicorn.rb -e $rails_env" action="$1" set -u  cd $app_root || exit 1  sig () {   test -s "$pid" && kill -$1 `cat $pid` }  case $action in restart)   sig hup && echo reloaded ok && exit 0   echo >&2 "couldn't reload, starting '$cmd' instead"   $cmd   ;; esac 

my gemfile:

# ... gem 'capistrano', '~> 3.2.0' gem 'capistrano-bundler', '~> 1.1.2' gem 'capistrano-rails', '~> 1.1' gem 'capistrano-rvm' # ... 

my capfile:

require 'capistrano/setup' require 'capistrano/deploy'  require 'capistrano/bundler' require 'capistrano/rvm' require 'capistrano/rails/assets' require 'capistrano/rails/migrations'  # loads custom tasks `lib/capistrano/tasks' if have defined. dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 

i've fixed problem adding path variable unicorn init script:

#!/bin/sh set -e . /etc/environment  path=/usr/local/rvm/rubies/ruby-2.1.2/bin:$path timeout=${timeout-60} # ... 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -