newrelic-eycap 0.5.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,43 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ namespace :nginx do
4
+ desc "Start Nginx on the app slices."
5
+ task :start, :roles => :app do
6
+ sudo "nohup /etc/init.d/nginx start 2>&1 | cat"
7
+ end
8
+
9
+ desc "Restart the Nginx processes on the app slices."
10
+ task :restart , :roles => :app do
11
+ sudo "nohup /etc/init.d/nginx restart 2>&1 | cat"
12
+ end
13
+
14
+ desc "Stop the Nginx processes on the app slices."
15
+ task :stop , :roles => :app do
16
+ sudo "/etc/init.d/nginx stop"
17
+ end
18
+
19
+ desc "Reload the Nginx config on the app slices."
20
+ task :reload , :roles => :app do
21
+ sudo "/etc/init.d/nginx reload"
22
+ end
23
+
24
+ desc "Upgrade the Nginx processes on the app slices."
25
+ task :upgrade , :roles => :app do
26
+ sudo "/etc/init.d/nginx upgrade"
27
+ end
28
+
29
+ desc "Test the Nginx config on the app slices."
30
+ task :configtest , :roles => :app do
31
+ sudo "/etc/init.d/nginx configtest"
32
+ end
33
+
34
+ desc "Tail the nginx error logs on the app slices"
35
+ task :tail_error, :roles => :app do
36
+ run "tail -f /var/log/engineyard/nginx/error.log" do |channel, stream, data|
37
+ puts "#{channel[:server]}: #{data}" unless data =~ /^10\.[01]\.0/ # skips lb pull pages
38
+ break if stream == :err
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,10 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :passenger do
3
+ desc <<-DESC
4
+ Restart the passenger module to reload the application after deploying.
5
+ DESC
6
+ task :restart, :roles => :app, :except => {:no_release => true} do
7
+ sudo "touch #{current_path}/tmp/restart.txt"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ namespace :slice do
4
+ desc "Tail the Rails logs for your environment"
5
+ task :tail_environment_logs, :roles => :app do
6
+ run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
7
+ puts # for an extra line break before the host name
8
+ puts "#{channel[:server]} -> #{data}"
9
+ break if stream == :err
10
+ end
11
+ end
12
+ desc "Tail the Mongrel logs for your environment"
13
+ task :tail_mongrel_logs, :roles => :app do
14
+ run "tail -f #{shared_path}/log/mongrel*.log" do |channel, stream, data|
15
+ puts # for an extra line break before the host name
16
+ puts "#{channel[:server]} -> #{data}"
17
+ break if stream == :err
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ namespace :solr do
4
+ desc "After update_code you want to symlink the index and ferret_server.yml file into place"
5
+ task :symlink_configs, :roles => [:app], :except => {:no_release => true} do
6
+ run <<-CMD
7
+ cd #{latest_release} && ln -nfs #{shared_path}/config/solr.yml #{latest_release}/config/solr.yml
8
+ CMD
9
+ end
10
+
11
+ [:start,:stop,:restart].each do |op|
12
+ desc "#{op} ferret server"
13
+ task op, :roles => [:app], :only => {:solr => true} do
14
+ sudo "/usr/bin/monit #{op} all -g solr_#{application}"
15
+ end
16
+ end
17
+
18
+ namespace :tail do
19
+ desc "Tail the Solr logs this environment"
20
+ task :logs, :roles => [:app], :only => {:solr => true} do
21
+ run "tail -f /var/log/engineyard/solr/#{application}.log" do |channel, stream, data|
22
+ puts # for an extra line break before the host name
23
+ puts "#{channel[:server]} -> #{data}"
24
+ break if stream == :err
25
+ end
26
+ end
27
+ desc "Tail the Solr error logs this environment"
28
+ task :errors, :roles => [:app], :only => {:solr => true} do
29
+ run "tail -f /var/log/engineyard/solr/#{application}.err.log" do |channel, stream, data|
30
+ puts # for an extra line break before the host name
31
+ puts "#{channel[:server]} -> #{data}"
32
+ break if stream == :err
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,76 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ namespace :sphinx do
4
+ desc "After update_code you want to configure, then reindex"
5
+ task :configure, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
6
+ run "/engineyard/bin/searchd #{application} configure"
7
+ end
8
+
9
+ desc "After configure you want to reindex"
10
+ task :reindex, :roles => [:app], :only => {:sphinx => true} do
11
+ run "/engineyard/bin/searchd #{application} reindex"
12
+ end
13
+
14
+ desc "Start Sphinx Searchd"
15
+ task :start, :roles => [:app], :only => {:sphinx => true} do
16
+ sudo "/usr/bin/monit start all -g sphinx_#{application}"
17
+ end
18
+
19
+ desc "Stop Sphinx Searchd"
20
+ task :stop, :roles => [:app], :only => {:sphinx => true} do
21
+ sudo "/usr/bin/monit stop all -g sphinx_#{application}"
22
+ end
23
+
24
+ desc "Restart Sphinx Searchd"
25
+ task :restart, :roles => [:app], :only => {:sphinx => true} do
26
+ sudo "/usr/bin/monit restart all -g sphinx_#{application}"
27
+ end
28
+
29
+ task :symlink, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
30
+ run "if [ -d #{latest_release}/config/ultrasphinx ]; then mv #{latest_release}/config/ultrasphinx #{latest_release}/config/ultrasphinx.bak; fi"
31
+ run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
32
+ end
33
+ end
34
+
35
+ namespace :acts_as_sphinx do
36
+ desc "After update_code you to to reindex"
37
+ task :reindex, :roles => [:app], :only => {:sphinx => true} do
38
+ run "/engineyard/bin/acts_as_sphinx_searchd #{application} reindex"
39
+ end
40
+ end
41
+
42
+ namespace :thinking_sphinx do
43
+ desc "After update_code you want to configure, then reindex"
44
+ task :configure, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
45
+ run "/engineyard/bin/thinking_sphinx_searchd #{application} configure"
46
+ end
47
+
48
+ desc "After configure you want to reindex"
49
+ task :reindex, :roles => [:app], :only => {:sphinx => true} do
50
+ run "/engineyard/bin/thinking_sphinx_searchd #{application} reindex"
51
+ end
52
+
53
+ task :symlink, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
54
+ run "if [ -d #{latest_release}/config/thinkingsphinx ]; then mv #{latest_release}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx.bak; fi"
55
+ run "ln -nfs #{shared_path}/config/thinkingsphinx #{latest_release}/config/thinkingsphinx"
56
+ run "ln -nfs #{shared_path}/config/sphinx.yml #{latest_release}/config/sphinx.yml"
57
+ end
58
+ end
59
+
60
+ namespace :ultrasphinx do
61
+ desc "After update_code you want to configure, then reindex"
62
+ task :configure, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
63
+ run "/engineyard/bin/ultrasphinx_searchd #{application} configure"
64
+ end
65
+
66
+ desc "After configure you want to reindex"
67
+ task :reindex, :roles => [:app], :only => {:sphinx => true} do
68
+ run "/engineyard/bin/ultrasphinx_searchd #{application} reindex"
69
+ end
70
+
71
+ task :symlink, :roles => [:app], :only => {:sphinx => true}, :except => {:no_release => true} do
72
+ run "if [ -d #{latest_release}/config/ultrasphinx ]; then mv #{latest_release}/config/ultrasphinx #{latest_release}/config/ultrasphinx.bak; fi"
73
+ run "ln -nfs #{shared_path}/config/ultrasphinx #{latest_release}/config/ultrasphinx"
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,15 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ namespace :ssl do
4
+ desc "create csr and key for ssl certificates"
5
+ task :create, :roles => :app, :except => {:no_release => true} do
6
+ sudo "mkdir -p /data/ssl/"
7
+ set(:length) { Capistrano::CLI.ui.ask("key length (1024 or 2048): ") }
8
+ set(:country) { Capistrano::CLI.ui.ask("Country Code (2 letters): ") }
9
+ set(:state) { Capistrano::CLI.ui.ask("State/Province: ") }
10
+ set(:city) { Capistrano::CLI.ui.ask("City: ") }
11
+ set(:domain) { Capistrano::CLI.ui.ask("Common Name (domain): ") }
12
+ run "cd /data/ssl/ && openssl req -new -nodes -days 365 -newkey rsa:#{length} -subj '/C=#{country}/ST=#{state}/L=#{city}/CN=#{domain}' -keyout #{domain}.com.key -out #{domain}.com.csr"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,53 @@
1
+
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+
7
+ <head>
8
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
9
+ <title>System down for maintenance</title>
10
+
11
+ <style type="text/css">
12
+ div.outer {
13
+ position: absolute;
14
+ left: 50%;
15
+ top: 50%;
16
+ width: 500px;
17
+ height: 300px;
18
+ margin-left: -260px;
19
+ margin-top: -150px;
20
+ }
21
+
22
+ .DialogBody {
23
+ margin: 0;
24
+ padding: 10px;
25
+ text-align: left;
26
+ border: 1px solid #ccc;
27
+ border-right: 1px solid #999;
28
+ border-bottom: 1px solid #999;
29
+ background-color: #fff;
30
+ }
31
+
32
+ body { background-color: #fff; }
33
+ </style>
34
+ </head>
35
+
36
+ <body>
37
+
38
+ <div class="outer">
39
+ <div class="DialogBody" style="text-align: center;">
40
+ <div style="text-align: center; width: 200px; margin: 0 auto;">
41
+ <p style="color: red; font-size: 16px; line-height: 20px;">
42
+ The system is down for <%= reason ? reason : "maintenance" %>
43
+ as of <%= Time.now.strftime("%H:%M %Z") %>.
44
+ </p>
45
+ <p style="color: #666;">
46
+ It'll be back <%= deadline ? deadline : "shortly" %>.
47
+ </p>
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ </body>
53
+ </html>
@@ -0,0 +1,16 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :tomcat do
3
+ desc "Start tomcat"
4
+ task :start, :roles => [:app], :only => {:tomcat => true} do
5
+ sudo "/etc/init.d/tomcat start"
6
+ end
7
+ desc "Stop tomcat"
8
+ task :stop, :roles => [:app], :only => {:tomcat => true} do
9
+ sudo "/etc/init.d/tomcat stop"
10
+ end
11
+ desc "Restart tomcat"
12
+ task :restart, :roles => [:app], :only => {:tomcat => true} do
13
+ sudo "/etc/init.d/tomcat restart"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/eycap'
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: newrelic-eycap
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 6
9
+ - 0
10
+ version: 0.5.6.0
11
+ platform: ruby
12
+ authors:
13
+ - Engine Yard (New Relic)
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-03 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: capistrano
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 15
31
+ - 16
32
+ version: 2.15.16
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: A bunch of useful recipes to help deployment of New Relic applications.
36
+ email: support@newrelic.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.txt
43
+ files:
44
+ - .gitignore
45
+ - History.txt
46
+ - Manifest.txt
47
+ - README.txt
48
+ - Rakefile
49
+ - eycap.gemspec
50
+ - lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
51
+ - lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb
52
+ - lib/eycap.rb
53
+ - lib/eycap/lib/ey_logger.rb
54
+ - lib/eycap/lib/ey_logger_hooks.rb
55
+ - lib/eycap/recipes.rb
56
+ - lib/eycap/recipes/apache.rb
57
+ - lib/eycap/recipes/backgroundrb.rb
58
+ - lib/eycap/recipes/bundler.rb
59
+ - lib/eycap/recipes/database.rb
60
+ - lib/eycap/recipes/deploy.rb
61
+ - lib/eycap/recipes/ferret.rb
62
+ - lib/eycap/recipes/juggernaut.rb
63
+ - lib/eycap/recipes/memcached.rb
64
+ - lib/eycap/recipes/mongrel.rb
65
+ - lib/eycap/recipes/monit.rb
66
+ - lib/eycap/recipes/nginx.rb
67
+ - lib/eycap/recipes/passenger.rb
68
+ - lib/eycap/recipes/slice.rb
69
+ - lib/eycap/recipes/solr.rb
70
+ - lib/eycap/recipes/sphinx.rb
71
+ - lib/eycap/recipes/ssl.rb
72
+ - lib/eycap/recipes/templates/maintenance.rhtml
73
+ - lib/eycap/recipes/tomcat.rb
74
+ - test/test_helper.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/newrelic/eycap
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --charset=UTF-8
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ requirements: []
99
+
100
+ rubyforge_project:
101
+ rubygems_version: 1.3.6
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: New Relic fork of the Engineyard Capistrano tasks
105
+ test_files:
106
+ - test/test_helper.rb