繁体   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