Merge pull request #161 from leahpar/master

Supervisord Support (Update & Bugfix)
This commit is contained in:
David Dollar committed 2012-03-16 18:47:15 -07:00
commit 8fc3d1ef24
4 files changed
+17 -5

No files matched your search

+9 -3
View File
@@ -1,12 +1,15 @@
<% <%
app_names = []
engine.procfile.entries.each do |process| engine.procfile.entries.each do |process|
next if (conc = self.concurrency[process.name]) < 1 next if (conc = self.concurrency[process.name]) < 1
1.upto(self.concurrency[process.name]) do |num| 1.upto(self.concurrency[process.name]) do |num|
port = engine.port_for(process, num, self.port) port = engine.port_for(process, num, self.port)
name = if (conc > 1); "#{process.name}-#{num}" else process.name; end name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
environment = (engine.environment.each_pair { |var,env| "#{var.upcase}=#{env}" }.to_a << "PORT=#{port}") environment = (engine.environment.map{ |var,env| "#{var.upcase}=#{env}" } + ["PORT=#{port}"])
app_name = "#{app}-#{name}"
app_names << app_name
%> %>
[program:<%= app %>-<%= name %>] [program:<%= app_name %>]
command=<%= process.command %> command=<%= process.command %>
autostart=true autostart=true
autorestart=true autorestart=true
@@ -18,4 +21,7 @@ directory=<%= engine.directory %>
environment=<%= environment.join(',') %><% environment=<%= environment.join(',') %><%
end end
end end
%> %>
[group:<%= app %>]
programs=<%= app_names.join(',') %>
+2 -2
View File
@@ -30,7 +30,7 @@ describe Foreman::Export::Supervisord, :fakefs do
it "exports to the filesystem with concurrency" do it "exports to the filesystem with concurrency" do
supervisord.export supervisord.export
File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-alpha-2.conf") File.read("/tmp/init/app.conf").should == example_export_file("supervisord/app-alpha-2.conf")
end end
end end
@@ -46,7 +46,7 @@ describe Foreman::Export::Supervisord, :fakefs do
it "can export with alternate template files" do it "can export with alternate template files" do
supervisord.export supervisord.export
File.read("/tmp/init/app.conf").should == "alternate_template\n" File.read("/tmp/init/app.conf").should == "alternate_template\n"
end end
end end
@@ -19,3 +19,6 @@ stderr_logfile=/var/log/app/alpha-2-err.log
user=app user=app
directory=/tmp/app directory=/tmp/app
environment=PORT=5001 environment=PORT=5001
[group:app]
programs=app-alpha-1,app-alpha-2
@@ -19,3 +19,6 @@ stderr_logfile=/var/log/app/bravo-1-err.log
user=app user=app
directory=/tmp/app directory=/tmp/app
environment=PORT=5100 environment=PORT=5100
[group:app]
programs=app-alpha,app-bravo