使用capistrano进行部署 - >盖:部署

时间:2012-07-13 11:13:58

标签: ruby-on-rails deployment path capistrano rvm-capistrano

我遇到了部署问题。 我有一个ubuntu 11.10服务器,我已经安装了ruby 1.9.2和rails 3.2.6与RVM。 我已经把我的git拉了,它位于/home/**/idepro.git 我跑了“capify”。命令,我修改deploy.rb文件。 当我运行命令“cap deploy:setup”和“cap deploy:check”时,我没有任何问题,但是当我运行“cap deploy”时,我对环境路径有问题。错误是:

** [out :: 176.58.****] /usr/bin/env: ruby
** [out :: 176.58.****] : No such file or directory

这些是ror的道路:

******@******:~$ which ruby
/home/******/.rvm/rubies/ruby-1.9.2-p320/bin/ruby

这是$ PATH的值:

******@******:~$ echo $PATH
/home/******/.rvm/gems/ruby-1.9.2-p320/bin:/home/******/.rvm/gems/ruby-1.9.2-p320@global/bin:/home/******/.rvm/rubies/ruby-1.9.2-p320/bin:/home/******/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/******/.rvm/gems/ruby-1.9.2-p320/bin

这是我的deploy.rb文件:

# RVM bootstrap
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
#require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby1.9.2-p290'

# bundler bootstrap
require 'bundler/capistrano'

# main details
set :application, "176.58.******"
role :web, "176.58.******"
role :app, "176.58.******"
role :db,  "176.58.******", :primary => true

ssh_options[:port] = ******
set :user, "******"
set :password, "******"

# server details
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/idealarm2"
set :deploy_via, :remote_cache
set :user, "passenger"
set :use_sudo, false

# repo details
set :scm, :git
set :scm_username, "passenger"
set :repository, "/home/******/idepro.git"
set :branch, "master"
set :git_enable_submodules, 1

# tasks
namespace :deploy do
    task :start, :roles => :app do
         run "touch #{current_path}/tmp/restart.txt"
    end

    task :stop, :roles => :app do
         # Do nothing.
    end

    desc "Restart Application"
    task :restart, :roles => :app do
         run "touch #{current_path}/tmp/restart.txt"
    end
end

#default_environment['PATH']='/home/******/.rvm/gems/ruby-1.9.2-p320/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin/:/usr/bin:/bin'
#default_environment['GEM_PATH']='/home/******/.rvm/gems/ruby-1.9.2-p320:/home/******/.rvm/gems/ruby-1.9.2-p320@global:/usr/lib/ruby/gems/1.$

有人可以帮我解决PATH配置吗?

1 个答案:

答案 0 :(得分:2)

我正在使用带有RVM的capistrano而没有任何问题,在https://rvm.io//integration/capistrano/遵循了“通过rvm-capistrano gem整合”部分说明。