Vlad the Deployer:麻烦迁移

时间:2013-04-26 16:49:32

标签: ruby-on-rails-3 capistrano vlad-deployer

我正在配置Vlad The Deployer部署我的应用程序,我得到一个奇怪的错误,我无法找到答案。

问题如下,在我迁移之后,它会获得我的应用程序的最新“发布”,它会获得一个不存在的版本,即使之前的更新运行提供了最新版本。

** Invoke vlad:update (first_time)
** Execute vlad:update
ssh -p 10022 labpress.com.ar 'cd /opt/prj/agregador/scm && rm -rf/opt/prj/agregador/scm/repo && git clone git@bitbucket.org:ibmedialab/noticioso.git /opt/prj/agregador/scm/repo && cd /opt/prj/agregador/scm/repo && git submodule update --init && git checkout -f -b deployed-origin/master origin/master && cd - && mkdir -p /opt/prj/agregador/releases/20130426162742 && cd repo && git archive --format=tar deployed-origin/master | (cd /opt/prj/agregador/releases/20130426162742 && tar xf -) && git submodule foreach 'git archive --format=tar $sha1 | (cd /opt/prj/agregador/releases/20130426162742/$path && tar xf -)' && cd - && cd .. && rm -rf /opt/prj/agregador/releases/20130426162742/log /opt/prj/agregador/releases/20130426162742/public/system /opt/prj/agregador/releases/20130426162742/tmp/pids && mkdir -p /opt/prj/agregador/releases/20130426162742/tmp /opt/prj/agregador/releases/20130426162742/db'
Cloning into '/opt/prj/agregador/scm/repo'...
Branch deployed-origin/master set up to track remote branch master from origin.
Switched to a new branch 'deployed-origin/master'
/opt/prj/agregador/scm
/opt/prj/agregador/scm
** Invoke vlad:update_symlinks (first_time)
** Execute vlad:update_symlinks
ssh -p 10022 labpress.com.ar 'ln -s /opt/prj/agregador/shared/log/opt/prj/agregador/releases/20130426162742/log && ln -s /opt/prj/agregador/shared/system /opt/prj/agregador/releases/20130426162742/public/system && ln -s /opt/prj/agregador/shared/pids /opt/prj/agregador/releases/20130426162742/tmp/pids'
ssh -p 10022 labpress.com.ar 'rm -f /opt/prj/agregador/current && ln -s /opt/prj/agregador/releases/20130426162742 /opt/prj/agregador/current && echo 201304261627.50 $USER origin/master 20130426162742 >> /opt/prj/agregador/revisions.log'
norcali@TAW093:~/Desarrollo/Infobae/Ruby/Rails/agregador$ rake -t vlad:migrate
** Invoke vlad:migrate (first_time)
** Execute vlad:migrate
ssh -p 10022 labpress.com.ar 'cd /opt/prj/agregador/releases/20130426162759 && rake 'RAILS_ENV=production db:migrate '
sh: 1: cd: can't cd to /opt/prj/agregador/releases/20130426162759
rake aborted!

基本上,每次我运行“迁移”时,它都会尝试获取一个不存在的新版本,并且该过程失败。

这是我的配置代码:

deploy.rb

set :ssh_flags, "-p 10022"
set :domain, "labpress.com.ar"
set :application, "noticioso"
set :deploy_to, "/opt/prj/agregador"
set :repository, 'git@bitbucket.org:ibmedialab/noticioso.git'
set :revision, "origin/master"
set :web, "nginx"


namespace :vlad do

   desc "Full deployment cycle: Update, migrate, restart, cleanup"
   remote_task :deploy, :roles => :app do
     Rake::Task['vlad:update'].invoke
     Rake::Task['vlad:migrate'].invoke
     Rake::Task['vlad:start_app'].invoke
     Rake::Task['vlad:cleanup'].invoke
  end
end

Rake文件

require File.expand_path('../config/application', __FILE__)

Agregador::Application.load_tasks

begin
  require 'vlad'
  Vlad.load :app => :passenger, :scm => :git, :web => :nginx
rescue LoadError
  puts 'Could not load Vlad'
end

的Gemfile

gem 'vlad', :require => false
gem 'vlad-git', '2.1.0', :require => false
gem 'vlad-nginx', :require => false
gem 'vlad-extras', :require => false

所以,关于它,如果有人有任何想法来帮助我,我会非常感激。

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,经过一些游戏,我可以通过添加

解决问题
set :migrate_target, :current

到我的deploy.rb