我正在尝试将一个简单的Ruby on Rails应用程序部署到dreamhost,但是遇到与bundle命令相关的错误。这是错误:

    servers: ["bullseye.dreamhost.com"]
    [bullseye.dreamhost.com] executing command
    command finished
  * executing "find /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/images /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/stylesheets /home/USER-NAME/MY-DOMAIN/releases/20110123014150/public/javascripts -exec touch -t 201101230141.52 {} ';'; true"
    servers: ["bullseye.dreamhost.com"]
    [bullseye.dreamhost.com] executing command
    command finished
    triggering after callbacks for `deploy:update_code'
  * executing `bundle:install'
  * executing "ls -xt /home/USER-NAME/MY-DOMAIN/releases"
    servers: ["bullseye.dreamhost.com"]
    [bullseye.dreamhost.com] executing command
    command finished
  * executing "bundle install --gemfile /home/USER-NAME/MY-DOMAIN/releases/20110123014150/Gemfile --path /home/USER-NAME/MY-DOMAIN/shared/bundle --deployment --quiet --without development test"
    servers: ["bullseye.dreamhost.com"]
    [bullseye.dreamhost.com] executing command
*** [err :: bullseye.dreamhost.com] sh: bundle: command not found
    command finished
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/USER-NAME/MY-DOMAIN/releases/20110123014150; true"
    servers: ["bullseye.dreamhost.com"]
    [bullseye.dreamhost.com] executing command
    command finished
failed: "sh -c 'bundle install --gemfile /home/USER-NAME/MY-DOMAIN/releases/20110123014150/Gemfile --path /home/USER-NAME/MY-DOMAIN/shared/bundle --deployment --quiet --without development test'" on bullseye.dreamhost.com

这是我的deploy.rb文件。
require 'bundler/capistrano'

set :user, "MY-USERNAME"
set :password, "MY-PASSWORD"
set :domain, 'bullseye.dreamhost.com'  # Dreamhost servername where your account is located
set :project, 'blog'  # Your application as its called in the repository
set :application, 'MY-DOMAIN'  # Your app's location (domain or sub-domain name as setup in panel)
set :applicationdir, "/home/#{user}/#{application}"  # The standard Dreamhost setup

# version control config
set :scm_username, 'MY-SVN-USERNAME'
set :scm_password, 'MY-SVN-PWD'
set :repository, "http://MY-SVN-URL/01/blog/"

# roles (servers)
role :web, domain
role :app, domain
role :db,  domain, :primary => true

# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export

# additional settings
default_run_options[:pty] = false  # Forgo errors when deploying from windows

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

我在Bundle install failing when deploying a Rails 3 app to Dreamhost with Capistrano上发现了类似的问题,但解决方案无效。有人对我的情况有什么想法吗?

最佳答案

我终于弄明白了。我所做的是

  • ssh进入Dreamhost服务器并执行which bundle命令
  • ssh session 中的
  • 执行echo $ PATH命令
  • 编辑config/deploy.rb并将两个字符串与:之间的位置和内部default_environment PATH值组合在一起,请参见下文

    设置:default_environment,{
    'PATH'=>“'/usr/lib/ruby/gems/1.8/bin//bundle:/home/sayed3/.gems/bin:/usr/lib/ruby/gems/1.8/bin/://usr/本地/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'“

  • 一旦完成此操作,便能够成功执行bundle命令,但是随后我又遇到了其他一些问题。我最终决定使用我在其他地方托管的VPS,但是我敢肯定,如果我花了更多的时间,我本可以弄清楚这一点。

    关于ruby-on-rails-3 - 在Deamhost的Rails上部署Ruby失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4771804/

    10-16 15:39