Sha256: a991a422476f58d2a7718583a639a48fe15b6b757cf58625e2fe352825b2a211

Contents?: true

Size: 1.81 KB

Versions: 57

Compression:

Stored size: 1.81 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 }
    set :thin_hooks,                  -> { true }
    
  end
end


namespace :thin do
  
  
  desc "rewrite thin-configurations"
  task :reconf 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 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


namespace :deploy do
  after 'deploy:published', :restart_thin_apps do
    if fetch(:thin_hooks)
      invoke "thin:reconf"
      invoke "thin:restart"
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
magic_recipes_two-0.0.71 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.70 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.69 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.68 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.67 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.66 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.65 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.64 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.63 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.62 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.61 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.60 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.59 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.58 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.57 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.56 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.55 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.54 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.53 lib/capistrano/tasks/thin.rake
magic_recipes_two-0.0.52 lib/capistrano/tasks/thin.rake