【问题标题】:capistrano always deploying old revision?capistrano 总是部署旧版本?
【发布时间】:2012-06-21 17:37:56
【问题描述】:

我遇到了一个问题,capistrano 会从我们的 git 存储库部署旧版本,除非我们指定要部署到的确切版本。

#this will deploy a revision from a couple weeks ago
cap staging deploy:migrations

#this will deploy correctly a new revision
cap staging deploy:migrations -S revision=74d27c00363cdcd456942d6951230564893ccb28

有人知道为什么会发生这种情况吗?

这里是 cap 部署文件:

set :rvm_ruby_string, 'ruby-1.9.3-p194@ac_helenefrance_01' # Or:
#set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

require "rvm/capistrano" # Load RVM's capistrano plugin.
require "bundler/capistrano"

# set :verbose ,1

require 'capistrano/ext/multistage'
set :stages, %w(staging production)
set :default_stage, "staging"

set :user, "webm"
# set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@aliencom.beanstalkapp.com:/ac_helenefrance_01.git"

# :branch is being set in stage files

default_run_options[:pty] = true
# ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

namespace :deploy do
   %w[start stop restart].each do |command|
   desc "#{command} unicorn server"
   task command, roles: :app, except: {no_release: true} do
     run "#{sudo} service unicorn_#{server_configuration} #{command}"
   end
 end

 desc "build missing paperclip styles"
 task :build_missing_paperclip_styles, :roles=> :app do
   run "cd #{release_path}; RAILS_ENV=production bundle exec rake paperclip:refresh:missing_styles"
 end
 after "deploy:update", "deploy:build_missing_paperclip_styles"

 task :setup_config, roles: :app do
   puts "#making symlink to nginx sites-enabled"
   run "#{sudo} ln -fs #{current_path}/config/server/#{server_configuration}/nginx.conf /etc/nginx/sites-enabled/#{server_configuration}"
   puts "#making symlink to unicorn service script"
   run "#{sudo} ln -fs #{current_path}/config/server/#{server_configuration}/unicorn_init.sh /etc/init.d/unicorn_#{server_configuration}"
   puts "#making a the new config directory"
   run "mkdir -p #{shared_path}/config"
   run "sunique 1"
   put File.read("config/database.yml"), "#{shared_path}/config/database.yml"
   run "sunique 0"
   puts "Now edit the config files in #{shared_path}."
 end
 after "deploy:setup", "deploy:setup_config"

 task :symlink_config, roles: :app do
   run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"

   puts "#for reference:"
   puts "#rvm wrapper 1.9.3@ac_helenefrance_01 ruby-1.9.3-p194@#{server_configuration} unicorn cap"
   puts "#now be sure to run: sudo update-rc.d unicorn_#{server_configuration} defaults"
 end
 after "deploy:finalize_update", "deploy:symlink_config"

end

以及默认多级环境的 environment/stage.rb。

server "xxx.xxx.xxx.xxx", :web, :app, :db, primary: true

set :branch, "sitemap"
set :isRemote, true
set :server_configuration, "st_ac_helenefrance_01"

set :application, "#{server_configuration}"
set :deploy_to, "/home/#{user}/#{server_configuration}"

【问题讨论】:

    标签: ruby-on-rails-3 capistrano rvm-capistrano


    【解决方案1】:

    它被设置到一个旧分支 >:(

    我的同事不小心做了他正在做的测试。

    【讨论】:

      猜你喜欢
      • 2015-12-01
      • 1970-01-01
      • 2017-02-08
      • 2011-01-08
      • 1970-01-01
      • 1970-01-01
      • 2016-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多