Sha256: 9decaf1be5508e64557f3a1a3e41a3bbb460af305cd40795767661f279c307a4
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
namespace :log do namespace :tail do desc "Tail Rails production log file" task :production, :roles => :app do run "tail -f #{shared_path}/log/production.log" do |channel, stream, data| puts "\n#{channel[:host]}: #{data}" break if stream == :err end end desc "Tail Apache access log file" task :access, :roles => :app do run "tail -f #{shared_path}/log/access_log" do |channel, stream, data| puts "\n#{channel[:host]}: #{data}" break if stream == :err end end end namespace :pull do desc "Pull production log file to /tmp/production.log" task :production, :roles => :app do run "gzip -c #{shared_path}/log/production.log > #{shared_path}/log/production.log.gz" `rm -f /tmp/production.log.gz` puts "Downloading #{shared_path}/log/production.log...\n" download("#{shared_path}/log/production.log.gz", "/tmp/production.log.gz", :via => :scp) do |channel, name, received, total| print "\r #{name}: #{(Float(received)/total*100).to_i}% complete..." end run "rm -f #{shared_path}/log/production.log.gz" `gzip -fd /tmp/production.log.gz` puts "File can be accessed at /tmp/production.log" end end desc "Symlink shared logs to /var/log/rails/<application>-<stage>" task :symlink_shared do # Creates /var/log/rails/<application>-<stage> and migrates any existing logs. run "if ! [ -d /var/log/rails/#{application}-#{stage} ]; then #{sudo} mkdir -p /var/log/rails/#{application}-#{stage} && #{sudo} mv #{shared_path}/log/* /var/log/rails/#{application}-#{stage}/; fi" sudo "rm -rf #{shared_path}/log && ln -fs /var/log/rails/#{application}-#{stage} #{shared_path}/log" sudo "chown -R #{httpd_user}:#{httpd_group} /var/log/rails/#{application}-#{stage}/" end end after "stack", "log:symlink_shared"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crossroads_capistrano-1.4.0 | lib/crossroads_capistrano/recipes/log.rb |