Compare commits

...
7 Commits
Author SHA1 Message Date
David Dollar be593846e2 Regenerated gemspec for version 0.4.7 2010-06-29 17:08:49 -04:00
David Dollar 2458c4e75f 0.4.7 2010-06-29 17:08:46 -04:00
David Dollar 314e2f5530 fix -l, dont append app name 2010-06-29 17:08:30 -04:00
David Dollar d6c5e6ddea Regenerated gemspec for version 0.4.6 2010-06-29 16:49:17 -04:00
David Dollar 261164e694 update readme 2010-06-29 16:49:17 -04:00
David Dollar 92e637a231 0.4.6 2010-06-29 16:49:14 -04:00
David Dollar 08b94716f2 support -l to export for specifying log root 2010-06-29 16:49:02 -04:00
9 changed files with 18 additions and 9 deletions
+3
View File
@@ -43,6 +43,9 @@ The following options control how the application is run:
Use this name rather than the application's root directory name as the Use this name rather than the application's root directory name as the
name of the application when exporting. name of the application when exporting.
* `-l`, `--log`:
Specify the directory to place process logs in.
* `-c`, `--concurrency`: * `-c`, `--concurrency`:
Specify the number of each process type to run. The value passed in Specify the number of each process type to run. The value passed in
should be in the format `process=num,process=num` should be in the format `process=num,process=num`
+2 -2
View File
@@ -1,8 +1,8 @@
pre-start script pre-start script
bash << "EOF" bash << "EOF"
mkdir -p /var/log/<%= app %> mkdir -p <%= log_root %>
chown -R <%= user %> /var/log/<%= app %> chown -R <%= user %> <%= log_root %>
EOF EOF
end script end script
+1 -1
View File
@@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= process.name %>
respawn respawn
chdir <%= engine.directory %> chdir <%= engine.directory %>
exec su <%= user %> -c "<%= process.command %> >> /var/log/<%=app%>/<%=process.name%>-<%=num%>.log 2>&1" exec su <%= user %> -c "<%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1"
+1 -1
View File
@@ -5,7 +5,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{foreman} s.name = %q{foreman}
s.version = "0.4.5" s.version = "0.4.7"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["David Dollar"] s.authors = ["David Dollar"]
+1 -1
View File
@@ -1,6 +1,6 @@
module Foreman module Foreman
VERSION = "0.4.5" VERSION = "0.4.7"
class AppDoesNotExist < Exception; end class AppDoesNotExist < Exception; end
+2
View File
@@ -26,6 +26,7 @@ class Foreman::CLI < Thor
desc "export FORMAT LOCATION", "Export the application to another process management format" desc "export FORMAT LOCATION", "Export the application to another process management format"
method_option :app, :type => :string, :aliases => "-a" method_option :app, :type => :string, :aliases => "-a"
method_option :log, :type => :string, :aliases => "-l"
method_option :user, :type => :string, :aliases => "-u" method_option :user, :type => :string, :aliases => "-u"
method_option :concurrency, :type => :string, :aliases => "-c", method_option :concurrency, :type => :string, :aliases => "-c",
:banner => '"alpha=5,bar=3"' :banner => '"alpha=5,bar=3"'
@@ -41,6 +42,7 @@ class Foreman::CLI < Thor
formatter.new(engine).export(location, formatter.new(engine).export(location,
:name => options[:app], :name => options[:app],
:user => options[:user], :user => options[:user],
:log => options[:log],
:concurrency => options[:concurrency] :concurrency => options[:concurrency]
) )
rescue Foreman::Export::Exception => ex rescue Foreman::Export::Exception => ex
+4 -4
View File
@@ -5,7 +5,7 @@ class Foreman::Export::Inittab < Foreman::Export::Base
def export(fname=nil, options={}) def export(fname=nil, options={})
app = options[:app] || File.basename(engine.directory) app = options[:app] || File.basename(engine.directory)
user = options[:user] || app user = options[:user] || app
log_dir = "/var/log/#{app}" log_root = options[:log] || "/var/log"
concurrency = parse_concurrency(options[:concurrency]) concurrency = parse_concurrency(options[:concurrency])
@@ -13,15 +13,15 @@ class Foreman::Export::Inittab < Foreman::Export::Base
inittab << "# ----- foreman #{app} processes -----" inittab << "# ----- foreman #{app} processes -----"
engine.processes.values.each_with_index do |process, num| engine.processes.values.each_with_index do |process, num|
id = app.slice(0, 2).upcase + sprintf("%02d", num+1) id = app.slice(0, 2).upcase + sprintf("%02d", num+1)
inittab << "#{id}:4:respawn:/bin/su - #{user} -c '#{process.command} >> #{log_dir}/#{process.name}-#{num+1}.log 2>&1'" inittab << "#{id}:4:respawn:/bin/su - #{user} -c '#{process.command} >> #{log_root}/#{process.name}-#{num+1}.log 2>&1'"
end end
inittab << "# ----- end foreman #{app} processes -----" inittab << "# ----- end foreman #{app} processes -----"
inittab = inittab.join("\n") + "\n" inittab = inittab.join("\n") + "\n"
if fname if fname
FileUtils.mkdir_p(log_dir) FileUtils.mkdir_p(log_root)
FileUtils.chown(user, nil, log_dir) FileUtils.chown(user, nil, log_root)
write_file(fname, inittab) write_file(fname, inittab)
else else
puts inittab puts inittab
+1
View File
@@ -10,6 +10,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base
app = options[:app] || File.basename(engine.directory) app = options[:app] || File.basename(engine.directory)
user = options[:user] || app user = options[:user] || app
log_root = options[:log] || "/var/log/#{app}"
Dir["#{location}/#{app}*.conf"].each do |file| Dir["#{location}/#{app}*.conf"].each do |file|
say "cleaning up: #{file}" say "cleaning up: #{file}"
+3
View File
@@ -43,6 +43,9 @@ The following options control how the application is run:
Use this name rather than the application's root directory name as the Use this name rather than the application's root directory name as the
name of the application when exporting. name of the application when exporting.
* `-l`, `--log`:
Specify the directory to place process logs in.
* `-c`, `--concurrency`: * `-c`, `--concurrency`:
Specify the number of each process type to run. The value passed in Specify the number of each process type to run. The value passed in
should be in the format `process=num,process=num` should be in the format `process=num,process=num`