Skip to content

Commit

Permalink
Add bluepill init_type support to nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
reset authored and jtimberman committed Jan 5, 2012
1 parent aa5b755 commit 0d010bb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nginx/recipes/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@
service "nginx" do
subscribes :restart, resources(:bash => "compile_nginx_source")
end
when "bluepill"
include_recipe "bluepill"

template "#{node['bluepill']['conf_dir']}/nginx.pill" do
source "nginx.pill.erb"
mode 0644
variables(
:working_dir => node[:nginx][:install_path],
:src_binary => node[:nginx][:src_binary],
:nginx_dir => node[:nginx][:dir],
:log_dir => node[:nginx][:log_dir]
)
end

bluepill_service "nginx" do
action [ :enable, :load, :start ]
subscribes :restart, resources(:bash => "compile_nginx_source")
end

service "nginx" do
action :nothing
end
else
#install init db script
template "/etc/init.d/nginx" do
Expand Down
15 changes: 15 additions & 0 deletions nginx/templates/default/nginx.pill.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Bluepill.application("nginx") do |app|
app.process("nginx") do |process|
process.pid_file = "/var/run/nginx.pid"
process.working_dir = "<%= @working_dir %>"
process.start_command = "<%= @src_binary %> -c <%= @nginx_dir %>/nginx.conf"
process.stop_command = "<%= @src_binary %> -s stop"
process.restart_command = "<%= @src_binary %> -s reload"
process.daemonize = true
process.stdout = process.stderr = "<%= @log_dir %>/nginx.log"

process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}"
end
end
end

0 comments on commit 0d010bb

Please sign in to comment.