Sha256: 9c45bb8bb9a7014d1ec3519efd023cfd843ecc9814f0c2a662c4ba703d725c20

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 KB

Contents

namespace :load do
  task :defaults do
    set :logs_roles,        -> { :web }
    set :logs_show_lines,   -> { 500 }
  end
end


namespace :logs do
  
  ["rails", "sidekiq", "monit", "nginx-access", "nginx-error", "lets_encrypt_cron"].each do |that|
    
    desc "show #{that == 'lets_encrypt_cron' ? 'Lets Encrypt cron-job' : that} logs"
    task that do
      on release_roles fetch(:logs_roles, :web) do
        within shared_path do
          execute :tail, "-n #{ fetch(:logs_show_lines, 100) } log/#{ that == 'rails' ? fetch(:stage) : that }.log"
        end
      end
    end
    
  end
  
  3.times do |x|
    
    desc "show thin instance-#{x} logs"
    task "thin#{x}" do
      on release_roles fetch(:logs_roles, :web) do
        within shared_path do
          begin
            execute :tail, "-n #{ fetch(:logs_show_lines, 100) } log/thin_#{fetch(:application)}_#{fetch(:stage)}.#{x}.log"
          rescue SSHKit::Command::Failed
            # If gems are not installed eq(first deploy) and sidekiq_default_hooks as active
            warn "thin_#{fetch(:application)}_#{fetch(:stage)}.#{x}.log => not found! .. (may not exist)"
          end
        end
      end
    end
    
  end
  
  
end



Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
magic_recipes_two-0.0.95 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.94 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.93 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.91 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.90 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.89 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.88 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.87 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.86 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.85 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.84 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.83 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.82 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.81 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.80 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.79 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.78 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.77 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.76 lib/capistrano/tasks/logs.rake
magic_recipes_two-0.0.75 lib/capistrano/tasks/logs.rake