capitate 0.2.13 → 0.2.14

Sign up to get free protection for your applications and to get access to all the features.
data/Capfile CHANGED
@@ -11,25 +11,3 @@ require 'lib/capitate/recipes'
11
11
 
12
12
  require 'erb'
13
13
 
14
- # Test
15
- task :test_egrep do
16
- role :test, "10.0.6.118", :user => "root"
17
-
18
- found = utils.egrep("^mail.\\*", "/etc/syslog.conf")
19
- puts "Found? #{found}"
20
-
21
- found = utils.egrep("^fooo", "/etc/syslog.conf")
22
- puts "Found? #{found}"
23
- end
24
-
25
- task :test_app do
26
- set :application, "sick"
27
- set :deploy_to, "/var/www/apps/sick"
28
- role :web, "10.0.6.118", :user => "root"
29
- role :app, "10.0.6.118", :user => "root"
30
- end
31
-
32
- task :test_install do
33
- load File.dirname(__FILE__) + "/lib/deployment/centos-5.1-64-web/install.rb"
34
- role :test, "10.0.6.118", :user => "root"
35
- end
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.14 2008-03-27
2
+
3
+ * Removing my lame monkey patches
4
+ * Mysql cnf template
5
+ * Cleaning up mysql grant locations
6
+ * Logrotate for mysql slow query log
7
+
1
8
  == 0.2.13 2008-03-26
2
9
 
3
10
  * Fixing monit re/start for mongrel cluster and backgroundrb
data/Manifest.txt CHANGED
@@ -10,7 +10,7 @@ config/requirements.rb
10
10
  docs/nginx.README
11
11
  lib/capitate.rb
12
12
  lib/capitate/cap_ext/connections.rb
13
- lib/capitate/cap_ext/roles.rb
13
+ lib/capitate/cap_ext/docs.rb
14
14
  lib/capitate/cap_ext/run_via.rb
15
15
  lib/capitate/cap_ext/variables.rb
16
16
  lib/capitate/plugins/base.rb
@@ -41,6 +41,7 @@ lib/recipes/docs.rb
41
41
  lib/recipes/logrotate/backgroundrb.rb
42
42
  lib/recipes/logrotate/mongrel_cluster.rb
43
43
  lib/recipes/logrotate/monit.rb
44
+ lib/recipes/logrotate/mysql.rb
44
45
  lib/recipes/logrotate/nginx.rb
45
46
  lib/recipes/logrotate/rails.rb
46
47
  lib/recipes/logrotate/sphinx.rb
@@ -48,6 +49,7 @@ lib/recipes/logrotated.rb
48
49
  lib/recipes/memcached.rb
49
50
  lib/recipes/monit.rb
50
51
  lib/recipes/monit/backgroundrb.rb
52
+ lib/recipes/monit/database.rb
51
53
  lib/recipes/monit/memcached.rb
52
54
  lib/recipes/monit/mongrel_cluster.rb
53
55
  lib/recipes/monit/mysql.rb
@@ -75,6 +77,7 @@ lib/templates/monit/monit.cnf
75
77
  lib/templates/monit/monit.initd.centos.erb
76
78
  lib/templates/monit/monitrc.erb
77
79
  lib/templates/mysql/install_db.sql.erb
80
+ lib/templates/mysql/my.cnf.innodb_1024.erb
78
81
  lib/templates/mysql/mysql.monitrc.erb
79
82
  lib/templates/nginx/nginx.conf.erb
80
83
  lib/templates/nginx/nginx.initd.erb
@@ -96,7 +99,6 @@ tasks/website.rake
96
99
  test/test_helper.rb
97
100
  test/test_plugin_upload.rb
98
101
  test/test_recipes.rb
99
- test/test_roles.rb
100
102
  test/test_templates.rb
101
103
  website/index.html
102
104
  website/index.txt
@@ -3,33 +3,6 @@ module Capitate
3
3
  module CapExt
4
4
  module Connections
5
5
 
