Sha256: 6837408ff5c904a0d1c74c5fb4560ad7e147ff2cb3c3407e4a07ff27647395c3

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

namespace :foreman do
  desc "Export the Procfile to Ubuntu's upstart scripts"
  task :export do
    on roles(:app) do
      within current_path do
        # Add path to .env.
        # Needed for rbenv to work properly.
        execute(:echo, "\"PATH=#{fetch(:rbenv_bin_path)}:$PATH\" >> .env")
        # Create the upstart script
        execute(:sudo, "#{fetch(:rbenv_prefix)} " \
                'foreman export upstart /etc/init ' \
                "-a #{fetch(:application)} " \
                "-u #{fetch(:user)} ")
      end
    end
  end

  desc 'Start the application services'
  task :start do
    on roles(:app) do
      execute("sudo service #{fetch(:application)} start")
    end
  end

  desc 'Stop the application services'
  task :stop do
    on roles(:app) do
      execute("sudo service #{fetch(:application)} stop")
    end
  end

  desc 'Restart the application services'
  task :restart do
    on roles(:app), in: :sequence, wait: 15 do
      execute("sudo service #{fetch(:application)} start || " \
              "sudo service #{fetch(:application)} restart")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kratos-1.0.3 templates/foreman.rake
kratos-1.0.2 templates/foreman.rake
kratos-1.0.1 templates/foreman.rake
kratos-1.0.0 templates/foreman.rake