gabetax-eycap 0.5.6

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,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,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gabetax-eycap
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 6
9
+ version: 0.5.6
10
+ platform: ruby
11
+ authors:
12
+ - Engine Yard
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2009-10-07 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: capistrano
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 2
30
+ - 0
31
+ version: 2.2.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: hoe
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 5
44
+ - 1
45
+ version: 1.5.1
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: A bunch of useful recipes to help deployment to the Engine Yard private cloud.
49
+ email: appsupport@engineyard.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - History.txt
56
+ - Manifest.txt
57
+ - README.txt
58
+ files:
59
+ - History.txt
60
+ - Manifest.txt
61
+ - README.txt
62
+ - Rakefile
63
+ - lib/capistrano/recipes/deploy/strategy/filtered_remote_cache.rb
64
+ - lib/capistrano/recipes/deploy/strategy/unshared_remote_cache.rb
65
+ - lib/eycap.rb
66
+ - lib/eycap/lib/ey_logger.rb
67
+ - lib/eycap/lib/ey_logger_hooks.rb
68
+ - lib/eycap/recipes.rb
69
+ - lib/eycap/recipes/backgroundrb.rb
70
+ - lib/eycap/recipes/database.rb
71
+ - lib/eycap/recipes/deploy.rb
72
+ - lib/eycap/recipes/ferret.rb
73
+ - lib/eycap/recipes/juggernaut.rb
74
+ - lib/eycap/recipes/memcached.rb
75
+ - lib/eycap/recipes/mongrel.rb
76
+ - lib/eycap/recipes/monit.rb
77
+ - lib/eycap/recipes/nginx.rb
78
+ - lib/eycap/recipes/passenger.rb
79
+ - lib/eycap/recipes/slice.rb
80
+ - lib/eycap/recipes/solr.rb
81
+ - lib/eycap/recipes/sphinx.rb
82
+ - lib/eycap/recipes/ssl.rb
83
+ - lib/eycap/recipes/templates/maintenance.rhtml
84
+ - lib/eycap/recipes/tomcat.rb
85
+ - lib/eycap/recipes/apache.rb
86
+ - lib/eycap/recipes/bundler.rb
87
+ - test/test_eycap.rb
88
+ - test/test_helper.rb
89
+ has_rdoc: true
90
+ homepage: http://github.com/engineyard/eycap
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options:
95
+ - --main
96
+ - README.txt
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ requirements: []
114
+
115
+ rubyforge_project: eycap
116
+ rubygems_version: 1.3.6
117
+ signing_key:
118
+ specification_version: 2
119
+ summary: Capistrano tasks for Engine Yard private cloud.
120
+ test_files:
121
+ - test/test_eycap.rb
122
+ - test/test_helper.rb