6
- def self.included(base) #:nodoc:
7
- base.send :alias_method, :execute_on_servers_without_capitate, :execute_on_servers
8
- base.send :alias_method, :execute_on_servers, :execute_on_servers_with_capitate
9
- end
10
-
11
- # Determines the set of servers within the current task's scope and
12
- # establishes connections to them, and then yields that list of
13
- # servers.
14
- #
15
- # If you set:
16
- #
17
- # set :ignore_missing_roles, true
18
- #
19
- # Overriden to handle NoMatchingServersError as NON-FATAL.
20
- #
21
- def execute_on_servers_with_capitate(options={}, &block)
22
- if exists?(:ignore_missing_roles) && fetch(:ignore_missing_roles)
23
- begin
24
- execute_on_servers_without_capitate(options, &block)
25
- rescue Capistrano::NoMatchingServersError => e
26
- logger.important "`#{current_task.fully_qualified_name}' is only run for servers matching #{current_task.options.inspect}, but no servers matched"
27
- end
28
- else
29
- execute_on_servers_without_capitate(options, &block)
30
- end
31
- end
32
-
33
6
  # Set the user to something new (but save the old user; reset_user will set it back).
34
7
  # Takes care of invalidating current connections. Will force a re-login.
35
8
  #
@@ -0,0 +1,26 @@
1
+ module Capitate
2
+
3
+ module CapExt
4
+
5
+ module Docs
6
+
7
+ # Get link to github source, so we can refer to recipe code.
8
+ #
9
+ # ==== Options
10
+ # +recipe+:: Recipe path, probably use __FILE__
11
+ #
12
+ # ==== Examples
13
+ # # In a lib/recipes/foo/foo.rb
14
+ # link_to_source(__FILE__) => "http://github.com/gabriel/capitate/tree/master/lib/recipes/foo/foo.rb"
15
+ #
16
+ def link_to_source(recipe_path)
17
+ full_path = File.expand_path(recipe_path)
18
+ project_path = File.expand_path(File.dirname(__FILE__) + "/../../../")
19
+ "http://github.com/gabriel/capitate/tree/master#{full_path.sub(project_path, "")}"
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+
26
+ end
@@ -21,7 +21,7 @@ module Capitate
21
21
  if message.blank?
22
22
  message = <<-EOS
23
23
 
24
- Please set :#{variable} variable in your Capfile or profile.
24
+ Please set :#{variable} variable in your Capfile or deploy.rb
25
25
 
26
26
  EOS
27
27
  end
@@ -125,13 +125,6 @@ module Capitate
125
125
  nil
126
126
  end
127
127
 
128
-
129
- def link_to_source(recipe_path)
130
- full_path = File.expand_path(recipe_path)
131
- project_path = File.expand_path(File.dirname(__FILE__) + "/../../../")
132
- "http://github.com/gabriel/capitate/tree/master#{full_path.sub(project_path, "")}"
133
- end
134
-
135
128
  end
136
129
  end
137
130
 
@@ -71,6 +71,7 @@ module Capitate::Plugins::Base
71
71
 
72
72
  EOS
73
73
  end
74
+ message
74
75
  end
75
76
 
76
77
  # Indent string block.
@@ -2,7 +2,7 @@ module Capitate #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 13
5
+ TINY = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/capitate.rb CHANGED
@@ -27,13 +27,13 @@ require 'capitate/plugins/yum'
27
27
  require "capitate/cap_ext/connections"
28
28
  require "capitate/cap_ext/variables"
29
29
  require "capitate/cap_ext/run_via"
30
- require "capitate/cap_ext/roles"
30
+ require "capitate/cap_ext/docs"
31
31
 
32
32
  class Capistrano::Configuration
33
33
  include Capitate::CapExt::Variables
34
34
  include Capitate::CapExt::RunVia
35
- include Capitate::CapExt::Roles
36
35
  include Capitate::CapExt::Connections
36
+ include Capitate::CapExt::Docs
37
37
  end
38
38
 
39
39
  #module Capistrano::Configuration::Connections; end
@@ -10,6 +10,7 @@ namespace :backgroundrb do
10
10
  <dd>Backgroundrb logrotate paths.</dd>
11
11
  <dd class="default">Defaults to @\#{shared_path}/log/backgroundrb*.log@</dd>
