synco 1.2.0 → 1.3.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/synco +2 -1
- data/lib/synco/command/disk.rb +6 -21
- data/lib/synco/command/prune.rb +9 -24
- data/lib/synco/command/rotate.rb +46 -61
- data/lib/synco/command/spawn.rb +10 -25
- data/lib/synco/command.rb +20 -33
- data/lib/synco/controller.rb +4 -19
- data/lib/synco/directory.rb +8 -23
- data/lib/synco/disk.rb +4 -19
- data/lib/synco/method.rb +11 -26
- data/lib/synco/methods/rsync.rb +14 -29
- data/lib/synco/methods/scp.rb +8 -23
- data/lib/synco/methods/zfs.rb +7 -22
- data/lib/synco/scope.rb +32 -58
- data/lib/synco/script.rb +15 -30
- data/lib/synco/server.rb +9 -24
- data/lib/synco/shell.rb +5 -20
- data/lib/synco/shells/ssh.rb +10 -25
- data/lib/synco/version.rb +5 -20
- data/lib/synco.rb +13 -29
- data/license.md +21 -0
- data/readme.md +39 -0
- data.tar.gz.sig +0 -0
- metadata +64 -118
- metadata.gz.sig +4 -0
- data/.github/workflows/development.yml +0 -40
- data/.gitignore +0 -22
- data/.rspec +0 -4
- data/Gemfile +0 -8
- data/README.md +0 -264
- data/Rakefile +0 -6
- data/spec/spec_helper.rb +0 -34
- data/spec/synco/backup_script.rb +0 -63
- data/spec/synco/directory_spec.rb +0 -33
- data/spec/synco/local_backup.rb +0 -56
- data/spec/synco/local_sync.rb +0 -91
- data/spec/synco/method_spec.rb +0 -62
- data/spec/synco/rsync_spec.rb +0 -89
- data/spec/synco/scp_spec.rb +0 -58
- data/spec/synco/script_spec.rb +0 -51
- data/spec/synco/shell_spec.rb +0 -40
- data/spec/synco/usb_spec.rb +0 -76
- data/spec/synco/zfs_spec.rb +0 -50
- data/synco.gemspec +0 -31
metadata
CHANGED
|
@@ -1,57 +1,86 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: synco
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
|
|
10
|
+
cert_chain:
|
|
11
|
+
- |
|
|
12
|
+
-----BEGIN CERTIFICATE-----
|
|
13
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
|
14
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
|
15
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
|
16
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
|
17
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
|
18
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
|
19
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
|
20
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
|
21
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
|
22
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
|
23
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
|
24
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
|
25
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
|
26
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
|
27
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
|
28
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
|
29
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
|
30
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
|
31
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
|
32
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
|
33
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
|
34
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
|
35
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
|
36
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
|
37
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
38
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
39
|
+
-----END CERTIFICATE-----
|
|
40
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
|
12
41
|
dependencies:
|
|
13
42
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
43
|
+
name: build-files
|
|
15
44
|
requirement: !ruby/object:Gem::Requirement
|
|
16
45
|
requirements:
|
|
17
46
|
- - "~>"
|
|
18
47
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
48
|
+
version: '1.0'
|
|
20
49
|
type: :runtime
|
|
21
50
|
prerelease: false
|
|
22
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
52
|
requirements:
|
|
24
53
|
- - "~>"
|
|
25
54
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
55
|
+
version: '1.0'
|
|
27
56
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
57
|
+
name: fingerprint
|
|
29
58
|
requirement: !ruby/object:Gem::Requirement
|
|
30
59
|
requirements:
|
|
31
60
|
- - "~>"
|
|
32
61
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
62
|
+
version: '3.0'
|
|
34
63
|
type: :runtime
|
|
35
64
|
prerelease: false
|
|
36
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
66
|
requirements:
|
|
38
67
|
- - "~>"
|
|
39
68
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
69
|
+
version: '3.0'
|
|
41
70
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
71
|
+
name: lockfile
|
|
43
72
|
requirement: !ruby/object:Gem::Requirement
|
|
44
73
|
requirements:
|
|
45
|
-
- - "
|
|
74
|
+
- - ">="
|
|
46
75
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
76
|
+
version: '0'
|
|
48
77
|
type: :runtime
|
|
49
78
|
prerelease: false
|
|
50
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
80
|
requirements:
|
|
52
|
-
- - "
|
|
81
|
+
- - ">="
|
|
53
82
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
83
|
+
version: '0'
|
|
55
84
|
- !ruby/object:Gem::Dependency
|
|
56
85
|
name: mapping
|
|
57
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,19 +96,19 @@ dependencies:
|
|
|
67
96
|
- !ruby/object:Gem::Version
|
|
68
97
|
version: '1.0'
|
|
69
98
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
99
|
+
name: periodical
|
|
71
100
|
requirement: !ruby/object:Gem::Requirement
|
|
72
101
|
requirements:
|
|
73
102
|
- - "~>"
|
|
74
103
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1.
|
|
104
|
+
version: '1.1'
|
|
76
105
|
type: :runtime
|
|
77
106
|
prerelease: false
|
|
78
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
108
|
requirements:
|
|
80
109
|
- - "~>"
|
|
81
110
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '1.
|
|
111
|
+
version: '1.1'
|
|
83
112
|
- !ruby/object:Gem::Dependency
|
|
84
113
|
name: process-group
|
|
85
114
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -95,89 +124,26 @@ dependencies:
|
|
|
95
124
|
- !ruby/object:Gem::Version
|
|
96
125
|
version: '1.1'
|
|
97
126
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - ">="
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0'
|
|
104
|
-
type: :runtime
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - ">="
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: covered
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: bundler
|
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
|
128
|
-
requirements:
|
|
129
|
-
- - ">="
|
|
130
|
-
- !ruby/object:Gem::Version
|
|
131
|
-
version: '0'
|
|
132
|
-
type: :development
|
|
133
|
-
prerelease: false
|
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
-
requirements:
|
|
136
|
-
- - ">="
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
version: '0'
|
|
139
|
-
- !ruby/object:Gem::Dependency
|
|
140
|
-
name: rspec
|
|
127
|
+
name: samovar
|
|
141
128
|
requirement: !ruby/object:Gem::Requirement
|
|
142
129
|
requirements:
|
|
143
130
|
- - "~>"
|
|
144
131
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '
|
|
146
|
-
type: :
|
|
132
|
+
version: '2.0'
|
|
133
|
+
type: :runtime
|
|
147
134
|
prerelease: false
|
|
148
135
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
136
|
requirements:
|
|
150
137
|
- - "~>"
|
|
151
138
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '
|
|
153
|
-
|
|
154
|
-
name: rake
|
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
|
156
|
-
requirements:
|
|
157
|
-
- - ">="
|
|
158
|
-
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0'
|
|
160
|
-
type: :development
|
|
161
|
-
prerelease: false
|
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
-
requirements:
|
|
164
|
-
- - ">="
|
|
165
|
-
- !ruby/object:Gem::Version
|
|
166
|
-
version: '0'
|
|
167
|
-
description:
|
|
139
|
+
version: '2.0'
|
|
140
|
+
description:
|
|
168
141
|
email:
|
|
169
|
-
- samuel.williams@oriontransfer.co.nz
|
|
170
142
|
executables:
|
|
171
143
|
- synco
|
|
172
144
|
extensions: []
|
|
173
145
|
extra_rdoc_files: []
|
|
174
146
|
files:
|
|
175
|
-
- ".github/workflows/development.yml"
|
|
176
|
-
- ".gitignore"
|
|
177
|
-
- ".rspec"
|
|
178
|
-
- Gemfile
|
|
179
|
-
- README.md
|
|
180
|
-
- Rakefile
|
|
181
147
|
- bin/synco
|
|
182
148
|
- lib/synco.rb
|
|
183
149
|
- lib/synco/command.rb
|
|
@@ -198,24 +164,16 @@ files:
|
|
|
198
164
|
- lib/synco/shell.rb
|
|
199
165
|
- lib/synco/shells/ssh.rb
|
|
200
166
|
- lib/synco/version.rb
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
- spec/synco/local_backup.rb
|
|
205
|
-
- spec/synco/local_sync.rb
|
|
206
|
-
- spec/synco/method_spec.rb
|
|
207
|
-
- spec/synco/rsync_spec.rb
|
|
208
|
-
- spec/synco/scp_spec.rb
|
|
209
|
-
- spec/synco/script_spec.rb
|
|
210
|
-
- spec/synco/shell_spec.rb
|
|
211
|
-
- spec/synco/usb_spec.rb
|
|
212
|
-
- spec/synco/zfs_spec.rb
|
|
213
|
-
- synco.gemspec
|
|
214
|
-
homepage: ''
|
|
167
|
+
- license.md
|
|
168
|
+
- readme.md
|
|
169
|
+
homepage: https://github.com/ioquatix/synco
|
|
215
170
|
licenses:
|
|
216
171
|
- MIT
|
|
217
|
-
metadata:
|
|
218
|
-
|
|
172
|
+
metadata:
|
|
173
|
+
documentation_uri: https://ioquatix.github.io/synco/
|
|
174
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
|
175
|
+
source_code_uri: https://github.com/ioquatix/synco.git
|
|
176
|
+
post_install_message:
|
|
219
177
|
rdoc_options: []
|
|
220
178
|
require_paths:
|
|
221
179
|
- lib
|
|
@@ -223,27 +181,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
223
181
|
requirements:
|
|
224
182
|
- - ">="
|
|
225
183
|
- !ruby/object:Gem::Version
|
|
226
|
-
version: '
|
|
184
|
+
version: '3.1'
|
|
227
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
186
|
requirements:
|
|
229
187
|
- - ">="
|
|
230
188
|
- !ruby/object:Gem::Version
|
|
231
189
|
version: '0'
|
|
232
190
|
requirements: []
|
|
233
|
-
rubygems_version: 3.
|
|
234
|
-
signing_key:
|
|
191
|
+
rubygems_version: 3.5.11
|
|
192
|
+
signing_key:
|
|
235
193
|
specification_version: 4
|
|
236
194
|
summary: Synco is a tool for scripted synchronization and backups.
|
|
237
|
-
test_files:
|
|
238
|
-
- spec/spec_helper.rb
|
|
239
|
-
- spec/synco/backup_script.rb
|
|
240
|
-
- spec/synco/directory_spec.rb
|
|
241
|
-
- spec/synco/local_backup.rb
|
|
242
|
-
- spec/synco/local_sync.rb
|
|
243
|
-
- spec/synco/method_spec.rb
|
|
244
|
-
- spec/synco/rsync_spec.rb
|
|
245
|
-
- spec/synco/scp_spec.rb
|
|
246
|
-
- spec/synco/script_spec.rb
|
|
247
|
-
- spec/synco/shell_spec.rb
|
|
248
|
-
- spec/synco/usb_spec.rb
|
|
249
|
-
- spec/synco/zfs_spec.rb
|
|
195
|
+
test_files: []
|
metadata.gz.sig
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
z$P�4�������d)��J�K�7}t�X�I<^d�GdƮ�"�$,���:=��5���9طW��TJ�%iI���d�CbB0XT�U��0^��6N�2K��l��?�&y��a:q�!L}��!����A:��4�����h���粊��;�[�x�U�z��������[��z�4mQȚ����}Xi�����_�x��B�uf���� -5��6�
|
|
2
|
+
���@�#�o�D*
|
|
3
|
+
��@1�Ke��;!+��_�1�W4���*�z8����CDYlk`<nQ������f�}��@By?c�I��.�!MMP9�1^O"���"��i,x5/�,^�b����WG�mK��A�������y
|
|
4
|
+
��E��x������B�z:�T
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: Development
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
strategy:
|
|
8
|
-
fail-fast: false
|
|
9
|
-
matrix:
|
|
10
|
-
os: [ubuntu-latest, macos-latest]
|
|
11
|
-
ruby: [2.3, 2.4, 2.5, 2.6, 2.7]
|
|
12
|
-
runs-on: ${{matrix.os}}
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
|
|
16
|
-
- uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: ${{matrix.ruby}}
|
|
19
|
-
|
|
20
|
-
- uses: actions/cache@v1
|
|
21
|
-
with:
|
|
22
|
-
path: vendor/bundle
|
|
23
|
-
key: bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-${{hashFiles('**/Gemfile')}}
|
|
24
|
-
restore-keys: |
|
|
25
|
-
bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-
|
|
26
|
-
|
|
27
|
-
- name: Installing packages (ubuntu)
|
|
28
|
-
if: matrix.os == 'ubuntu-latest'
|
|
29
|
-
run: sudo apt-get install rsync
|
|
30
|
-
|
|
31
|
-
- name: Installing packages (macos)
|
|
32
|
-
if: matrix.os == 'macos-latest'
|
|
33
|
-
run: brew install rsync
|
|
34
|
-
|
|
35
|
-
- name: Bundle install...
|
|
36
|
-
run: |
|
|
37
|
-
bundle config path vendor/bundle
|
|
38
|
-
bundle install
|
|
39
|
-
|
|
40
|
-
- run: bundle exec rake
|
data/.gitignore
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
*.bundle
|
|
19
|
-
*.so
|
|
20
|
-
*.o
|
|
21
|
-
*.a
|
|
22
|
-
mkmf.log
|
data/.rspec
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
# Synco 
|
|
2
|
-
|
|
3
|
-
Synco is a tool for scripted synchronization and backups. It provides a custom Ruby DSL for describing backup and synchronization tasks involving one more more system and disk. It is designed to provide flexibility while reducing the complexity multi-server backups.
|
|
4
|
-
|
|
5
|
-
* Single and multi-server data synchronization.
|
|
6
|
-
* Incremental backups both locally and remotely.
|
|
7
|
-
* Backup staging and coordination.
|
|
8
|
-
* Backup verification using [Fingerprint](https://github.com/ioquatix/fingerprint).
|
|
9
|
-
* Data backup redundancy controlled via DNS.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
Add this line to your application's Gemfile:
|
|
14
|
-
|
|
15
|
-
gem 'synco'
|
|
16
|
-
|
|
17
|
-
And then execute:
|
|
18
|
-
|
|
19
|
-
$ bundle
|
|
20
|
-
|
|
21
|
-
Or install it yourself as:
|
|
22
|
-
|
|
23
|
-
$ gem install synco
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
Synco imposes a particular structure regarding the organisation of backup scripts: Backup scripts involve a set of servers and directories. A server is a logical unit where files are available or stored. Directories are relative paths which are resolved relative to a server's root path.
|
|
28
|
-
|
|
29
|
-
A simple backup script might look something like this:
|
|
30
|
-
|
|
31
|
-
```ruby
|
|
32
|
-
#!/usr/bin/env ruby
|
|
33
|
-
|
|
34
|
-
require 'synco'
|
|
35
|
-
require 'synco/methods/rsync'
|
|
36
|
-
|
|
37
|
-
Synco::run_script do |script|
|
|
38
|
-
script.method = Synco::Methods::RSync.new(archive: true)
|
|
39
|
-
|
|
40
|
-
server(:master) do |server|
|
|
41
|
-
server.host = "server.example.com"
|
|
42
|
-
server.root = "/"
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
server(:backup) do |server|
|
|
46
|
-
server.host = "backup.example.com"
|
|
47
|
-
server.root = "/tank/backups/server.example.com"
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
backup('etc', 'var', 'srv', 'home',
|
|
51
|
-
arguments: %W{--exclude cache/ --exclude tmp/}
|
|
52
|
-
)
|
|
53
|
-
end
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This will produce an identical copy using rsync of the specified directories. As an example `server.example.com:/etc` would be copied to `backup.example.com:/tank/backups/server.example.com/etc`.
|
|
57
|
-
|
|
58
|
-
### RSync Snapshots
|
|
59
|
-
|
|
60
|
-
Building on the above backup, you can use `Synco::Methods::RSyncSnapshot` which supports snapshot based backups. It creates a snapshot into a sub-directory called `latest.snapshot` and uses RSync's `--link-dest` to hard-link files when unchanged. Synco provides scripts to rotate and prune these backups as required, but you must invoke them as part of the script:
|
|
61
|
-
|
|
62
|
-
```ruby
|
|
63
|
-
server(:backup) do |server|
|
|
64
|
-
server.host = "backup.example.com"
|
|
65
|
-
server.root = "/"
|
|
66
|
-
|
|
67
|
-
server.on(:success) do
|
|
68
|
-
run "synco", "rotate", chdir: target_server.root
|
|
69
|
-
run "synco", "prune", chdir: target_server.root
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
These commands can also be run from the command line.
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
rotate [--format <name>] [--latest <name>] [--snapshot <name>]
|
|
78
|
-
Rotate a backup snapshot into a timestamped directory.
|
|
79
|
-
|
|
80
|
-
[--format <name>] Set the name of the backup rotations, including strftime expansions. Default: %Y.%m.%d-%H.%M.%S
|
|
81
|
-
[--latest <name>] The name of the latest backup symlink. Default: latest
|
|
82
|
-
[--snapshot <name>] The name of the in-progress backup snapshot. Default: latest.snapshot
|
|
83
|
-
|
|
84
|
-
prune [--hourly <count>] [--daily <count>] [--weekly <count>] [--monthly <count>] [--quarterly <count>] [--yearly <count>] [--format <name>] [--latest <name>] [--keep <new|old>] [--dry]
|
|
85
|
-
Prune old backups to reduce disk usage according to a given policy.
|
|
86
|
-
|
|
87
|
-
[--hourly <count>] Set the number of hourly backups to keep. Default: 24
|
|
88
|
-
[--daily <count>] Set the number of daily backups to keep. Default: 28
|
|
89
|
-
[--weekly <count>] Set the number of weekly backups to keep. Default: 52
|
|
90
|
-
[--monthly <count>] Set the number of monthly backups to keep. Default: 36
|
|
91
|
-
[--quarterly <count>] Set the number of quaterly backups to keep. Default: 40
|
|
92
|
-
[--yearly <count>] Set the number of yearly backups to keep. Default: 20
|
|
93
|
-
[--format <name>] Set the name of the backup rotations, including strftime expansions. Default: %Y.%m.%d-%H.%M.%S
|
|
94
|
-
[--latest <name>] The name of the latest backup symlink. Default: latest
|
|
95
|
-
[--keep <new|old>] Keep the younger or older backups within the same period division Default: old
|
|
96
|
-
[--dry] Print out what would be done rather than doing it.
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Mounting Disks
|
|
100
|
-
|
|
101
|
-
Synco supports mounting disks before the backup begins and unmounting them after done. The specifics of this process may require some adjustment based on your OS. For example on linux, `sudo` is used to invoke `mount` and `umount`.
|
|
102
|
-
|
|
103
|
-
```ruby
|
|
104
|
-
server(:destination) do |server|
|
|
105
|
-
self.mountpoint = '/mnt/backups'
|
|
106
|
-
self.root = File.join(server.mountpoint, 'laptop')
|
|
107
|
-
|
|
108
|
-
server.on(:prepare) do
|
|
109
|
-
# synco mount uses labels, e.g. the disk partition has LABEL=backups
|
|
110
|
-
target_server.run "synco", "mount", target_server.mountpoint, 'backups'
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
server.on(:finish) do
|
|
114
|
-
target_server.run "synco", "unmount", target_server.mountpoint
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
On Linux, you might want to create the file `/etc/sudoers.d/synco` with the following contents:
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
%wheel ALL=(root) NOPASSWD: /bin/mount
|
|
123
|
-
%wheel ALL=(root) NOPASSWD: /bin/umount
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Please make sure you take the time to educate yourself on the security of such a setup.
|
|
127
|
-
|
|
128
|
-
### Database Backups
|
|
129
|
-
|
|
130
|
-
If you'd like to dump data before running the backup, it's possible using the event handling mechanisms:
|
|
131
|
-
|
|
132
|
-
```ruby
|
|
133
|
-
server(:master) do |server|
|
|
134
|
-
server.host = "server.example.com"
|
|
135
|
-
server.root = "/"
|
|
136
|
-
|
|
137
|
-
server.on(:prepare) do
|
|
138
|
-
# Dump MySQL to /srv/mysql
|
|
139
|
-
run '/etc/lsync/mysql-backup.sh'
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
The exact contents of `mysql-backup.sh` will depend on your requirements, but here is an example:
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
#!/usr/bin/env bash
|
|
148
|
-
|
|
149
|
-
BACKUP_DIR=/srv/mysql
|
|
150
|
-
MYSQL=/usr/bin/mysql
|
|
151
|
-
MYSQLDUMP=/usr/bin/mysqldump
|
|
152
|
-
|
|
153
|
-
databases=`mysql --user=backup -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|_test|_restore)"`
|
|
154
|
-
|
|
155
|
-
# http://stackoverflow.com/questions/451404/how-to-obtain-a-correct-dump-using-mysqldump-and-single-transaction-when-ddl-is
|
|
156
|
-
MYSQLDUMP_OPTIONS="--force --skip-opt --single-transaction --add-drop-table --create-options --quick --extended-insert --set-charset --disable-keys"
|
|
157
|
-
|
|
158
|
-
for db in $databases; do
|
|
159
|
-
echo "Dumping database $db to $BACKUP_DIR/$db.sql.xz..."
|
|
160
|
-
mysqldump --user=backup $MYSQLDUMP_OPTIONS --databases $db | xz > "$BACKUP_DIR/$db.sql.xz"
|
|
161
|
-
done
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### Fingerprint Integration
|
|
165
|
-
|
|
166
|
-
It is possible to make a [cryptographic checksum of the data](https://github.com/ioquatix/fingerprint). On a filesystem that support immutable snapshots, you can do this before the data is copied. For traditional filesystems, you generally need to do this afterwards.
|
|
167
|
-
|
|
168
|
-
```ruby
|
|
169
|
-
server(:master) do |server|
|
|
170
|
-
server.host = "server.example.com"
|
|
171
|
-
server.root = "/"
|
|
172
|
-
|
|
173
|
-
server.on(:success) do
|
|
174
|
-
# Run fingerprint on the backup data:
|
|
175
|
-
run 'fingerprint', '--root', target_server.root, 'analyze'
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Fingerprint is used in many of the specs to verify file copies.
|
|
181
|
-
|
|
182
|
-
### ZFS Snapshots
|
|
183
|
-
|
|
184
|
-
*This part of Synco is still under heavy development*
|
|
185
|
-
|
|
186
|
-
Synco can manage synchronization and backups of ZFS partitions. However, to use the standard tools, it is necessary to enable `zfs_admin_snapshot`, in `/etc/modprobe.d/zfs.conf`:
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
options zfs zfs_admin_snapshot=1
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Propagate user permissions for the ZFS partition:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
sudo zfs allow -ld -u `whoami` create,mount,send,receive,snapshot tank/test
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Backup staging
|
|
199
|
-
|
|
200
|
-
Synco in a previous life supported backup staging. However, at this time it's not available except in a very limited form: backup scripts which use `Synco.run_script` use explicit locking so that it's not possible to run the same backup at the same time. In the future, staging sequential and parallel backups will be added.
|
|
201
|
-
|
|
202
|
-
### DNS Failover
|
|
203
|
-
|
|
204
|
-
**This behaviour is not well tested**
|
|
205
|
-
|
|
206
|
-
Synco uses DNS to resolve the master server. This allows for bi-directional synchronization and other interesting setups.
|
|
207
|
-
|
|
208
|
-
Firstly, a backup script defaults to the server with the name `:master` as the master, where data is replicated FROM.
|
|
209
|
-
|
|
210
|
-
However, it is possible instead to specify a hostname, e.g. `primary.example.com`. Then, specify several servers, e.g. `s01.example.com`, `s02.example.com` and so on:
|
|
211
|
-
|
|
212
|
-
```ruby
|
|
213
|
-
Synco::run_script do |script|
|
|
214
|
-
script.method = Synco::Methods::RSync.new(archive: true)
|
|
215
|
-
|
|
216
|
-
script.master = "primary.example.com"
|
|
217
|
-
|
|
218
|
-
server("s01.example.com") do |server|
|
|
219
|
-
server.root = "/"
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
server("s02.example.com") do |server|
|
|
223
|
-
server.root = "/"
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
backup('srv/http',
|
|
227
|
-
arguments: %W{--exclude cache/ --exclude tmp/}
|
|
228
|
-
)
|
|
229
|
-
end
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
When you run the script, the behaviour will depend on whether `primary.example.com` points to `s01.example.com` or `s02.example.com`. The data will always be copied from the master server to the other servers.
|
|
233
|
-
|
|
234
|
-
## Contributing
|
|
235
|
-
|
|
236
|
-
1. Fork it
|
|
237
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
238
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
239
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
240
|
-
5. Create new Pull Request
|
|
241
|
-
|
|
242
|
-
## License
|
|
243
|
-
|
|
244
|
-
Released under the MIT license.
|
|
245
|
-
|
|
246
|
-
Copyright, 2016, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
|
247
|
-
|
|
248
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
249
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
250
|
-
in the Software without restriction, including without limitation the rights
|
|
251
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
252
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
253
|
-
furnished to do so, subject to the following conditions:
|
|
254
|
-
|
|
255
|
-
The above copyright notice and this permission notice shall be included in
|
|
256
|
-
all copies or substantial portions of the Software.
|
|
257
|
-
|
|
258
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
259
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
260
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
261
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
262
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
263
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
264
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/spec/spec_helper.rb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
|
2
|
-
#
|
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
# furnished to do so, subject to the following conditions:
|
|
9
|
-
#
|
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
|
11
|
-
# all copies or substantial portions of the Software.
|
|
12
|
-
#
|
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
# THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
require 'bundler/setup'
|
|
22
|
-
require 'covered/rspec'
|
|
23
|
-
|
|
24
|
-
RSpec.configure do |config|
|
|
25
|
-
# Enable flags like --only-failures and --next-failure
|
|
26
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
|
27
|
-
|
|
28
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
29
|
-
config.disable_monkey_patching!
|
|
30
|
-
|
|
31
|
-
config.expect_with :rspec do |c|
|
|
32
|
-
c.syntax = :expect
|
|
33
|
-
end
|
|
34
|
-
end
|