2012-02-29 70 views
1

我正在部署一個帶有Capistrano的Rails 3.2.1應用程序到Ubuntu/Passenger/Apache服務器。當我運行cap deploy時,它運行正常,但是當我在瀏覽器中訪問我的應用程序時,可以看到它是幾個月前我正在使用的版本,而不是當前版本的應用程序。Capistrano部署我的應用程序的錯誤版本

這裏是我的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標籤部署我的應用程序。但顯然,我不想每次部署時創建一個新標籤。

+0

確保您的更改在'master'分支上。我遇到了確切的問題,因爲我忘了將功能分支合併回主。 – nathan 2012-02-29 20:16:36

+0

謝謝。我在'master'上,所以我對爲什麼要抓取一箇舊的提交感到困惑。我甚至仔細檢查過,通過'/ var/git/snip.git'創建一個新的克隆來推動一切。果然,'snip.git'是最新的。 – 2012-02-29 20:20:17

+0

完全不同的說明:您爲什麼不對部署標籤感興趣?這看起來更加謹慎,並且可以幫助您更輕鬆地回滾代碼。 – Ekampp 2012-02-29 21:37:19

回答

0

原來我指出了錯誤的回購。