12
12
  </dl>
13
+ "Source":#{link_to_source(__FILE__)}
13
14
  DESC
14
15
  task :install do
15
16
  fetch_or_default(:backgroundrb_logrotate_path, "#{shared_path}/log/backgroundrb*.log")
@@ -6,7 +6,12 @@ namespace :mongrel do
6
6
  desc <<-DESC
7
7
  Install logrotated conf for mongrel cluster.
8
8
 
9
- *mongrel_cluster_logrotate_path*: Mongrel cluster logrotate path. _Defaults to <tt>{shared_path}/log/mongrel_cluster_*.log</tt>_
9
+ <dl>
10
+ <dt>mongrel_cluster_logrotate_path</dt>
11
+ <dd>Mongrel cluster logrotate path</dd>
12
+ <dd class="default">Defaults to @\#{shared_path}/log/mongrel_cluster_*.log@</dd>
13
+ </dl>
14
+ "Source":#{link_to_source(__FILE__)}
10
15
  DESC
11
16
  task :install do
12
17
  fetch_or_default(:mongrel_cluster_logrotate_path, "#{shared_path}/log/mongrel_cluster_*.log")
@@ -5,7 +5,12 @@ namespace :monit do
5
5
  desc <<-DESC
6
6
  Install logrotated conf for monit.
7
7
 
8
- *monit_log_path*: Path to monit log. _Defaults to <tt>/var/log/monit.log</tt>_
8
+ <dl>
9
+ <dt>monit_log_path</dt>
10
+ <dd>Path to monit log</dd>
11
+ <dd class="default">Defaults to @"/var/log/monit.log"@</dd>
12
+ </dl>
13
+ "Source":#{link_to_source(__FILE__)}
9
14
  DESC
10
15
  task :install do
11
16
 
@@ -0,0 +1,26 @@
1
+ namespace :mysql do
2
+
3
+ namespace :logrotate do
4
+
5
+ desc <<-DESC
6
+ Install logrotated conf for nginx.
7
+
8
+ <dl>
9
+ <dt>mysql_logrotate_path</dt>
10
+ <dd>Mysql logrotate path</dd>
11
+ <dd class="default">Defaults to @"/var/lib/mysql/localhost-slow.log"@</dd>
12
+ </dl>
13
+ "Source":#{link_to_source(__FILE__)}
14
+ DESC
15
+ task :install, :roles => :db do
16
+ fetch_or_default(:mysql_logrotate_path, "/var/lib/mysql/localhost-slow.log")
17
+
18
+ set :logrotate_name, "mysql"
19
+ set :logrotate_log_path, mysql_logrotate_path
20
+ set :logrotate_options, [ { :rotate => 7, :size => "10M" }, :daily, :missingok, :notifempty, :copytruncate ]
21
+
22
+ logrotated.install_conf
23
+ end
24
+
25
+ end
26
+ end
@@ -55,6 +55,17 @@ namespace :logrotated do
55
55
 
56
56
  desc <<-DESC
57
57
  Force rotate files.
58
+
59
+ <dl>
60
+ <dt>logrotate_prefix</dt>
61
+ <dd>Path to logrotate</dd>
62
+ <dd>Defaults to none</dd>
63
+
64
+ <dt>logrotate_conf_path</dt>
65
+ <dd>Path to logrotate conf</dd>
66
+ <dd>Defaults to @"/etc/logrotate.conf"@</dd>
67
+ </dl>
68
+ "Source":#{link_to_source(__FILE__)}
58
69
  DESC
59
70
  task :force do
60
71
 
@@ -1,6 +1,38 @@
1
1
  namespace :memcached do
2
2
 
