2013-06-13 55 views
1

廚師application_ruby食譜:獨角獸不會重啓我一直在使用的應用程序和application_ruby食譜中規定的下列應用

application 'railsapp' do 
    owner 'vagrant' 
    group 'vagrant' 
    path '/home/vagrant/railsapp' 
    revision 'master' 
    repository '[email protected]:rohshall/railsreadings.git' 
    migrate true 
    rails do 
    bundler true 
    database do 
     host 'localhost' 
     username mysql_connection_info[:username] 
     password mysql_connection_info[:password] 
     database 'railsreadings_production' 
     adapter 'mysql2' 
     encoding 'utf8' 
    end 
    end 
    unicorn do 
    preload_app true 
    port "9000" 
    worker_timeout 30 
    worker_processes 2 
    end 
end 

即使我有preload_app真實,麒麟不重新啓動。我可以從廚師日誌中看到獨角獸的before_compile cook和before_deploy鉤子被執行,但它不會進入before_restart。任何有關我的配置錯誤的指針?

回答

1

帶有應用程序菜譜的模型是,它將在每個註冊資源中查找「restart_command」,並在before_restart和after_restart回調之間觸發它們。在以前的application_ruby版本中,默認爲「touch tmp/restart.txt」,這是乘客的默認設置。在當前版本中沒有默認的restart_command。

我建議麒麟添加適當的命令:

application 'railsapp' do 
    ... 
    restart_command "service unicorn restart" 
    ... 
end 

根據application_ruby菜譜的版本,你可能需要把這個下的「軌道」資源。

我們在我們的rails應用程序部署服務中廣泛使用這些食譜Ninefold,通常它們工作得很好。我們發現實際的回調非常有用,可以替代內置的操作,例如遷移和資產預編譯,以提供更好的控制和報告。