我有一个在EC2实例上运行的Rails应用程序。作为部署工具,我正在使用Capistrano。
当我提交新代码(成功 - 我在桶中看到它)时,运行cap deploy
(再次,代码成功部署,没有错误)并检查我的网站的URL,我看不到新代码,但旧代码。
怎么可能?可能是什么问题?
编辑:Capistrano输出:
/Users/adam/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
* 2013-09-28 12:41:43 executing `deploy'
* 2013-09-28 12:41:43 executing `deploy:update'
** transaction: start
* 2013-09-28 12:41:43 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@bitbucket.org:my_bb_name/my_app_name.git master"
command finished in 6564ms
* executing "if [ -d /home/my_user_name/my_app_name/shared/cached-copy ]; then cd /home/my_user_name/my_app_name/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard fa26f147bfbc8147134177294a248f6a002e6e48 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:my_bb_name/my_app_name.git /home/my_user_name/my_app_name/shared/cached-copy && cd /home/my_user_name/my_app_name/shared/cached-copy && git checkout -q -b deploy fa26f147bfbc8147134177294a248f6a002e6e48; fi"
servers: ["IP"]
[IP] executing command
command finished in 3272ms
copying the cached version to /home/my_user_name/my_app_name/releases/20130928104159
* executing "cp -RPp /home/my_user_name/my_app_name/shared/cached-copy /home/my_user_name/my_app_name/releases/20130928104159 && (echo fa26f147bfbc8147134177294a248f6a002e6e48 > /home/my_user_name/my_app_name/releases/20130928104159/REVISION)"
servers: ["IP"]
[IP] executing command
command finished in 2246ms
* 2013-09-28 12:42:01 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2013-09-28 12:42:01 executing `bundle:install'
* executing "cd /home/my_user_name/my_app_name/releases/20130928104159 && bundle install --gemfile /home/my_user_name/my_app_name/releases/20130928104159/Gemfile --path /home/my_user_name/my_app_name/shared/bundle --deployment --quiet --without development test"
servers: ["IP"]
[IP] executing command
command finished in 1234ms
* executing "chmod -R -- g+w /home/my_user_name/my_app_name/releases/20130928104159 && rm -rf -- /home/my_user_name/my_app_name/releases/20130928104159/public/system && mkdir -p -- /home/my_user_name/my_app_name/releases/20130928104159/public/ && ln -s -- /home/my_user_name/my_app_name/shared/system /home/my_user_name/my_app_name/releases/20130928104159/public/system && rm -rf -- /home/my_user_name/my_app_name/releases/20130928104159/log && ln -s -- /home/my_user_name/my_app_name/shared/log /home/my_user_name/my_app_name/releases/20130928104159/log && rm -rf -- /home/my_user_name/my_app_name/releases/20130928104159/tmp/pids && mkdir -p -- /home/my_user_name/my_app_name/releases/20130928104159/tmp/ && ln -s -- /home/my_user_name/my_app_name/shared/pids /home/my_user_name/my_app_name/releases/20130928104159/tmp/pids"
servers: ["IP"]
[IP] executing command
command finished in 523ms
* executing "find /home/my_user_name/my_app_name/releases/20130928104159/public/images /home/my_user_name/my_app_name/releases/20130928104159/public/stylesheets /home/my_user_name/my_app_name/releases/20130928104159/public/javascripts -exec touch -t 201309281042.03 -- {} ';'; true"
servers: ["IP"]
[IP] executing command
command finished in 473ms
* 2013-09-28 12:42:03 executing `deploy:create_symlink'
* executing "rm -f /home/my_user_name/my_app_name/current && ln -s /home/my_user_name/my_app_name/releases/20130928104159 /home/my_user_name/my_app_name/current"
servers: ["IP"]
[IP] executing command
command finished in 291ms
** transaction: commit
* 2013-09-28 12:42:04 executing `deploy:restart'
* executing "kill -s USR2 `cat /home/my_user_name/my_app_name/current/tmp/pids/unicorn.pid.oldbin`"
servers: ["IP"]
[IP] executing command
command finished in 277ms
EDIT2:我在想deploy.rb
中的独角兽任务是否有问题:
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{unicorn_cmd} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "kill -QUIT `cat #{unicorn_pid}`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "kill -s USR2 `cat #{unicorn_pid}`"
end
end