capitate 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/Capfile +24 -0
  2. data/History.txt +22 -0
  3. data/License.txt +20 -0
  4. data/Manifest.txt +100 -0
  5. data/README.txt +1 -0
  6. data/Rakefile +4 -0
  7. data/bin/capitate +46 -0
  8. data/config/hoe.rb +70 -0
  9. data/config/requirements.rb +17 -0
  10. data/lib/capitate/cap_ext/connections.rb +95 -0
  11. data/lib/capitate/cap_ext/extension_proxy.rb +15 -0
  12. data/lib/capitate/cap_ext/variables.rb +59 -0
  13. data/lib/capitate/config.rb +106 -0
  14. data/lib/capitate/plugins/base.rb +85 -0
  15. data/lib/capitate/plugins/gem.rb +25 -0
  16. data/lib/capitate/plugins/package.rb +30 -0
  17. data/lib/capitate/plugins/profiles.rb +33 -0
  18. data/lib/capitate/plugins/script.rb +118 -0
  19. data/lib/capitate/plugins/templates.rb +98 -0
  20. data/lib/capitate/plugins/wget.rb +23 -0
  21. data/lib/capitate/plugins/yum.rb +87 -0
  22. data/lib/capitate/recipes.rb +9 -0
  23. data/lib/capitate/version.rb +9 -0
  24. data/lib/capitate.rb +32 -0
  25. data/lib/doc/centos/memcached.yml +18 -0
  26. data/lib/doc/centos/mongrel_cluster.yml +11 -0
  27. data/lib/doc/centos/monit.yml +12 -0
  28. data/lib/doc/centos/mysql.yml +6 -0
  29. data/lib/doc/centos/nginx.yml +25 -0
  30. data/lib/doc/centos/sphinx.yml +14 -0
  31. data/lib/doc/gems.yml +7 -0
  32. data/lib/doc/install.yml +11 -0
  33. data/lib/doc/memcached.yml +13 -0
  34. data/lib/doc/mongrel_cluster.yml +12 -0
  35. data/lib/doc/mysql.yml +46 -0
  36. data/lib/doc/nginx.yml +23 -0
  37. data/lib/doc/packages.yml +17 -0
  38. data/lib/doc/rails.yml +15 -0
  39. data/lib/profiles/centos-sick.rb +114 -0
  40. data/lib/recipes/README +5 -0
  41. data/lib/recipes/centos/README +3 -0
  42. data/lib/recipes/centos/centos.rb +44 -0
  43. data/lib/recipes/centos/imagemagick.rb +19 -0
  44. data/lib/recipes/centos/memcached.rb +31 -0
  45. data/lib/recipes/centos/mongrel_cluster.rb +34 -0
  46. data/lib/recipes/centos/monit.rb +42 -0
  47. data/lib/recipes/centos/mysql.rb +25 -0
  48. data/lib/recipes/centos/nginx.rb +45 -0
  49. data/lib/recipes/centos/ruby.rb +37 -0
  50. data/lib/recipes/centos/sphinx.rb +49 -0
  51. data/lib/recipes/deploy.rb +18 -0
  52. data/lib/recipes/gems.rb +11 -0
  53. data/lib/recipes/install.rb +18 -0
  54. data/lib/recipes/memcached.rb +14 -0
  55. data/lib/recipes/mongrel_cluster.rb +33 -0
  56. data/lib/recipes/mysql.rb +33 -0
  57. data/lib/recipes/nginx.rb +40 -0
  58. data/lib/recipes/packages.rb +24 -0
  59. data/lib/recipes/rails.rb +20 -0
  60. data/lib/recipes/sphinx.rb +38 -0
  61. data/lib/templates/capistrano/Capfile +26 -0
  62. data/lib/templates/centos/setup_for_web.sh +17 -0
  63. data/lib/templates/centos/sudoers +95 -0
  64. data/lib/templates/memcached/memcached.initd.centos.erb +70 -0
  65. data/lib/templates/memcached/memcached.monitrc.erb +4 -0
  66. data/lib/templates/mongrel/mongrel_cluster.initd.erb +61 -0
  67. data/lib/templates/mongrel/mongrel_cluster.monitrc.erb +15 -0
  68. data/lib/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  69. data/lib/templates/monit/cert.sh +14 -0
  70. data/lib/templates/monit/monit.cnf +34 -0
  71. data/lib/templates/monit/monit.initd.centos.erb +68 -0
  72. data/lib/templates/monit/monitrc.erb +28 -0
  73. data/lib/templates/monit/patch_inittab.sh +15 -0
  74. data/lib/templates/mysql/install_db.sql.erb +7 -0
  75. data/lib/templates/mysql/mysql.monitrc.erb +6 -0
  76. data/lib/templates/nginx/nginx.conf.erb +88 -0
  77. data/lib/templates/nginx/nginx.initd.erb +62 -0
  78. data/lib/templates/nginx/nginx.monitrc.erb +4 -0
  79. data/lib/templates/nginx/nginx_vhost.conf.erb +95 -0
  80. data/lib/templates/rails/database.yml.erb +42 -0
  81. data/lib/templates/ruby/fix_openssl.sh +12 -0
  82. data/lib/templates/sphinx/sphinx.conf.erb +498 -0
  83. data/lib/templates/sphinx/sphinx.monitrc.erb +4 -0
  84. data/lib/templates/sphinx/sphinx_app.initd.centos.erb +67 -0
  85. data/script/destroy +14 -0
  86. data/script/generate +14 -0
  87. data/script/txt2html +74 -0
  88. data/setup.rb +1585 -0
  89. data/tasks/capitate.rake +10 -0
  90. data/tasks/deployment.rake +34 -0
  91. data/tasks/environment.rake +7 -0
  92. data/tasks/website.rake +17 -0
  93. data/test/test_helper.rb +2 -0
  94. data/test/test_recipes.rb +11 -0
  95. data/test/test_templates.rb +29 -0
  96. data/website/index.html +161 -0
  97. data/website/index.txt +86 -0
  98. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  99. data/website/stylesheets/screen.css +138 -0
  100. data/website/template.rhtml +48 -0
  101. metadata +160 -0