3
- desc "Create memcached yaml in shared path."
3
+ desc <<-DESC
4
+ Create memcached yaml in shared path.
5
+
6
+ <dl>
7
+ <dt>memcached_namespace</dt>
8
+
9
+ <dt>memcached_ttl</dt>
10
+ <dd class="default">Defaults to @3600@</dd>
11
+
12
+ <dt>memcached_readonly</dt>
13
+ <dd class="default">Defaults to @false@</dd>
14
+
15
+ <dt>memcached_urlencode</dt>
16
+ <dd class="default">Defaults to @false@</dd>
17
+
18
+ <dt>memcached_c_threshold</dt>
19
+ <dd class="default">Defaults to @10000@</dd>
20
+
21
+ <dt>memcached_compression</dt>
22
+ <dd class="default">Defaults to @true@</dd>
23
+
24
+ <dt>memcached_debug</dt>
25
+ <dd class="default">Defaults to @false@</dd>
26
+
27
+ <dt>memcached_servers</dt>
28
+ <dd class="default">Defaults to @[ "localhost:11211" ]@</dd>
29
+
30
+ <dt>memcached_yml_template</dt>
31
+ <dd class="default">Defaults to @"memcached/memcached.yml.erb"@</dd>
32
+ </dl>
33
+
34
+ "Source":#{link_to_source(__FILE__)}
35
+ DESC
4
36
  task :setup do
5
37
 
6
38
  # Settings
@@ -23,13 +23,13 @@ namespace :backgroundrb do
23
23
  sudo "#{monit_bin_path} restart backgroundrb_#{application}"
24
24
  end
25
25
 
26
- desc "Start mongrel cluster (for application)"
26
+ desc "Start backgroundrb (for application)"
27
27
  task :start do
28
28
  fetch_or_default(:monit_bin_path, "monit")
29
29
  sudo "#{monit_bin_path} start backgroundrb_#{application}"
30
30
  end
31
31
 
32
- desc "Stop mongrel cluster (for application)"
32
+ desc "Stop backgroundrb (for application)"
33
33
  task :stop do
34
34
  fetch_or_default(:monit_bin_path, "monit")
35
35
  sudo "#{monit_bin_path} stop backgroundrb_#{application}"
@@ -0,0 +1,25 @@
1
+ namespace :database do
2
+
3
+ namespace :monit do
4
+
5
+ desc "Restart database (monit group)"
6
+ task :restart do
7
+ fetch_or_default(:monit_bin_path, "monit")
8
+ sudo "#{monit_bin_path} -g database restart all"
9
+ end
10
+
11
+ desc "Start database (monit group)"
12
+ task :start do
13
+ fetch_or_default(:monit_bin_path, "monit")
14
+ sudo "#{monit_bin_path} -g database start all"
15
+ end
16
+
17
+ desc "Stop database (monit group)"
18
+ task :stop do
19
+ fetch_or_default(:monit_bin_path, "monit")
20
+ sudo "#{monit_bin_path} -g database stop all"
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -3,9 +3,24 @@ namespace :mysql do
3
3
  namespace :monit do
4
4
 
5
5
  desc <<-DESC
6
- Install mysql monit hooks. "Source":#{link_to_source(__FILE__)}
6
+ Install mysql monit hooks.
7
+
8
+ <dl>
9
+ <dt>mysql_pid_path</dt>
10
+ <dd>Path to mysql pid file</dd>
11
+
12
+ <dt>db_port</dt>
13
+ <dd>Mysql port</dd>
14
+ <dd class="default">Defaults to @3306@</dd>
15
+
16
+ <dt>monit_conf_dir</dt>
17
+ <dd>Monitrd directory.</dd>
18
+ <dd class="default">Defaults to @"/etc/monit"@</dd>
19
+ </dl>
20
+
21
+ "Source":#{link_to_source(__FILE__)}
7
22
  DESC
8
- task :install do
23
+ task :install, :roles => :db do
9
24
 
10
25
  # Settings
11
26
  fetch_or_default(:mysql_pid_path, "/var/run/mysqld/mysqld.pid")
@@ -14,8 +29,8 @@ namespace :mysql do
14
29
 
15
30
  put template.load("mysql/mysql.monitrc.erb", binding), "/tmp/mysql.monitrc"
16
31
  run_via "install -o root /tmp/mysql.monitrc #{monit_conf_dir}/mysql.monitrc"
17
- end
18
-
32
+ end
33
+
19
34
  end
20
35
 
21
36
  end
@@ -5,8 +5,7 @@ namespace :nginx do
5
5
  desc <<-DESC
