无法使用Capistrano部署Rails 3.2.6应用程序

时间:2012-06-21 17:10:03

标签: ruby-on-rails-3 postgresql deployment capistrano

我已经使用nginx,passenger,ruby 1.9.3-p194和rails 3.2.6正确设置了我的Linode VPS。我已经构建了一个简单的Cap配方(见下文),它通过部署:设置和部署:检查但在资产预编译阶段失败。我会尝试在远程服务器上手动运行预编译但是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

2 个答案:

答案 0 :(得分:2)

可能与您的问题完全无关,但由于我在运行上限部署时遇到了同样的错误:迁移我会提到它。 你在database.yml中为你的生产数据库设置了host:localhost吗? 添加该行为我解决了问题。

答案 1 :(得分:0)

尝试将config.assets.initialize_on_precompile = false添加到 application.rb 文件中,这对我有用。