2012-06-21 129 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文件中,幫助我。