簡體   English   中英

廚師application_ruby食譜:獨角獸未重啟

[英]chef application_ruby cookbook: unicorn is not restarted

我使用application和application_ruby食譜定義了以下應用程序:

application 'railsapp' do
  owner 'vagrant'
  group 'vagrant'
  path '/home/vagrant/railsapp'
  revision 'master'
  repository 'git@github.com: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為true,麒麟也不會重新啟動。 我從廚師日志中可以看到,執行了獨角獸的before_compile cook和before_deploy掛鈎,但是它沒有加入before_restart中。 關於我的配置錯誤的任何指示?

應用程序食譜的模型是,它將在每個已注冊資源中尋找“​​ 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 cookbook的版本,您可能需要將其放在“ rails”資源下。

我們在Rails應用程序部署服務中的Ninefold上廣泛使用了這些食譜,並且它們通常都工作得很好。 我們發現實際的回調對於覆蓋諸如遷移和資產預編譯之類的內置操作非常有用,以提供更好的控制和報告。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM