Switch back to the upstream nginx cookbook
chef_nginx is deprecated
This commit is contained in:
39
cookbooks/nginx/templates/default/nginx-upstart.conf.erb
Normal file
39
cookbooks/nginx/templates/default/nginx-upstart.conf.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
# nginx
|
||||
|
||||
description "nginx http daemon"
|
||||
|
||||
start on (local-filesystems and net-device-up IFACE=lo and runlevel [<%= node['nginx']['upstart']['runlevels'] %>])
|
||||
stop on runlevel [!<%= node['nginx']['upstart']['runlevels'] %>]
|
||||
|
||||
env DAEMON=<%= node['nginx']['binary'] %>
|
||||
env PID=<%= @pid_file %>
|
||||
env CONFIG=<%= node['nginx']['source']['conf_path'] %>
|
||||
|
||||
respawn
|
||||
<% if node['nginx']['upstart']['respawn_limit'] -%>
|
||||
respawn limit <%= node['nginx']['upstart']['respawn_limit'] %>
|
||||
<% end -%>
|
||||
|
||||
pre-start script
|
||||
${DAEMON} -t
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
end script
|
||||
|
||||
<% unless node['nginx']['upstart']['foreground'] -%>
|
||||
expect fork
|
||||
<% else -%>
|
||||
console output
|
||||
<% end -%>
|
||||
|
||||
exec ${DAEMON} -c "${CONFIG}"
|
||||
|
||||
<% if node.recipe?('nginx::passenger') && !node['nginx']['upstart']['foreground'] -%>
|
||||
# classic example of why pidfiles should have gone away
|
||||
# with the advent of fork(). we missed that bus a long
|
||||
# time ago so hack around it.
|
||||
post-stop script
|
||||
start-stop-daemon --stop --pidfile ${PID} --name nginx --exec ${DAEMON} --signal QUIT
|
||||
end script
|
||||
<% end -%>
|
||||
Reference in New Issue
Block a user