【问题标题】:Amazon EC2 still uses the old code, not the newly deployed oneAmazon EC2 仍然使用旧代码,而不是新部署的代码
【发布时间】:2013-10-09 21:47:11
【问题描述】:

我正在用 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 命令手动检查了文件。

浏览器中怎么可能还是旧版本->旧代码?

谢谢

【问题讨论】:

  • 您是否尝试重新启动您的应用服务器?

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


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2015-06-09
  • 2013-03-06
  • 2016-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-07
  • 1970-01-01
相关资源
最近更新 更多