Test new interface
This commit is contained in:
parent
63ef82c621
commit
bdf4c92b72
@ -39,8 +39,8 @@ USERNAME=<%= user %>
|
||||
do_start()
|
||||
{
|
||||
mkdir -p $PIDDIR
|
||||
mkdir -p <%= log_root %>
|
||||
chown $USERNAME: <%= log_root %>
|
||||
mkdir -p <%= log %>
|
||||
chown $USERNAME: <%= log %>
|
||||
# START APPLICATION: <%= app %>
|
||||
<% engine.procfile.entries.each do |process| %>
|
||||
# START PROCESS: <%= process.name %>
|
||||
@ -48,7 +48,7 @@ do_start()
|
||||
# START CONCURRENT: <%= num %>
|
||||
# Start: <%= app %>.<%= process.name %>.<%= num %>
|
||||
# Create $PIDDIR/<%= process.name %>.<%= num %>.pid
|
||||
su - $USERNAME -c 'cd <%= engine.directory %>; export PORT=<%= engine.port_for(process, num, self.port) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= process.name %>.<%= num %>.pid
|
||||
su - $USERNAME -c 'cd <%= engine.directory %>; export PORT=<%= engine.port_for(process, num, self.port) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log %>/<%=process.name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= process.name %>.<%= num %>.pid
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
@ -4,24 +4,15 @@ require "foreman/export"
|
||||
class Foreman::Export::Initscript < Foreman::Export::Base
|
||||
|
||||
def export
|
||||
error("Must specify a location") unless location
|
||||
|
||||
FileUtils.mkdir_p location
|
||||
|
||||
app = self.app || File.basename(engine.directory)
|
||||
user = self.user || app
|
||||
log_root = self.log || "/var/log/#{app}"
|
||||
template_root = Pathname.new(File.dirname(__FILE__)).join('..', '..', '..', 'data', 'export', 'initscript').expand_path
|
||||
super
|
||||
|
||||
Dir["#{location}/#{app}"].each do |file|
|
||||
say "cleaning up: #{file}"
|
||||
FileUtils.rm(file)
|
||||
clean file
|
||||
end
|
||||
|
||||
master_template = export_template("initscript", "master.erb", template_root)
|
||||
master_config = ERB.new(master_template).result(binding)
|
||||
write_file "#{location}/#{app}", master_config
|
||||
|
||||
write_template "initscript/master.erb", "#{app}", binding
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -5,7 +5,8 @@ require "tmpdir"
|
||||
|
||||
describe Foreman::Export::Initscript, :fakefs do
|
||||
let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile") }
|
||||
let(:engine) { Foreman::Engine.new(procfile) }
|
||||
let(:formation) { nil }
|
||||
let(:engine) { Foreman::Engine.new(:formation => formation).load_procfile(procfile) }
|
||||
let(:options) { Hash.new }
|
||||
let(:initscript) { Foreman::Export::Initscript.new("/tmp/init", engine, options) }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user