6
6
  Install nginx monit hooks.
7
7
 
8
- <dl>
9
-
8
+ <dl>
10
9
  <dt>nginx_pid_path</dt>
11
10
  <dd>Path to nginx pid file</dd>
12
11
  <dd>Defaults to /var/run/nginx.pid</dd>
@@ -28,6 +27,24 @@ namespace :nginx do
28
27
  put template.load("nginx/nginx.monitrc.erb", binding), "/tmp/nginx.monitrc"
29
28
  run_via "install -o root /tmp/nginx.monitrc #{monit_conf_dir}/nginx.monitrc"
30
29
  end
30
+
31
+ desc "Restart nginx (through monit)"
32
+ task :restart do
33
+ fetch_or_default(:monit_bin_path, "monit")
34
+ sudo "#{monit_bin_path} restart nginx"
35
+ end
36
+
37
+ desc "Start nginx (through monit)"
38
+ task :start do
39
+ fetch_or_default(:monit_bin_path, "monit")
40
+ sudo "#{monit_bin_path} start nginx"
41
+ end
42
+
43
+ desc "Stop nginx (through monit)"
44
+ task :stop do
45
+ fetch_or_default(:monit_bin_path, "monit")
46
+ sudo "#{monit_bin_path} stop nginx"
47
+ end
31
48
 
32
49
  end
33
50
 
data/lib/recipes/mysql.rb CHANGED
@@ -36,18 +36,7 @@ namespace :mysql do
36
36
  fetch(:db_pass)
37
37
  fetch_or_default(:mysql_admin_password, prompt.password('Mysql admin password: '))
38
38
  fetch_or_default(:mysql_grant_priv_type, "ALL")
39
-
40
- # Set grant locations to all servers in roles: :search, :db, :app
41
- unless exists?(:mysql_grant_locations)
42
- mysql_grant_locations = [ "localhost" ]
43
- role_names = [ :search, :db, :app ]
44
- role_names.each do |role_name|
45
- roles[role_name].each do |role|
46
- mysql_grant_locations << role.host
47
- end unless roles[role_name].blank?
48
- end
49
- set :mysql_grant_locations, mysql_grant_locations.uniq!
50
- end
39
+ fetch_or_default(:mysql_grant_locations, [ "localhost" ])
51
40
 
52
41
  sql = template.load("mysql/install_db.sql.erb")
53
42
 
@@ -57,4 +46,31 @@ namespace :mysql do
57
46
  run "mysql -u root -p#{mysql_admin_password} < /tmp/install_db_#{application}.sql"
58
47
  end
59
48
 
49
+ desc <<-DESC
50
+ Create my.cnf based on template.
51
+
52
+ <dl>
53
+ <dt>my_cnf_template</dt>
54
+ <dd>Path to my.cnf template</dd>
55
+
56
+ <dt>db_socket</dt>
57
+ <dd>Path to mysql .sock</dd>
58
+ <dd class="default">Defaults to @"/var/lib/mysql/mysql.sock"@</dd>
59
+
60
+ <dt>db_port</dt>
61
+ <dd>Mysql port</dd>
62
+ <dd class="default">Defaults to @3306@</dd>
63
+ </dl>
64
+
65
+ "Source":#{link_to_source(__FILE__)}
66
+ DESC
67
+ task :install_my_cnf, :roles => :db do
68
+ fetch_or_default(:my_cnf_template, "mysql/my.cnf.innodb_1024.erb")
69
+ fetch_or_default(:db_socket, "/var/lib/mysql/mysql.sock")
70
+ fetch_or_default(:db_port, 3306)
71
+
72
+ utils.install_template(my_cnf_template, "/etc/my.cnf")
73
+ end
74
+
75
+
60
76
  end
data/lib/recipes/nginx.rb CHANGED
@@ -7,10 +7,12 @@ namespace :nginx do
7
7
 
8
8
  <dl>
9
9
  <dt>mongrel_application</dt>
10
- <dd>Mongrel application. _Defaults to <tt>:application</tt>_
10
+ <dd>Mongrel application.</dd>
11
+ <dd class="default">Defaults to @:application@</dd>
11
12
 
