Sha256: 6f15e651ec69ef83c2c71ef6988805005b42233b910e7102520328ee3bdeffe6

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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}"
        execute :service, command_string
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-devops-0.0.7 lib/capistrano/tasks/rainbows.rake
capistrano-devops-0.0.6 lib/capistrano/tasks/rainbows.rake