ruby-on-rails – Rails – 在使用Capistrano部署后需要重新启动
发布时间:2020-12-16 21:58:08 所属栏目:百科 来源:网络整理
导读:我正在使用Capistrano部署我的Rails应用程序.每当我部署,更改不会反映在浏览器,我仍然需要重新启动nginx来更新网站(运行sudo /etc/init.d/nginx重新启动).我不太确定为什么重新启动应用程序后不应该更新? (使用touch /app/tmp/restart.txt) 这是我的deploy.
我正在使用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/ 当我遵循本教程(大约一年前),我安装了较新版本的nginx和乘客.从我记得,我认为这些较新的版本促使我在运行任何类型的init.d命令时使用nginx作为服务. (Ubuntu 10.04) 无论如何,我会切换代码 run "#{try_sudo} touch #{File.join(current_path,'restart.txt')}" 至 run "#{sudo} service nginx #{command}" 看看是否有效. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |