【问题标题】:Capistrano deploying wrong version of my appCapistrano 部署了我的应用程序的错误版本
【发布时间】:2012-02-29 19:59:18
【问题描述】:

我正在将带有 Capistrano 的 Rails 3.2.1 应用程序部署到 Ubuntu/Passenger/Apache 服务器。当我运行 cap deploy 时,它运行良好,但是当我在浏览器中访问我的应用程序时,我可以看到这是我几个月前使用的版本,而不是我的应用程序的当前版本。

这是我的config/deploy.rb

require "bundler/capistrano"

set :user, "jason"
set :domain, "sniphq.com"
set :application, "Snip"
set :repository,  "/var/git/snip.git"

set :scm, "git"
set :branch, "master"
set :git_shallow_clone, true
set :scm_verbose, true

role :web, domain                          # Your HTTP server, Apache/etc
role :app, domain                          # This may be the same as your `Web` server
role :db,  domain, :primary => true # This is where Rails migrations will run

set :deploy_to, "/home/jason/snip-cap"
set :deploy_via, :export

default_run_options[:pty] = true

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
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

为什么会发生这种情况?

编辑:有趣且可能有帮助的是,我可以按照说明here 并从某个 Git 标记部署我的应用程序。但显然我不想每次部署时都创建一个新标签。

【问题讨论】:

  • 确保您的更改位于 master 分支上。我遇到了您的确切问题,因为我忘记将功能分支合并回 master。
  • 谢谢。我在master,所以我真的很困惑为什么它会抓住一个旧的提交。我什至通过从/var/git/snip.git 创建一个新克隆来仔细检查所有内容是否已推送。果然,snip.git 是最新的。
  • 另一种说法:为什么您对部署标签不感兴趣?这似乎更谨慎,并且有助于更轻松地回滚代码。
  • 理论上我同意从标签中释放似乎是个好主意。但在实践中,我发现它并不总是有意义的。有时我忘记在发布中包含一些小项目,然后我不得不添加一个全新的标签,只是为了做一点小小的改动。

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


【解决方案1】:

原来我把它指向了错误的仓库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-02
    • 1970-01-01
    • 1970-01-01
    • 2015-07-03
    • 1970-01-01
    • 2018-03-30
    相关资源
    最近更新 更多