12
- <dt>mongrel_size</dt>: Number of mongrels.\n
13
- <dd>@set :mongrel_size, 3@\n
13
+ <dt>mongrel_size</dt>
14
+ <dd>Number of mongrels.</dd>
15
+ <dd>@set :mongrel_size, 3@</dd>
14
16
 
15
17
  <dt>*mongrel_port</dt>
16
18
  <dd>Starting port for mongrels. If there are 3 mongrels with port 9000, then instances will be at 9000, 9001, and 9002</dd>
@@ -0,0 +1,120 @@
1
+ #
2
+ # my.cnf.innodb_1024
3
+ #
4
+ # This is a MySQL 5.x configuration file designed for the typical
5
+ # webapp, running on a 1GB server that is also the app and
6
+ # httpd server. The below configuration dedicates about half of
7
+ # the system resources to MySQL. It is InnoDB-specific, and
8
+ # will not perform well with many MyISAM tables. It supports
9
+ # limited ACID and referential integrity. It does not support
10
+ # replication.
11
+ #
12
+ # By Evan Weaver
13
+ # http://blog.evanweaver.com/articles/2007/04/30/top-secret-tuned-mysql-configurations-for-rails
14
+ #
15
+ # Copyright 2007, Cloudburst, LLC
16
+ # Licensed under the Academic Free License v. 3.0
17
+ # http://blog.evanweaver.com/files/mysql/LICENSE
18
+ #
19
+
20
+ [client]
21
+ port = <%= db_port %>
22
+ socket = <%= db_socket %>
23
+ max_allowed_packet = 32M
24
+
25
+ [mysqld]
26
+ ######### engine and access interfaces
27
+ skip-networking
28
+ skip-locking
29
+ skip-bdb
30
+
31
+ port = <%= db_port %>
32
+ socket = <%= db_socket %>
33
+ default-storage-engine = innodb
34
+
35
+ ######### character sets
36
+ character_set_server = utf8
37
+ collation_server = utf8_general_ci
38
+
39
+ ######### innodb options
40
+ innodb_additional_mem_pool_size = 16M
41
+ # buffer pool size is most critical for innodb's performance and memory usage
42
+ innodb_buffer_pool_size = 256M
43
+ innodb_data_file_path = ibdata1:10M:autoextend
44
+ innodb_data_home_dir = /var/lib/mysql
45
+ innodb_file_io_threads = 4
46
+ innodb_thread_concurrency = 4
47
+ # 2 is fastest but slightly less reliable than 0 or 1, if you don't trust your hard disks
48
+ innodb_flush_log_at_trx_commit = 2
49
+
50
+ innodb_log_buffer_size = 64M
51
+ # innodb_log_file_size * innodb_log_files_in_group < buffer_pool_size
52
+ innodb_log_file_size = 80M
53
+ innodb_log_files_in_group = 3
54
+ # use a secondary volume if possible for a concurrent read/write speed boost
55
+ innodb_log_group_home_dir = /var/lib/mysql
56
+
57
+ innodb_max_dirty_pages_pct = 90
58
+ innodb_lock_wait_timeout = 120
59
+
60
+ ######### myisam
61
+ # innodb still requires the myisam engine for mysql's internal metadata table
62
+ key_buffer_size = 16M
63
+
64
+ ######### general
65
+ connect_timeout = 10
66
+ back_log = 50
67
+ # you can't have more mongrels or fastcgi processes than the max_connections setting
68
+ max_connections = 96
69
+ max_connect_errors = 10
70
+ table_cache = 2048
71
+ max_allowed_packet = 32M
72
+
73
+ open_files_limit = 1024
74
+ # this is the in-memory tmp table max size
75
+ max_heap_table_size = 64M
76
+ # below are per-connection and per-sub-query
77
+ join_buffer_size = 4M
78
+ read_buffer_size = 4M
79
+ sort_buffer_size = 8M
80
+ read_rnd_buffer_size = 8M
81
+
82
+ thread_cache_size = 8
83
+ thread_concurrency = 8
84
+
85
+ # query_cache_size is a global setting
86
+ query_cache_size = 128M
87
+ query_cache_limit = 2M
88
+ thread_stack = 192K
89
+ transaction_isolation = READ-COMMITTED
90
+ # this is the on-disk max size
91
+ tmp_table_size = 128M
92
+ tmpdir = /tmp
93
+
94
+
95
+ # You can log slow queries to the mysql log directory to help isolate performance problems
96
+ log_slow_queries
97
+ long_query_time = 3
98
+ log_long_format
99
+
100
+ [mysqldump]
101
+ quick
102
+ max_allowed_packet = 16M
103
+
104
+ [mysql]
105
+ no-auto-rehash
106
+
107
+ [myisamchk]
108
+ # not used except when repairing the database at startup
109
+ key_buffer = 64M
110
+ sort_buffer_size = 64M
111
+ read_buffer = 2M
112
+ write_buffer = 2M
113
+
114
+ [mysqlhotcopy]
115
+ interactive-timeout
116
+
117
+ [mysqld_safe]
118
+ open-files-limit = 8192
119
+
120
+ # PS. Do not under any circumstances enable binlog
data/test/test_recipes.rb CHANGED
@@ -2,8 +2,34 @@ require File.dirname(__FILE__) + '/test_helper.rb'
2
2
 
