server_maint 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. data/.gitmodules +21 -0
  2. data/lib/cookbooks/aws/CHANGELOG.md +11 -0
  3. data/lib/cookbooks/aws/CONTRIBUTING +29 -0
  4. data/lib/cookbooks/aws/LICENSE +201 -0
  5. data/lib/cookbooks/aws/README.md +271 -0
  6. data/lib/cookbooks/aws/attributes/default.rb +20 -0
  7. data/lib/cookbooks/aws/libraries/ec2.rb +58 -0
  8. data/lib/cookbooks/aws/metadata.rb +7 -0
  9. data/lib/cookbooks/aws/providers/ebs_volume.rb +236 -0
  10. data/lib/cookbooks/aws/providers/elastic_ip.rb +90 -0
  11. data/lib/cookbooks/aws/providers/elastic_lb.rb +24 -0
  12. data/lib/cookbooks/aws/providers/resource_tag.rb +93 -0
  13. data/lib/cookbooks/aws/recipes/default.rb +25 -0
  14. data/lib/cookbooks/aws/resources/ebs_volume.rb +17 -0
  15. data/lib/cookbooks/aws/resources/elastic_ip.rb +11 -0
  16. data/lib/cookbooks/aws/resources/elastic_lb.rb +10 -0
  17. data/lib/cookbooks/aws/resources/resource_tag.rb +11 -0
  18. data/lib/cookbooks/database/.gitignore +1 -0
  19. data/lib/cookbooks/database/CHANGELOG.md +51 -0
  20. data/lib/cookbooks/database/CONTRIBUTING +29 -0
  21. data/lib/cookbooks/database/LICENSE +201 -0
  22. data/lib/cookbooks/database/README.md +468 -0
  23. data/lib/cookbooks/database/libraries/provider_database_mysql.rb +103 -0
  24. data/lib/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
  25. data/lib/cookbooks/database/libraries/provider_database_postgresql.rb +131 -0
  26. data/lib/cookbooks/database/libraries/provider_database_postgresql_user.rb +83 -0
  27. data/lib/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
  28. data/lib/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
  29. data/lib/cookbooks/database/libraries/resource_database.rb +119 -0
  30. data/lib/cookbooks/database/libraries/resource_database_user.rb +90 -0
  31. data/lib/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
  32. data/lib/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
  33. data/lib/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
  34. data/lib/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
  35. data/lib/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
  36. data/lib/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
  37. data/lib/cookbooks/database/metadata.rb +22 -0
  38. data/lib/cookbooks/database/recipes/default.rb +20 -0
  39. data/lib/cookbooks/database/recipes/ebs_backup.rb +89 -0
  40. data/lib/cookbooks/database/recipes/ebs_volume.rb +204 -0
  41. data/lib/cookbooks/database/recipes/master.rb +78 -0
  42. data/lib/cookbooks/database/recipes/mysql.rb +20 -0
  43. data/lib/cookbooks/database/recipes/postgresql.rb +20 -0
  44. data/lib/cookbooks/database/recipes/snapshot.rb +62 -0
  45. data/lib/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
  46. data/lib/cookbooks/database/templates/default/aws_config.erb +3 -0
  47. data/lib/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +6 -0
  48. data/lib/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
  49. data/lib/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
  50. data/lib/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
  51. data/lib/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
  52. data/lib/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
  53. data/lib/cookbooks/database/templates/default/s3cfg.erb +27 -0
  54. data/lib/cookbooks/mysql/.gitignore +5 -0
  55. data/lib/cookbooks/mysql/CHANGELOG.md +86 -0
  56. data/lib/cookbooks/mysql/CONTRIBUTING +29 -0
  57. data/lib/cookbooks/mysql/Gemfile +8 -0
  58. data/lib/cookbooks/mysql/LICENSE +201 -0
  59. data/lib/cookbooks/mysql/README.md +227 -0
  60. data/lib/cookbooks/mysql/attributes/client.rb +50 -0
  61. data/lib/cookbooks/mysql/attributes/server.rb +153 -0
  62. data/lib/cookbooks/mysql/files/default/tests/minitest/server_test.rb +36 -0
  63. data/lib/cookbooks/mysql/files/default/tests/minitest/support/helpers.rb +11 -0
  64. data/lib/cookbooks/mysql/libraries/helpers.rb +33 -0
  65. data/lib/cookbooks/mysql/metadata.rb +140 -0
  66. data/lib/cookbooks/mysql/recipes/client.rb +59 -0
  67. data/lib/cookbooks/mysql/recipes/default.rb +20 -0
  68. data/lib/cookbooks/mysql/recipes/ruby.rb +36 -0
  69. data/lib/cookbooks/mysql/recipes/server.rb +216 -0
  70. data/lib/cookbooks/mysql/recipes/server_ec2.rb +51 -0
  71. data/lib/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
  72. data/lib/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
  73. data/lib/cookbooks/mysql/templates/default/my.cnf.erb +211 -0
  74. data/lib/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
  75. data/lib/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
  76. data/lib/cookbooks/mysql/templates/windows/my.cnf.erb +61 -0
  77. data/lib/cookbooks/mysql/test/features/query_database.feature +26 -0
  78. data/lib/cookbooks/mysql/test/features/step_definitions/mysql_steps.rb +47 -0
  79. data/lib/cookbooks/mysql/test/features/support/env.rb +3 -0
  80. data/lib/cookbooks/mysql/test/features/support/mysql_helpers.rb +51 -0
  81. data/lib/cookbooks/mysql/test/kitchen/Kitchenfile +5 -0
  82. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/.gitignore +1 -0
  83. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/README.md +63 -0
  84. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/attributes/default.rb +27 -0
  85. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/metadata.rb +10 -0
  86. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/recipes/client.rb +20 -0
  87. data/lib/cookbooks/mysql/test/kitchen/cookbooks/mysql_test/recipes/server.rb +72 -0
  88. data/lib/cookbooks/openssl/CHANGELOG.md +0 -0
  89. data/lib/cookbooks/openssl/CONTRIBUTING +29 -0
  90. data/lib/cookbooks/openssl/LICENSE +201 -0
  91. data/lib/cookbooks/openssl/README.md +37 -0
  92. data/lib/cookbooks/openssl/libraries/secure_password.rb +37 -0
  93. data/lib/cookbooks/openssl/metadata.rb +8 -0
  94. data/lib/cookbooks/openssl/recipes/default.rb +19 -0
  95. data/lib/cookbooks/postgresql/CHANGELOG.md +35 -0
  96. data/lib/cookbooks/postgresql/CONTRIBUTING +29 -0
  97. data/lib/cookbooks/postgresql/LICENSE +201 -0
  98. data/lib/cookbooks/postgresql/README.md +148 -0
  99. data/lib/cookbooks/postgresql/attributes/default.rb +103 -0
  100. data/lib/cookbooks/postgresql/metadata.rb +21 -0
  101. data/lib/cookbooks/postgresql/recipes/client.rb +26 -0
  102. data/lib/cookbooks/postgresql/recipes/default.rb +20 -0
  103. data/lib/cookbooks/postgresql/recipes/ruby.rb +40 -0
  104. data/lib/cookbooks/postgresql/recipes/server.rb +64 -0
  105. data/lib/cookbooks/postgresql/recipes/server_debian.rb +64 -0
  106. data/lib/cookbooks/postgresql/recipes/server_redhat.rb +77 -0
  107. data/lib/cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +499 -0
  108. data/lib/cookbooks/postgresql/templates/default/pg_hba.conf.erb +83 -0
  109. data/lib/cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +501 -0
  110. data/lib/cookbooks/sqlite/.gitignore +4 -0
  111. data/lib/cookbooks/sqlite/CHANGELOG.md +3 -0
  112. data/lib/cookbooks/sqlite/CONTRIBUTING +29 -0
  113. data/lib/cookbooks/sqlite/Gemfile +2 -0
  114. data/lib/cookbooks/sqlite/LICENSE +201 -0
  115. data/lib/cookbooks/sqlite/README.md +36 -0
  116. data/lib/cookbooks/sqlite/metadata.rb +12 -0
  117. data/lib/cookbooks/sqlite/recipes/default.rb +30 -0
  118. data/lib/cookbooks/sqlite/test/kitchen/Kitchenfile +1 -0
  119. data/lib/cookbooks/xfs/CHANGELOG.md +0 -0
  120. data/lib/cookbooks/xfs/CONTRIBUTING +29 -0
  121. data/lib/cookbooks/xfs/LICENSE +201 -0
  122. data/lib/cookbooks/xfs/README.md +30 -0
  123. data/lib/cookbooks/xfs/metadata.rb +12 -0
  124. data/lib/cookbooks/xfs/recipes/default.rb +26 -0
  125. data/lib/server_maint/version.rb +1 -1
  126. metadata +127 -4
