default.rb
3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# Author:: Earth U (<sysadmin@chromedia.com>)
# Cookbook Name:: cfe-mariadb
# Attributes:: default
#
# Copyright 2016, Chromedia Far East, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
## The 'db_map' should contain this format:
# default['cfe-mariadb']['db_map'] = {
# 'example_db_name' => {
# :db_user => 'example_db_username',
# :db_pass => 'example_db_password',
# :bak_filename => 'example_db_name.sql',
# :bak_maxcopies => 30
## Optional:
# :char_set => 'latin1',
# :collate => 'latin1_swedish_ci'
# }
# }
default['cfe-mariadb']['db_map'] = {
'example_db' => {
:db_user => 'example_user',
:db_pass => 'secret',
:bak_filename => 'example_db.sql',
:bak_maxcopies => 30
}
}
# Make sure to set replication on only when necessary
default['cfe-mariadb']['replication'] = false
default['cfe-mariadb']['backup']['s3_region'] = 'us-east-1'
default['cfe-mariadb']['backup']['s3_bucket'] = 'example-bucket'
if node['platform'] == 'ubuntu' and node['platform_version'].to_f == 14.04
default['cfe-mariadb']['backup']['aws_bin'] = '/usr/local/bin/aws'
default['cfe-mariadb']['backup']['mysqldump_bin'] = '/usr/bin/mysqldump'
else
# Haven't tested on other platforms yet, so same as above for now.
default['cfe-mariadb']['backup']['aws_bin'] = '/usr/local/bin/aws'
default['cfe-mariadb']['backup']['mysqldump_bin'] = '/usr/bin/mysqldump'
end
# Path to directory where the backup script should be placed
default['cfe-mariadb']['backup']['script_dir'] = ::File.join(
node['mariadb']['configuration']['path'], 'scripts'
)
default['cfe-mariadb']['backup']['cron']['min'] = '0'
default['cfe-mariadb']['backup']['cron']['hour'] = '0'
default['cfe-mariadb']['backup']['cron']['day'] = '*'
default['cfe-mariadb']['backup']['cron']['mon'] = '*'
default['cfe-mariadb']['backup']['cron']['wday'] = '*'
default['cfe-mariadb']['backup']['cron']['mailto'] = "''" # Empty single quotes
# Basic options for logrotate
default['cfe-mariadb']['backup']['logrotate']['conf_dir'] = '/etc/logrotate.d'
default['cfe-mariadb']['backup']['logrotate']['options'] = [
'weekly', 'rotate 12', 'missingok', 'compress', 'notifempty'
]
default['mariadb']['server_root_password'] = 'secretpassword'
default['mariadb']['mysqld']['bind_address'] = '127.0.0.1'
default['mariadb']['mysqld']['port'] = '3306'
default['mariadb']['install']['type'] = 'package'
default['mariadb']['install']['version'] = '5.5'
default['mariadb']['forbid_remote_root'] = true
# io_capacity has to be roughly the IO capacity of the EC2 instance.
# buffer_pool_size can be increased to 75% (0.75) of RAM if dedicated server.
default['mariadb']['innodb']['io_capacity'] = '30'
default['mariadb']['innodb']['buffer_pool_size'] =
( %x(free -m).split(' ')[7].to_i * 0.5 ).round.to_s
## Tip:
## For encrypted attributes like passwords,
## the following is possible in the attributes file:
##
# secret = Chef::EncryptedDataBagItem.load(
# my_data_bag, my_secret_data_bag_item
# )
# default['cfe-mariadb']['some_prop'] = secret['db_password']