Hi,
I'm using the application_ruby cookbook to deploy a rails app. I'm
trying to get zero-downtime restarts working Unicorn and I found a
guide at https://gist.github.com/czarneckid/4639793 which seems to
work, but I need to use a custom runit template.
When I call the application provider in my wrapper cookbook, this
creates a runit service:
My wrapper:
name = 'myapp'
application name do
(snip)
unicorn do
restart_command do
execute "/etc/init.d/#{name} restart" do
user "root"
end
end
worker_processes 2
listen ({ "#{app_path}/shared/.unicorn.sock" => { :tcp_nodelay =>
true, :backlog => 100 }})
pid "#{app_path}/shared/pids/unicorn.pid"
stderr_path "#{app_path}/shared/log/unicorn.stderr.log"
stdout_path "#{app_path}/shared/log/unicorn.stdout.log"
before_exec "ENV['BUNDLE_GEMFILE'] = \"#{app_path}/current/Gemfile\""
before_fork before_fork
after_fork after_fork
end
end
https://github.com/opscode-cookbooks/application_ruby/blob/master/providers/unicorn.rb:
runit_service new_resource.name do
run_template_name 'unicorn'
log_template_name 'unicorn'
owner new_resource.owner if new_resource.owner
group new_resource.group if new_resource.group
cookbook 'application_ruby'
options(
:app => new_resource,
:bundler => new_resource.bundler,
:bundle_command => new_resource.bundle_command,
:rails_env => new_resource.environment_name,
:smells_like_rack =>
::File.exists?(::File.join(new_resource.path, "current", "config.ru"))
)
end
I'd like to change the 'cookbook' line there to use my own cookbook,
so I can write a custom template. I tried changing the template
resource for the runit file:
srv = resources("template[/etc/sv/myapp/run]")
srv.cookbook = 'my_cookbook'
but I get "Cannot find a resource matching template[/etc/sv/myapp/run]
(did you define it first?)"
Is it possible to do this or do I need to fork the application_ruby cookbook?
Thanks
James
Archive powered by MHonArc 2.6.16.