Sha256: a347414494788baa7ed0e72c0a299323f0acdad43d5cce89a047602c6d4aa76c

Contents?: true

Size: 942 Bytes

Versions: 91

Compression:

Stored size: 942 Bytes

Contents

require "erb"
require "foreman/export"

class Foreman::Export::Runit < Foreman::Export::Base

  ENV_VARIABLE_REGEX = /([a-zA-Z_]+[a-zA-Z0-9_]*)=(\S+)/

  def export
    super

    engine.each_process do |name, process|
      1.upto(engine.formation[name]) do |num|
        process_directory = "#{app}-#{name}-#{num}"

        create_directory process_directory
        create_directory "#{process_directory}/env"
        create_directory "#{process_directory}/log"

        write_template "runit/run.erb", "#{process_directory}/run", binding
        chmod 0755, "#{process_directory}/run"

        port = engine.port_for(process, num)
        engine.env.merge("PORT" => port.to_s).each do |key, value|
          write_file "#{process_directory}/env/#{key}", value
        end

        write_template "runit/log/run.erb", "#{process_directory}/log/run", binding
        chmod 0755, "#{process_directory}/log/run"
      end
    end

  end

end

Version data entries

91 entries across 91 versions & 6 rubygems

Version Path
foreman-0.88.1 lib/foreman/export/runit.rb
overman-0.87.3 lib/foreman/export/runit.rb
foreman-0.87.2 lib/foreman/export/runit.rb
foreman-0.87.1 lib/foreman/export/runit.rb
ypadlyak-foreman-0.85.0 lib/foreman/export/runit.rb
ypadlyak-foreman-0.81.0 lib/foreman/export/runit.rb
foreman-0.87.0 lib/foreman/export/runit.rb
foreman-0.86.0 lib/foreman/export/runit.rb
foreman-0.85.0 lib/foreman/export/runit.rb
foreman-0.84.0 lib/foreman/export/runit.rb
foreman-0.83.0 lib/foreman/export/runit.rb
foreman-systemd-0.78.0 lib/foreman/export/runit.rb
foreman-0.82.0 lib/foreman/export/runit.rb
foreman-0.81.0 lib/foreman/export/runit.rb
foreman-0.80.2 lib/foreman/export/runit.rb
foreman-0.80.1 lib/foreman/export/runit.rb
foreman-0.80.0 lib/foreman/export/runit.rb
foreman-0.78.0 lib/foreman/export/runit.rb
foreman-0.77.0 lib/foreman/export/runit.rb
foreman-0.76.0 lib/foreman/export/runit.rb