eycap 0.4.16

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 production log for this environment"
5
+ task :tail_production_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 this 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,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,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestEycap < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ 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: eycap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.16
5
+ platform: ruby
6
+ authors:
7
+ - Engine Yard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-07 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: capistrano
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.3
34
+ version:
35
+ description: A bunch of useful recipes to help deployment to Engine Yard slices
36
+ email: tech@engineyard.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - History.txt
43
+ - Manifest.txt
44
+ - README.txt
45
+ files:
46
+ - History.txt
47
+ - Manifest.txt
48
+ - README.txt
49
+ - Rakefile
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/backgroundrb.rb
57
+ - lib/eycap/recipes/database.rb
58
+ - lib/eycap/recipes/bundler.rb
59
+ - lib/eycap/recipes/deploy.rb
60
+ - lib/eycap/recipes/ferret.rb
61
+ - lib/eycap/recipes/juggernaut.rb
62
+ - lib/eycap/recipes/memcached.rb
63
+ - lib/eycap/recipes/mongrel.rb
64
+ - lib/eycap/recipes/monit.rb
65
+ - lib/eycap/recipes/nginx.rb
66
+ - lib/eycap/recipes/slice.rb
67
+ - lib/eycap/recipes/solr.rb
68
+ - lib/eycap/recipes/sphinx.rb
69
+ - lib/eycap/recipes/templates/maintenance.rhtml
70
+ - lib/eycap/recipes/tomcat.rb
71
+ - lib/eycap/recipes/passenger.rb
72
+ - lib/eycap/recipes/apache.rb
73
+ - test/test_eycap.rb
74
+ - test/test_helper.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/engineyard/eycap/tree/master
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --main
82
+ - README.txt
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: "0"
90
+ version:
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
97
+ requirements: []
98
+
99
+ rubyforge_project: eycap
100
+ rubygems_version: 1.3.5
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Capistrano tasks for Engine Yard slices
104
+ test_files:
105
+ - test/test_eycap.rb
106
+ - test/test_helper.rb