Sha256: 06deb64e87b5275c460d6c489c08831d64f80033643d147b3399f8db6ca60bf8

Contents?: true

Size: 1.61 KB

Versions: 12

Compression:

Stored size: 1.61 KB

Contents

require 'capistrano/magic_recipes/base_helpers'
include Capistrano::MagicRecipes::BaseHelpers

namespace :load do
  task :defaults do
    
    set :thin_path,                   -> { '/etc/thin' }
    set :thin_roles,                  -> { :web }
    
    set :thin_timeout,                -> { 30 }
    set :thin_max_conns,              -> { 1024 }
    set :thin_max_persistent_conns,   -> { 512 }
    set :thin_require,                -> { [] }
    set :thin_wait,                   -> { 90 }
    set :thin_onebyone,               -> { true }
    
  end
end


namespace :thin do
  
  
  desc "rewrite thin-configurations"
  task :reconf => ['nginx:load_vars'] do
    on release_roles fetch(:thin_roles) do
      within current_path do
        magic_template("thin_app_yml", '/tmp/thin_app.yml')
        execute :sudo, :mv, '/tmp/thin_app.yml', "config/thin_app_#{fetch(:stage)}.yml"
        execute :sudo, :rm, ' -f', "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}*"
        execute :sudo, :ln, ' -sf', "#{current_path}/config/thin_app_#{fetch(:stage)}.yml", "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}.yml"
      end
    end
  end
  
  
  %w[start stop restart].each do |command|
    desc "#{command} thin"
    task command => ['nginx:load_vars'] do
      on release_roles fetch(:thin_roles) do
        within current_path do
          execute :bundle, :exec, :thin, "#{command} -C config/thin_app_#{fetch(:stage)}.yml"
        end
      end
    end
  end
  
  
end

after 'deploy:published', nil do
  on release_roles fetch(:thin_roles) do
    invoke "thin:reconf"
    invoke "thin:restart"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
magic_recipes_two-0.0.25 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.24 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.23 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.22 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.21 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.20 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.19 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.18 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.17 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.16 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.15 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.14 lib/capistrano/tasks/thin.rake