Sha256: b369fed8321abe6abdfbdfbb4a2b1cb275914e696868b3e01609bcef74e31e43

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

namespace :foreman do
  desc 'Export the Procfile to Ubuntu upstart scripts'
  task :export do
    on roles(:app) do |host|
      log_path = shared_path.join('log')
      environment_path = fetch(:foreman_env)
      foreman_user = fetch(:foreman_export_user) || "ubuntu"
            
      within release_path do
        as :root do
          execute :bundle, "exec foreman export upstart /etc/init -a #{fetch(:application)} -u #{foreman_user} -l #{log_path} -e #{environment_path}"
        end
      end
    end
  end

  desc 'Start the application services'
  task :start do
    on roles(:app) do |host|
      as :root do
        execute :start, fetch(:application)
      end
    end
  end

  desc 'Stop the application services'
  task :stop do
    on roles(:app) do |host|
      as :root do
        execute :stop, fetch(:application)
      end
    end
  end

  desc 'Restart the application services'
  task :restart do
    on roles(:app) do |host|
      as :root do
        execute :service, "#{fetch(:application)} start || service #{fetch(:application)} restart"
      end
    end
  end

  before 'deploy:publishing', 'foreman:export'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano3-foreman-precogs-0.4 lib/capistrano/tasks/foreman.cap