rough draft for systemd export support
http://0pointer.de/blog/projects/systemd.html This adds support for exporting systemd targets and services. The structure is based on the existing upstart support. Quality is draft and expected to refine in the coming weeks. One Foremanism that is not respected by these export templates is the usual log output location, instead stdout and stderr go to syslog.
This commit is contained in:
@@ -32,3 +32,4 @@ require "foreman/export/bluepill"
|
||||
require "foreman/export/runit"
|
||||
require "foreman/export/supervisord"
|
||||
require "foreman/export/launchd"
|
||||
require "foreman/export/systemd"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
require "erb"
|
||||
require "foreman/export"
|
||||
|
||||
class Foreman::Export::Systemd < Foreman::Export::Base
|
||||
|
||||
def export
|
||||
super
|
||||
|
||||
Dir["#{location}/#{app}*.target"].concat(Dir["#{location}/#{app}*.service"]).each do |file|
|
||||
clean file
|
||||
end
|
||||
|
||||
write_template "systemd/master.target.erb", "#{app}.target", binding
|
||||
|
||||
engine.each_process do |name, process|
|
||||
next if engine.formation[name] < 1
|
||||
write_template "systemd/process_master.target.erb", "#{app}-#{name}.target", binding
|
||||
|
||||
1.upto(engine.formation[name]) do |num|
|
||||
port = engine.port_for(process, num)
|
||||
write_template "systemd/process.service.erb", "#{app}-#{name}-#{num}.service", binding
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user