3
3
  class TestRecipes < Test::Unit::TestCase
4
4
 
5
- def test_load
6
- #load File.dirname(__FILE__) + "/../lib/capitate/recipes.rb"
5
+ def test_egrep
6
+ # task :test_egrep do
7
+ # role :test, "10.0.6.118", :user => "root"
8
+ #
9
+ # found = utils.egrep("^mail.\\*", "/etc/syslog.conf")
10
+ # puts "Found? #{found}"
11
+ #
12
+ # found = utils.egrep("^fooo", "/etc/syslog.conf")
13
+ # puts "Found? #{found}"
14
+ # end
15
+ assert true
16
+ end
17
+
18
+ def test_app
19
+ # task :test_app do
20
+ # set :application, "sick"
21
+ # set :deploy_to, "/var/www/apps/sick"
22
+ # role :web, "10.0.6.118", :user => "root"
23
+ # role :app, "10.0.6.118", :user => "root"
24
+ # end
25
+ assert true
26
+ end
27
+
28
+ def test_install
29
+ # task :test_install do
30
+ # load File.dirname(__FILE__) + "/lib/deployment/centos-5.1-64-web/install.rb"
31
+ # role :test, "10.0.6.118", :user => "root"
32
+ # end
7
33
  assert true
8
34
  end
9
35
 
data/website/index.html CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
  <div id="version" class="clickable box" onclick='document.location = "http://rubyforge.org/projects/capitate"; return false'>
40
40
  <p>Get Version</p>
41
- <a href="http://rubyforge.org/projects/capitate" class="numbers">0.2.13</a>
41
+ <a href="http://rubyforge.org/projects/capitate" class="numbers">0.2.14</a>
42
42
  </div>
43
43
 
44
44
  <div id="recipes">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capitate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ""
6
6
  authors:
7
7
  - Gabriel Handford
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-26 00:00:00 -04:00
12
+ date: 2008-03-27 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ files:
47
47
  - docs/nginx.README
48
48
  - lib/capitate.rb
49
49
  - lib/capitate/cap_ext/connections.rb
50
- - lib/capitate/cap_ext/roles.rb
50
+ - lib/capitate/cap_ext/docs.rb
51
51
  - lib/capitate/cap_ext/run_via.rb
52
52
  - lib/capitate/cap_ext/variables.rb
53
53
  - lib/capitate/plugins/base.rb
@@ -78,6 +78,7 @@ files:
78
78
  - lib/recipes/logrotate/backgroundrb.rb
79
79
  - lib/recipes/logrotate/mongrel_cluster.rb
80
80
  - lib/recipes/logrotate/monit.rb
81
+ - lib/recipes/logrotate/mysql.rb
81
82
  - lib/recipes/logrotate/nginx.rb
82
83
  - lib/recipes/logrotate/rails.rb
83
84
  - lib/recipes/logrotate/sphinx.rb