@@ -0,0 +1,10 @@
1
+ namespace :capitate do
2
+
3
+ task :bootstrap do
4
+
5
+ include Capitate::Plugins::Templates
6
+ write("capistrano/Capfile", binding, "Capfile")
7
+
8
+ end
9
+
10
+ end
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/capitate'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestRecipes < Test::Unit::TestCase
4
+
5
+ def test_load
6
+ #load File.dirname(__FILE__) + "/../lib/capitate/recipes.rb"
7
+ assert true
8
+ end
9
+
10
+ end
11
+
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestTemplates < Test::Unit::TestCase
4
+
5
+ TmpDir = File.dirname(__FILE__) + "/tmp"
6
+
7
+ def setup
8
+ FileUtils.mkdir(TmpDir)
9
+ end
10
+
11
+ def teardown
12
+ FileUtils.rm_rf(TmpDir)
13
+ end
14
+
15
+ def test_write
16
+ TemplatesPlugin.write("capistrano/Capfile", "#{TmpDir}/Capfile")
17
+
18
+ lines = ""
19
+ File.open("#{TmpDir}/Capfile") { |f| lines = f.readlines }
20
+ assert lines.length > 0
21
+ end
22
+
23
+ end
24
+
25
+ class TemplatesPlugin
26
+ class << self
27
+ include Capitate::Plugins::Templates
28
+ end
29
+ end
@@ -0,0 +1,161 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ Capistrano plugins, recipes and templates
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>Capistrano plugins, recipes and templates</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/capitate"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/capitate" class="numbers">0.1.7</a>
37
+ </div>
38
+ <h1>&#x2192; &#8216;capitate&#8217;</h1>
39
+
40
+
41
+ <h2>What</h2>
42
+
43
+
44
+ <p>Capistrano plugins, recipes and templates.</p>
45
+
46
+
47
+ <h2>Installing</h2>
48
+
49
+
50
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">capitate</span></pre></p>
51
+
52
+
53
+ <p>Create a Capfile (in your project):</p>
54
+
55
+
56
+ <p><pre class='syntax'><span class="ident">capitate</span></pre></p>
57
+
58
+
59
+ <p>Create and set a profile in you Capfile:</p>
60
+
61
+
62
+ <p><pre class='syntax'><span class="comment"># load &quot;config/deployment/centos-sick.rb&quot;</span></pre></p>
63
+
64
+
65
+ <p><em>See profiles section below for more info</em></p>
66
+
67
+
68
+ <h2>The basics</h2>
69
+
70
+
71
+ <p>Capitate has recipes for:</p>
72
+
73
+
74
+ <ul>
75
+ <li>Installing applications, via package manager or manually building with make.</li>
76
+ <li>Common deployment setup and update_code tasks, such as symlinking in database.yml and more advanced recipes such as sphinx configuration.</li>
77
+ <li><span class="caps">ERB</span> templates for application configuration files, init scripts, monit configuration, etc.</li>
78
+ <li>And more&#8230;</li>
79
+ </ul>
80
+
81
+
82
+ <h3>Profiles</h3>
83
+
84
+
85
+ <p>Profiles are capfiles which store lists of recipes to run for cap install and deploy and settings for those recipes.</p>
86
+
87
+
88
+ <p>For an example profile, see <a href="http://svn.ducktyper.com/capitate/trunk/lib/profiles/centos-sick.rb">centos-sick.rb</a></p>
89
+
90
+
91
+ <p><span class="caps">TODO</span>: More on profiles&#8230;</p>
92
+
93
+
94
+ <h3>Install recipes</h3>
95
+
96
+
97
+ <p>To install a group of applications based on a profile (see Profiles section below):</p>
98
+
99
+
100
+ <pre><code>cap install</code></pre>
101
+
102
+
103
+ <p><em>You may need to comment out &#8220;Defaults requiretty&#8221; in /etc/sudoders on the image before capistrano recipes will work.</em></p>
104
+
105
+
106
+ <h3>Deploying (application)</h3>
107
+
108
+
109
+ <p>If this is the first time you&#8217;ve deployed you&#8217;ll need to run:</p>
110
+
111
+
112
+ <pre><code>cap deploy:setup</code></pre>
113
+
114
+
115
+ <p>Otherwise, your standard deploy options:</p>
116
+
117
+
118
+ <pre><code>cap deploy</code></pre>
119
+
120
+
121
+ <pre><code>cap deploy:migrations (deploys and does migration)</code></pre>
122
+
123
+
124
+ <pre><code>cap deploy:migrate (only does migration on existing deployment)</code></pre>
125
+
126
+
127
+ <h2>Forum</h2>
128
+
129
+
130
+ <p><a href="http://groups.google.com/group/capitate">http://groups.google.com/group/capitate</a></p>
131
+
132
+
133
+ <h2>How to submit patches</h2>
134
+
135
+
136
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
137
+
138
+
139
+ <p>The trunk repository is <code>http://svn.ducktyper.com/var/svn/capitate/trunk</code> for anonymous access.</p>
140
+
141
+
142
+ <h2>License</h2>
143
+
144
+
145
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
146
+
147
+
148
+ <h2>Contact</h2>
149
+
150
+
151
+ <p>Comments are welcome. Send an email to <a href="mailto:gabrielh@gmail.com">Gabriel Handford</a> via the <a href="http://groups.google.com/group/capitate">forum</a></p>
152
+ <p class="coda">
153
+ <a href="FIXME email">Gabriel Handford</a>, 21st February 2008<br>
154
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
155
+ </p>
156
+ </div>
157
+
158
+ <!-- insert site tracking codes here, like Google Urchin -->
159
+
160
+ </body>
161
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,86 @@
1
+ h1. Capistrano plugins, recipes and templates
2
+
3
+ h1. &#x2192; 'capitate'
4
+
5
+
6
+ h2. What
7
+
8
+ Capistrano plugins, recipes and templates.
9
+
10
+ h2. Installing
11
+
12
+ <pre syntax="ruby">sudo gem install capitate</pre>
13
+
14
+ Create a Capfile (in your project):
15
+
16
+ <pre syntax="ruby">capitate</pre>
17
+
18
+ Create and set a profile in you Capfile:
19
+
20
+ <pre syntax="ruby"># load "config/deployment/centos-sick.rb"</pre>
21
+
22
+ <em>See profiles section below for more info</em>
23
+
24
+
25
+ h2. The basics
26
+
27
+ Capitate has recipes for:
28
+
29
+ * Installing applications, via package manager or manually building with make.
30
+ * Common deployment setup and update_code tasks, such as symlinking in database.yml and more advanced recipes such as sphinx configuration.
31
+ * ERB templates for application configuration files, init scripts, monit configuration, etc.
32
+ * And more...
33
+
34
+
35
+ h3. Profiles
36
+
37
+ Profiles are capfiles which store lists of recipes to run for cap install and deploy and settings for those recipes.
38
+
39
+ For an example profile, see "centos-sick.rb":http://svn.ducktyper.com/capitate/trunk/lib/profiles/centos-sick.rb
40
+
41
+ TODO: More on profiles...
42
+
43
+
44
+ h3. Install recipes
45
+
46
+ To install a group of applications based on a profile (see Profiles section below):
47
+
48
+ cap install
49
+
50
+ <em>You may need to comment out "Defaults requiretty" in /etc/sudoders on the image before capistrano recipes will work.</em>
51
+
52
+
53
+ h3. Deploying (application)
54
+
55
+ If this is the first time you've deployed you'll need to run:
56
+
57
+ cap deploy:setup
58
+
59
+ Otherwise, your standard deploy options:
60
+
61
+ cap deploy
62
+
63
+ cap deploy:migrations (deploys and does migration)
64
+
65
+ cap deploy:migrate (only does migration on existing deployment)
66
+
67
+
68
+
69
+ h2. Forum
70
+
71
+ "http://groups.google.com/group/capitate":http://groups.google.com/group/capitate
72
+
73
+ h2. How to submit patches
74
+
75
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
76
+
77
+ The trunk repository is <code>http://svn.ducktyper.com/var/svn/capitate/trunk</code> for anonymous access.
78
+
79
+ h2. License
80
+
81
+ This code is free to use under the terms of the MIT license.
82
+
83
+ h2. Contact
84
+
85
+ Comments are welcome. Send an email to "Gabriel Handford":mailto:gabrielh@gmail.com via the "forum":http://groups.google.com/group/capitate
86
+