1

我已经使用 nginx、passenger、ruby 1.9.3-p194 和 rails 3.2.6 正确设置了我的 Linode VPS。我构建了一个简单的 Cap 配方(见下文),它通过了 deploy:setup 和 deploy:check 但在资产预编译阶段失败。我会尝试在远程服务器上手动运行预编译,但 Cap 回滚,所以我不能这样做。

该错误看起来像一个 PG 错误,但是我已经根据我的 database.yml 设置手动测试了与服务器的连接,它运行良好。知道这可能是什么吗?

deploy.rb
require "bundler/capistrano"

server "50.116.25.145", :web, :app, :db, primary: true

set :application, "exigencad"
set :user, "deploy"
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@github.com:teknull/#{application}.git"
set :branch, "master"


default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

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


task :after_update_code do  
run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
end

after :deploy, "assets:precompile"

Error from Capistrano:
executing `deploy:assets:precompile'
  * executing "cd /home/deploy/exigencad/releases/20120621170601 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["50.116.25.145"]
    [50.116.25.145] executing command
 ** [out :: 50.116.25.145] rake aborted!
 ** [out :: 50.116.25.145] FATAL:  Peer authentication failed for user "exigen"
 ** [out :: 50.116.25.145] 
 ** [out :: 50.116.25.145] Tasks: TOP => environment
 ** [out :: 50.116.25.145] 
 ** [out :: 50.116.25.145] (See full trace by running task with --trace)
    command finished in 6433ms
*** [deploy:update_code] rolling back
4

2 回答 2

2

might be totally unrelated to your problem, but since i just hit the same error while running cap deploy:migrate i'll mention it. did you set host: localhost for your production db in database.yml? adding that line fixed the problem for me.

于 2012-07-25T16:06:33.883 回答
0

尝试添加config.assets.initialize_on_precompile = false到您的application.rb文件中,这对我有帮助。

于 2013-10-24T14:54:31.640 回答