我正在使用Capistrano部署我的Rails应用程序.每当我部署,更改不会反映在浏览器,我仍然需要重新启动Nginx来更新网站(运行sudo /etc/init.d/Nginx重新启动).我不太确定为什么重新启动应用程序后不应该更新? (使用touch /app/tmp/restart.txt)
这是我的deploy.rb
require "rvm/capistrano"
set :rvm_ruby_string,'ruby-1.9.3-p194@app_name'
set :rvm_type,:user
require "bundler/capistrano"
set :application,"app_name"
set :user,"me"
set :deploy_to,"/home/#{user}/#{application}"
set :deploy_via,:copy
set :use_sudo,false
set :scm,:git
set :repository,"~/Sites/#{application}/.git"
set :branch,"master"
role :web,'1.2.3.4'
role :app,'1.2.3.4'
role :db,'1.2.3.4',:primary => true
role :db,'1.2.3.4'
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
最佳答案
我意识到部署设置匹配
http://coding.smashingmagazine.com/2011/06/28/setup-a-ubuntu-vps-for-hosting-ruby-on-rails-applications-2/
http://coding.smashingmagazine.com/2011/06/28/setup-a-ubuntu-vps-for-hosting-ruby-on-rails-applications-2/
当我遵循本教程(大约一年前),我安装了较新版本的Nginx和乘客.从我记得,我认为这些较新的版本促使我在运行任何类型的init.d命令时使用Nginx作为服务. (Ubuntu 10.04)
无论如何,我会切换代码
run "#{try_sudo} touch #{File.join(current_path,'restart.txt')}"
至
run "#{sudo} service Nginx #{command}"
看看是否有效.