2012-06-21 101 views
1

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

错误看起来像一个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, "[email protected]: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 
+0

这是全部运行在一台服务器上,对吧? –

回答

2

可能是完全无关的你的问题,但因为我正好碰到了同样的错误,同时运行帽部署:迁移我会提到它。 您是否在database.yml中为您的生产数据库设置了host:localhost? 添加该行解决了我的问题。

+0

这对我有用。我有同样的问题,甚至rake db:migrate在服务器上工作;但上限仍然会失败,并显示“对等验证失败” – chaostheory

0

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