forked from astrails/safe
/
script.rb
155 lines (132 loc) · 4.8 KB
/
script.rb
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
safe do
# backup file path (not including filename)
# supported substitutions:
# :kind -> backup 'engine' kind, e.g. "mysqldump" or "archive"
# :id -> backup 'id', e.g. "blog", "production", etc.
# :timestamp -> current run timestamp (same for all the backups in the same 'run')
# you can set separate :path for all backups (or once globally here)
local do
path "/backup/:kind"
end
## uncomment to enable uploads to Amazon S3
## Amazon S3 auth (optional)
## don't forget to add :s3 to the 'store' list
# s3 do
# key YOUR_S3_KEY
# secret YOUR_S3_SECRET
# bucket S3_BUCKET
# # path for uploads to S3. supports same substitution like :local/:path
# path ":kind/" # this is default
# end
## alternative style:
# s3 :key => YOUR_S3_KEY, :secret => YOUR_S3_SECRET, :bucket => S3_BUCKET, :path => ":kind/"
## uncomment to enable uploads to Rackspace Cloud Files
## http://www.rackspacecloud.com/cloud_hosting_products/files
## Rackspace auth (optional)
# cloudfiles do
# user "YOUR_RACKSPACE_CLOUD_USERNAME"
# api_key "YOUR_RACKSPACE_API_KEY"
# container "YOUR_CONTAINER_NAME"
# # path for uploads to Cloud Files, supports same substitution like :local/:path
# path ":kind/" # this is default
# # If you are running the backup from a system within the Rackspace/Slicehost network and would like
# # to back up over the private (unbilled) service net, set this value to true.
# # service_net true
# end
## uncomment to enable uploads via SFTP
# sftp do
# host "YOUR_REMOTE_HOSTNAME"
# user "YOUR_REMOTE_USERNAME"
# # port "NON STANDARD SSH PORT"
# password "YOUR_REMOTE_PASSWORD"
# path ":kind/:id" # this is the default
# end
## uncomment to enable GPG encryption.
## Note: you can use public 'key' or symmetric password but not both!
# gpg do
# # key "backup@astrails.com"
# password "astrails"
# end
## uncomment to enable backup rotation. keep only given number of latest
## backups. remove the rest
# keep do
# local 4 # keep 4 local backups
# s3 20 # keep 20 S3 backups
# end
# backup mysql databases with mysqldump
mysqldump do
# you can override any setting from parent in a child:
options "-ceKq --single-transaction --create-options"
user "astrails"
password ""
# host "localhost"
# port 3306
socket "/var/run/mysqld/mysqld.sock"
# database is a 'collection' element. it must have a hash or block parameter
# it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
# the following code will create mysqldump/databases/blog and mysqldump/databases/mysql ocnfiguration 'nodes'
# backup database with default values
# database :blog
# backup overriding some values
# database :production do
# # you can override 'partially'
# keep :local => 3
# # keep/local is 3, and keep/s3 is 20 (from parent)
# # local override for gpg password
# gpg do
# password "custom-production-pass"
# end
# # skip those tables during backup
# # you can pass an array
# skip_tables [:logger_exceptions, :request_logs]
# # or pass them all separately
# skip_tables :test1
# skip_tables :test2
# end
end
# # uncomment to enable
# # backup PostgreSQL databases with pg_dump
# pgdump do
# options "-i -x -O"
#
# user "markmansour"
# # password "" - leave this out if you have ident setup
#
# # database is a 'collection' element. it must have a hash or block parameter
# # it will be 'collected' in a 'databases', with database id (1st arg) used as hash key
# database :blog
# database :production
# end
tar do
# options "-h" # uncomment this to dereference symbolic links
# 'archive' is a collection item, just like 'database'
# archive "git-repositories" do
# # files and directories to backup
# files "/home/git/repositories"
# # can have more then one 'files' lines or/and use an array
# files ["/home/dev/work/foo", "/home/dev/work/bar"]
# end
# archive "etc-files" do
# files "/etc"
# # exlude those files/directories
# exclude "/etc/puppet/other"
# # can have multiple 'exclude' lines or/and use an array
# exclude ["/etc/tmp/a", "/etc/tmp/b"]
# end
# archive "dot-configs" do
# files "/home/*/.[^.]*"
# end
# archive "blog" do
# files "/var/www/blog.astrails.com/"
# # specify multiple files/directories as array
# exclude ["/var/www/blog.astrails.com/log", "/var/www/blog.astrails.com/tmp"]
# end
# archive "site" do
# files "/var/www/astrails.com/"
# exclude ["/var/www/astrails.com/log", "/var/www/astrails.com/tmp"]
# end
# archive :misc do
# files [ "/backup/*.rb" ]
# end
end
end