Sha256: 2ad1fe3c75f2384fda2ed99af5b9b68565fcdc70788bbb4b76de154d6f958e0a

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

set :rainbows_user, ->{ fetch(:user) }
set :rainbows_pid, ->{ "#{current_path}/tmp/pids/rainbows.pid" }
set :rainbows_config, ->{ "#{shared_path}/config/rainbows.rb" }
set :rainbows_log, ->{ "#{shared_path}/log/rainbows.log" }
set :rainbows_workers, 2
set :rainbows_timeout, 30

namespace :rainbows do
  desc "Setup Rainbows initializer and app configuration"
  task :setup do
    on roles :app do
      execute :mkdir, "-p #{shared_path}/config"

      template "rainbows_init.erb", "/tmp/rainbows_init"
      template 'rainbows.erb', "#{fetch(:rainbows_config)}"

      execute :chmod, "+x /tmp/rainbows_init"
      as(:root) do
        execute :mv, "/tmp/rainbows_init /etc/init.d/rainbows_#{fetch(:application)}"
        execute :'update-rc.d', "-f rainbows_#{fetch(:application)} defaults"
      end
    end
  end

  %w[start stop restart].each do |command|
    desc "#{command} rainbows"
    task command do
      on roles(:app), in: :sequence, wait: 5 do
        command_string = "rainbows_#{fetch(:application)} #{command}"
        as :root do
          execute :service, command_string
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-devops-0.0.8 lib/capistrano/tasks/rainbows.rake