Updates to get Bluepill export working & tweaks to output

This commit is contained in:
Hunter Nield
2011-08-25 21:17:00 +10:00
parent 21a041527c
commit 9db97abb10
4 changed files with 17 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
Bluepill.application("<%= app %>", :foreground => false) do |app|
Bluepill.application("<%= app %>", :foreground => false, :log_file => "/var/log/bluepill.log") do |app|
app.uid = "<%= user %>"
app.gid = "<%= user %>"
@@ -7,18 +7,20 @@ Bluepill.application("<%= app %>", :foreground => false) do |app|
<% 1.upto(concurrency[process.name]) do |num| %>
<% port = engine.port_for(process, num, options[:port]) %>
app.process("<%= process.name %>-<%=num%>") do |process|
process.start_command = "<%= process.command %>"
process.start_command = "<%= process.command.gsub("$PORT", port.to_s) %>"
process.working_dir = "<%= engine.directory %>"
process.pid_file = "/var/run/<%= app %>-<%= process.name %>-<%=num%>.pid"
process.daemonize = true
process.environment = {"PORT" => "<%= port %>"}
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
process.stdout = process.stderr = "<%= log_root %>/<%= app %>-<%= process.name %>-<%=num%>.log"
process.monitor_children do |children|
children.stop_command "kill -QUIT {{PID}}"
end
process.group = "<%= app %>-<%= process.name %>"
end
<% end %>
<% end %>

View File

@@ -40,6 +40,7 @@ class Foreman::CLI < Thor
formatter = case format
when "inittab" then Foreman::Export::Inittab
when "upstart" then Foreman::Export::Upstart
when "bluepill" then Foreman::Export::Bluepill
else error "Unknown export format: #{format}."
end

View File

@@ -7,3 +7,4 @@ end
require "foreman/export/base"
require "foreman/export/inittab"
require "foreman/export/upstart"
require "foreman/export/bluepill"

View File

@@ -1,4 +1,4 @@
Bluepill.application("app", :foreground => false) do |app|
Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepill.log") do |app|
app.uid = "app"
app.gid = "app"
@@ -10,15 +10,17 @@ Bluepill.application("app", :foreground => false) do |app|
process.start_command = "./alpha"
process.working_dir = "/tmp/app"
process.pid_file = "/var/run/app-alpha-1.pid"
process.daemonize = true
process.environment = {"PORT" => "5000"}
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
process.stdout = process.stderr = "/var/log/app/app-alpha-1.log"
process.monitor_children do |children|
children.stop_command "kill -QUIT {{PID}}"
end
process.group = "app-alpha"
end
@@ -26,15 +28,17 @@ Bluepill.application("app", :foreground => false) do |app|
process.start_command = "./alpha"
process.working_dir = "/tmp/app"
process.pid_file = "/var/run/app-alpha-2.pid"
process.daemonize = true
process.environment = {"PORT" => "5001"}
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
process.stdout = process.stderr = "/var/log/app/app-alpha-2.log"
process.monitor_children do |children|
children.stop_command "kill -QUIT {{PID}}"
end
process.group = "app-alpha"
end
@@ -44,15 +48,17 @@ Bluepill.application("app", :foreground => false) do |app|
process.start_command = "./bravo"
process.working_dir = "/tmp/app"
process.pid_file = "/var/run/app-bravo-1.pid"
process.daemonize = true
process.environment = {"PORT" => "5100"}
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
process.stdout = process.stderr = "/var/log/app/app-bravo-1.log"
process.monitor_children do |children|
children.stop_command "kill -QUIT {{PID}}"
end
process.group = "app-bravo"
end