@@ -0,0 +1,119 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/resource'
20
+
21
+ class Chef
22
+ class Resource
23
+ class Database < Chef::Resource
24
+
25
+ def initialize(name, run_context=nil)
26
+ super
27
+ @resource_name = :database
28
+ @database_name = name
29
+ @allowed_actions.push(:create, :drop, :query)
30
+ @action = :create
31
+ end
32
+
33
+ def database_name(arg=nil)
34
+ set_or_return(
35
+ :database_name,
36
+ arg,
37
+ :kind_of => String
38
+ )
39
+ end
40
+
41
+ def connection(arg=nil)
42
+ set_or_return(
43
+ :connection,
44
+ arg,
45
+ :required => true
46
+ )
47
+ end
48
+
49
+ def sql(arg=nil, &block)
50
+ arg ||= block
51
+ set_or_return(
52
+ :sql,
53
+ arg,
54
+ :kind_of => [String, Proc]
55
+ )
56
+ end
57
+
58
+ def sql_query
59
+ if sql.kind_of?(Proc)
60
+ sql.call
61
+ else
62
+ sql
63
+ end
64
+ end
65
+
66
+ def template(arg=nil)
67
+ set_or_return(
68
+ :template,
69
+ arg,
70
+ :kind_of => String,
71
+ :default => 'DEFAULT'
72
+ )
73
+ end
74
+
75
+ def collation(arg=nil)
76
+ set_or_return(
77
+ :collation,
78
+ arg,
79
+ :kind_of => String
80
+ )
81
+ end
82
+
83
+ def encoding(arg=nil)
84
+ set_or_return(
85
+ :encoding,
86
+ arg,
87
+ :kind_of => String,
88
+ :default => 'DEFAULT'
89
+ )
90
+ end
91
+
92
+ def tablespace(arg=nil)
93
+ set_or_return(
94
+ :tablespace,
95
+ arg,
96
+ :kind_of => String,
97
+ :default => 'DEFAULT'
98
+ )
99
+ end
100
+
101
+ def connection_limit(arg=nil)
102
+ set_or_return(
103
+ :connection_limit,
104
+ arg,
105
+ :kind_of => String,
106
+ :default => '-1'
107
+ )
108
+ end
109
+
110
+ def owner(arg=nil)
111
+ set_or_return(
112
+ :owner,
113
+ arg,
114
+ :kind_of => String
115
+ )
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,90 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), 'resource_database')
20
+
21
+ class Chef
22
+ class Resource
23
+ class DatabaseUser < Chef::Resource::Database
24
+
25
+ def initialize(name, run_context=nil)
26
+ super
27
+ @resource_name = :database_user
28
+ @username = name
29
+
30
+ @database_name = nil
31
+ @table = nil
32
+ @host = 'localhost'
33
+ @privileges = [:all]
34
+
35
+ @allowed_actions.push(:create, :drop, :grant)
36
+ @action = :create
37
+ end
38
+
39
+ def database_name(arg=nil)
40
+ set_or_return(
41
+ :database_name,
42
+ arg,
43
+ :kind_of => String
44
+ )
45
+ end
46
+
47
+ def username(arg=nil)
48
+ set_or_return(
49
+ :username,
50
+ arg,
51
+ :kind_of => String
52
+ )
53
+ end
54
+
55
+ def password(arg=nil)
56
+ set_or_return(
57
+ :password,
58
+ arg,
59
+ :kind_of => String,
60
+ :required => true
61
+ )
62
+ end
63
+
64
+ def table(arg=nil)
65
+ set_or_return(
66
+ :table,
67
+ arg,
68
+ :kind_of => String
69
+ )
70
+ end
71
+
72
+ def host(arg=nil)
73
+ set_or_return(
74
+ :host,
75
+ arg,
76
+ :kind_of => String
77
+ )
78
+ end
79
+
80
+ def privileges(arg=nil)
81
+ set_or_return(
82
+ :privileges,
83
+ arg,
84
+ :kind_of => Array
85
+ )
86
+ end
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), 'resource_database')
20
+ require File.join(File.dirname(__FILE__), 'provider_database_mysql')
21
+
22
+ class Chef
23
+ class Resource
24
+ class MysqlDatabase < Chef::Resource::Database
25
+
26
+ def initialize(name, run_context=nil)
27
+ super
28
+ @resource_name = :mysql_database
29
+ @provider = Chef::Provider::Database::Mysql
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), 'resource_database_user')
20
+ require File.join(File.dirname(__FILE__), 'provider_database_mysql_user')
21
+
22
+ class Chef
23
+ class Resource
24
+ class MysqlDatabaseUser < Chef::Resource::DatabaseUser
25
+
26
+ def initialize(name, run_context=nil)
27
+ super
28
+ @resource_name = :mysql_database_user
29
+ @provider = Chef::Provider::Database::MysqlUser
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Author:: Lamont Granquist (<lamont@opscode.com>)
4
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
5
+ # License:: Apache License, Version 2.0
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ require File.join(File.dirname(__FILE__), 'resource_database')
21
+ require File.join(File.dirname(__FILE__), 'provider_database_postgresql')
22
+
23
+ class Chef
24
+ class Resource
25
+ class PostgresqlDatabase < Chef::Resource::Database
26
+
27
+ def initialize(name, run_context=nil)
28
+ super
29
+ @resource_name = :postgresql_database
30
+ @provider = Chef::Provider::Database::Postgresql
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Author:: Lamont Granquist (<lamont@opscode.com>)
4
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
5
+ # License:: Apache License, Version 2.0
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ require File.join(File.dirname(__FILE__), 'resource_database_user')
21
+ require File.join(File.dirname(__FILE__), 'provider_database_postgresql_user')
22
+
23
+ class Chef
24
+ class Resource
25
+ class PostgresqlDatabaseUser < Chef::Resource::DatabaseUser
26
+
27
+ def initialize(name, run_context=nil)
28
+ super
29
+ @resource_name = :postgresql_database_user
30
+ @provider = Chef::Provider::Database::PostgresqlUser
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), 'resource_database')
20
+ require File.join(File.dirname(__FILE__), 'provider_database_sql_server')
21
+
22
+ class Chef
23
+ class Resource
24
+ class SqlServerDatabase < Chef::Resource::Database
25
+
26
+ def initialize(name, run_context=nil)
27
+ super
28
+ @resource_name = :sql_server_database
29
+ @provider = Chef::Provider::Database::SqlServer
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require File.join(File.dirname(__FILE__), 'resource_database_user')
20
+ require File.join(File.dirname(__FILE__), 'provider_database_sql_server_user')
21
+
22
+ class Chef
23
+ class Resource
24
+ class SqlServerDatabaseUser < Chef::Resource::DatabaseUser
25
+
26
+ def initialize(name, run_context=nil)
27
+ super
28
+ @resource_name = :sql_server_database_user
29
+ @provider = Chef::Provider::Database::SqlServerUser
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,22 @@
1
+ name "database"
2
+ maintainer "Opscode, Inc."
3
+ maintainer_email "cookbooks@opscode.com"
4
+ license "Apache 2.0"
5
+ description "Sets up the database master or slave"
6
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
+ version "1.3.6"
8
+
9
+ recipe "database", "Empty placeholder"
10
+ recipe "database::ebs_backup", "Considered deprecated, older way of backing up EBS volumes"
11
+ recipe "database::ebs_volume", "Sets up an EBS volume in EC2 for the database"
12
+ recipe "database::master", "Creates application specific user and database"
13
+ recipe "database::snapshot", "Locks tables and freezes XFS filesystem for replication, assumes EC2 + EBS"
14
+
15
+ depends "mysql", ">= 1.3.0"
16
+ depends "postgresql", ">= 1.0.0"
17
+ depends "aws"
18
+ depends "xfs"
19
+
20
+ %w{ debian ubuntu centos suse fedora redhat scientific amazon }.each do |os|
21
+ supports os
22
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Cookbook Name:: database
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2009, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
@@ -0,0 +1,89 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Cookbook Name:: database
4
+ # Recipe:: ebs_backup
5
+ #
6
+ # Copyright 2009, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ begin
22
+ aws = Chef::DataBagItem.load('aws', 'main')
23
+ Chef::Log.info("Loaded AWS information from DataBagItem aws[#{aws['id']}]")
24
+ rescue
25
+ Chef::Log.fatal("Could not find the 'main' item in the 'aws' data bag")
26
+ raise
27
+ end
28
+
29
+ db_role = String.new
30
+ db_master_role = String.new
31
+ db_type = node[:database][:type]
32
+
33
+ search(:apps) do |app|
34
+ db_role = app["database_#{db_type}_role"] & node.run_list.roles
35
+ db_master_role = app["database_master_role"]
36
+ end
37
+
38
+ ebs_info = Chef::DataBagItem.load(:aws, "ebs_#{db_master_role}_#{node.chef_environment}")
39
+
40
+ gem_package "dbi"
41
+ gem_package "dbd-mysql"
42
+
43
+ directory "/mnt/aws-config" do
44
+ mode 0700
45
+ owner "root"
46
+ group "root"
47
+ end
48
+
49
+ template "/mnt/aws-config/config" do
50
+ source "aws_config.erb"
51
+ variables(
52
+ :access_key => aws['aws_access_key_id'],
53
+ :secret_key => aws['aws_secret_access_key']
54
+ )
55
+ owner "root"
56
+ group "root"
57
+ mode 0600
58
+ end
59
+
60
+ git "/opt/ec2_mysql" do
61
+ repository "git://github.com/jtimberman/ec2_mysql.git"
62
+ reference "HEAD"
63
+ action :sync
64
+ not_if { ::FileTest.directory?("/opt/ec2_mysql/.git") }
65
+ end
66
+
67
+ %w{backup restore}.each do |file|
68
+ template "/usr/local/bin/db-#{file}.sh" do
69
+ source "ebs-db-#{file}.sh.erb"
70
+ owner "root"
71
+ group "root"
72
+ mode 0700
73
+ variables(
74
+ :mysql_root_passwd => node['mysql']['server_root_password'],
75
+ :mysql_device => node['mysql']['ebs_vol_dev'],
76
+ :ebs_vol_id => ebs_info['volume_id']
77
+ )
78
+ end
79
+ end
80
+
81
+ if db_type == "master" && node.chef_environment == "production"
82
+ template "/etc/cron.d/db-backup" do
83
+ source "ebs-backup-cron.erb"
84
+ owner "root"
85
+ group "root"
86
+ mode 0644
87
+ backup false
88
+ end
89
+ end