【问题标题】:Trouble deploying Rails 3.2.6 app with Capistrano使用 Capistrano 部署 Rails 3.2.6 应用程序时遇到问题
【发布时间】:2012-06-21 17:10:03
【问题描述】:

我已经使用 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

【问题讨论】:

  • 这都是在一台服务器上运行的,对吧?

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


【解决方案1】:

可能与您的问题完全无关,但由于我在运行 cap deploy:migrate 时遇到了同样的错误,所以我会提到它。 您是否在 database.yml 中为您的生产数据库设置了主机:本地主机? 添加该行为我解决了问题。

【讨论】:

  • 这对我有用。我遇到了同样的问题,甚至 rake db:migrate 在服务器上工作;但上限仍会因“对等身份验证失败”而失败
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-14
    • 1970-01-01
    • 2011-11-24
    • 2016-08-27
    • 1970-01-01
    • 2016-10-02
    • 1970-01-01
    • 2013-09-29
    相关资源
    最近更新 更多