Amazon EC2仍然使用旧代码,而不是新部署的代码

时间:2013-10-09 21:47:12

标签: ruby-on-rails ruby deployment amazon-ec2 capistrano

我正在使用Capistrano部署代码,这是deploy.rb

的内容
require 'bundler/capistrano'
set :application, "project_name"
set :use_sudo, false

set :scm, :git
set :repository, "git@bitbucket.org:my_name/fileito.git"
set :branch, "master"
set :deploy_via, :remote_cache
#set :deploy_via, :copy

set :user, "deployer"
set :password, "password"
set :deploy_to, "/home/deployer/project_name"
#set :app_site, "ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com" 
set :app_site, "xx.xxx.xxx.xxx"

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

require 'capistrano-unicorn'
after 'deploy:restart', 'unicorn:reload' # app IS NOT preloaded
after 'deploy:restart', 'unicorn:restart'  # app preloaded

set :whenever_command, "bundle exec whenever"
require "whenever/capistrano/recipes"

# Added:
after "deploy:stop", "deploy:start"
namespace :deploy do
  task :start do
    run "/etc/init.d/apache2 start"
  end
  task :stop do
    run "/etc/init.d/apache2 stop"
  end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

但是当我部署新代码并在浏览器中检查应用程序时,我发现仍然存在旧代码。怎么了?当我查看current目录时,有新代码 - 我通过 cat 命令手动检查了文件。

如何在浏览器中仍然是旧版本 - >旧代码?

由于

1 个答案:

答案 0 :(得分:0)