@@ -85,6 +86,7 @@ files:
85
86
  - lib/recipes/memcached.rb
86
87
  - lib/recipes/monit.rb
87
88
  - lib/recipes/monit/backgroundrb.rb
89
+ - lib/recipes/monit/database.rb
88
90
  - lib/recipes/monit/memcached.rb
89
91
  - lib/recipes/monit/mongrel_cluster.rb
90
92
  - lib/recipes/monit/mysql.rb
@@ -112,6 +114,7 @@ files:
112
114
  - lib/templates/monit/monit.initd.centos.erb
113
115
  - lib/templates/monit/monitrc.erb
114
116
  - lib/templates/mysql/install_db.sql.erb
117
+ - lib/templates/mysql/my.cnf.innodb_1024.erb
115
118
  - lib/templates/mysql/mysql.monitrc.erb
116
119
  - lib/templates/nginx/nginx.conf.erb
117
120
  - lib/templates/nginx/nginx.initd.erb
@@ -133,7 +136,6 @@ files:
133
136
  - test/test_helper.rb
134
137
  - test/test_plugin_upload.rb
135
138
  - test/test_recipes.rb
136
- - test/test_roles.rb
137
139
  - test/test_templates.rb
138
140
  - website/index.html
139
141
  - website/index.txt
@@ -174,5 +176,4 @@ test_files:
174
176
  - test/test_helper.rb
175
177
  - test/test_plugin_upload.rb
176
178
  - test/test_recipes.rb
177
- - test/test_roles.rb
178
179
  - test/test_templates.rb
@@ -1,26 +0,0 @@
1
- module Capitate
2
- module CapExt
3
- module Roles
4
-
5
- def self.included(base) #:nodoc:
6
- base.send :alias_method, :role_list_from_without_capitate, :role_list_from
7
- base.send :alias_method, :role_list_from, :role_list_from_with_capitate
8
- end
9
-
10
- def role_list_from_with_capitate(roles)
11
- roles = roles.split(/,/) if String === roles
12
- roles = build_list(roles)
13
- roles.map { |role|
14
- role = String === role ? role.strip.to_sym : role
15
- unless self.roles.key?(role)
16
- logger.important "unknown role `#{role}'"
17
- nil
18
- else
19
- role
20
- end
21
- }.compact
22
- end
23
-
24
- end
25
- end
26
- end
data/test/test_roles.rb DELETED
@@ -1,47 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
- require 'capistrano/configuration'
3
-
4
- class TestRoles < Test::Unit::TestCase
5
-
6
- def setup
7
- @config = Capistrano::Configuration.new
8
- end
9
-
10
- def test_fetch
11
-
12
- @config.load do
13
-
14
- role :test, "10.0.6.20"
15
- role :test_with_options, "10.0.6.21", :op1 => true
16
- role :test_with_options, "10.0.6.22", :op2 => true
17
-
18
- role :test_with_other_options, "10.0.6.23", :sphinx_port => 3312
19
-
20
- end
21
-
22
- test_role = @config.fetch_role(:test)
23
-
24
- assert test_role
25
- assert_equal "10.0.6.20", test_role.host
26
-
27
- test_roles = @config.fetch_roles(:test_with_options)
28
- assert test_roles
29
- assert_equal [ "10.0.6.21", "10.0.6.22" ], test_roles.collect(&:host)
30
-
31
- test_roles_with_opts = @config.fetch_roles(:test_with_options, :op1 => true)
32
- assert test_roles_with_opts
33
- assert_equal [ "10.0.6.21" ], test_roles_with_opts.collect(&:host)
34
-
35
- test_role_with_opts = @config.fetch_role(:test_with_options, :op2 => true)
36
- assert test_role_with_opts
37
- assert_equal "10.0.6.22", test_role_with_opts.host
38
-
39
-
40
- test_role_with_other_opts = @config.fetch_role(:test_with_other_options)
41
- assert test_role_with_other_opts
42
- assert_equal "10.0.6.23", test_role_with_other_opts.host
43
- assert_equal 3312, test_role_with_other_opts.options[:sphinx_port]
44
-
45
- end
46
-
47
- end