@mateusbmp/backup-manager 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +480 -2
- package/config.example.json +49 -0
- package/config.schema.json +372 -0
- package/dist/cli.js +6863 -0
- package/dist/cli.js.map +1 -0
- package/package.json +86 -4
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/MateusBMP/backup-manager/main/config.schema.json",
|
|
4
|
+
"title": "backup-manager configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"$schema": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"version": {
|
|
11
|
+
"default": 1,
|
|
12
|
+
"description": "Config format version.",
|
|
13
|
+
"type": "number",
|
|
14
|
+
"const": 1
|
|
15
|
+
},
|
|
16
|
+
"settings": {
|
|
17
|
+
"default": {
|
|
18
|
+
"compressLevel": 6,
|
|
19
|
+
"autoPrune": true,
|
|
20
|
+
"maxConcurrentJobs": 1
|
|
21
|
+
},
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"backupDir": {
|
|
25
|
+
"description": "Root directory for backups. Default: $XDG_DATA_HOME/backup-manager/backups.",
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1
|
|
28
|
+
},
|
|
29
|
+
"stateDir": {
|
|
30
|
+
"description": "Directory for jobs, logs, locks and schedule state. Default: $XDG_STATE_HOME/backup-manager.",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"minLength": 1
|
|
33
|
+
},
|
|
34
|
+
"compressLevel": {
|
|
35
|
+
"default": 6,
|
|
36
|
+
"description": "gzip compression level for dumps and archives (1 fastest … 9 smallest).",
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"minimum": 1,
|
|
39
|
+
"maximum": 9
|
|
40
|
+
},
|
|
41
|
+
"autoPrune": {
|
|
42
|
+
"default": true,
|
|
43
|
+
"description": "Apply the retention policy after every successful backup.",
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"timezone": {
|
|
47
|
+
"description": "IANA timezone for schedules, e.g. 'America/Sao_Paulo'. Default: the system timezone.",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
},
|
|
51
|
+
"maxConcurrentJobs": {
|
|
52
|
+
"default": 1,
|
|
53
|
+
"description": "Maximum scheduled jobs the daemon runs at the same time.",
|
|
54
|
+
"type": "integer",
|
|
55
|
+
"minimum": 1,
|
|
56
|
+
"maximum": 16
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"description": "Global settings."
|
|
61
|
+
},
|
|
62
|
+
"retention": {
|
|
63
|
+
"default": {
|
|
64
|
+
"keepLast": 7,
|
|
65
|
+
"keepDays": 30
|
|
66
|
+
},
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"keepLast": {
|
|
70
|
+
"default": 7,
|
|
71
|
+
"description": "Keep the newest N complete backups (0 disables this rule).",
|
|
72
|
+
"type": "integer",
|
|
73
|
+
"minimum": 0,
|
|
74
|
+
"maximum": 9007199254740991
|
|
75
|
+
},
|
|
76
|
+
"keepDays": {
|
|
77
|
+
"default": 30,
|
|
78
|
+
"description": "Keep complete backups younger than N days (0 disables this rule).",
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"minimum": 0,
|
|
81
|
+
"maximum": 9007199254740991
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"description": "Retention policy. A backup is kept when either rule keeps it."
|
|
86
|
+
},
|
|
87
|
+
"api": {
|
|
88
|
+
"default": {
|
|
89
|
+
"enabled": true,
|
|
90
|
+
"host": "127.0.0.1",
|
|
91
|
+
"port": 8080
|
|
92
|
+
},
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"enabled": {
|
|
96
|
+
"default": true,
|
|
97
|
+
"description": "Serve the read-only HTTP API from the daemon.",
|
|
98
|
+
"type": "boolean"
|
|
99
|
+
},
|
|
100
|
+
"host": {
|
|
101
|
+
"default": "127.0.0.1",
|
|
102
|
+
"description": "Address to bind.",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"minLength": 1
|
|
105
|
+
},
|
|
106
|
+
"port": {
|
|
107
|
+
"default": 8080,
|
|
108
|
+
"description": "TCP port.",
|
|
109
|
+
"type": "integer",
|
|
110
|
+
"minimum": 1,
|
|
111
|
+
"maximum": 65535
|
|
112
|
+
},
|
|
113
|
+
"token": {
|
|
114
|
+
"description": "Bearer token required by every route except /health, /docs and /openapi.json.",
|
|
115
|
+
"type": "string",
|
|
116
|
+
"minLength": 1
|
|
117
|
+
},
|
|
118
|
+
"tokenFile": {
|
|
119
|
+
"description": "File containing the bearer token (alternative to token).",
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 1
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false,
|
|
125
|
+
"description": "Read-only HTTP API served by `bkm daemon`."
|
|
126
|
+
},
|
|
127
|
+
"environments": {
|
|
128
|
+
"default": [],
|
|
129
|
+
"description": "Environments, in display order.",
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"properties": {
|
|
134
|
+
"name": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"maxLength": 64,
|
|
137
|
+
"pattern": "^[a-z0-9][a-z0-9_-]*$",
|
|
138
|
+
"description": "Environment name: lowercase letters, digits, '-' and '_'."
|
|
139
|
+
},
|
|
140
|
+
"schedule": {
|
|
141
|
+
"description": "Cron expression (5 or 6 fields) for automatic backups. Omit for manual only.",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"minLength": 1
|
|
144
|
+
},
|
|
145
|
+
"backupDir": {
|
|
146
|
+
"description": "Backup directory used as-is. Default: <settings.backupDir>/<name>.",
|
|
147
|
+
"type": "string",
|
|
148
|
+
"minLength": 1
|
|
149
|
+
},
|
|
150
|
+
"retention": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"properties": {
|
|
153
|
+
"keepLast": {
|
|
154
|
+
"description": "Overrides the global keepLast.",
|
|
155
|
+
"type": "integer",
|
|
156
|
+
"minimum": 0,
|
|
157
|
+
"maximum": 9007199254740991
|
|
158
|
+
},
|
|
159
|
+
"keepDays": {
|
|
160
|
+
"description": "Overrides the global keepDays.",
|
|
161
|
+
"type": "integer",
|
|
162
|
+
"minimum": 0,
|
|
163
|
+
"maximum": 9007199254740991
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"additionalProperties": false,
|
|
167
|
+
"description": "Per-environment retention override."
|
|
168
|
+
},
|
|
169
|
+
"projects": {
|
|
170
|
+
"default": [],
|
|
171
|
+
"description": "Laravel projects whose storage is archived.",
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"properties": {
|
|
176
|
+
"name": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"maxLength": 64,
|
|
179
|
+
"pattern": "^[a-z0-9][a-z0-9_-]*$",
|
|
180
|
+
"description": "Project name: lowercase letters, digits, '-' and '_'."
|
|
181
|
+
},
|
|
182
|
+
"path": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"minLength": 1,
|
|
185
|
+
"description": "Absolute path to the Laravel project root (the directory with artisan)."
|
|
186
|
+
},
|
|
187
|
+
"include": {
|
|
188
|
+
"default": [
|
|
189
|
+
"storage/app"
|
|
190
|
+
],
|
|
191
|
+
"description": "Directories to archive, relative to the project root.",
|
|
192
|
+
"minItems": 1,
|
|
193
|
+
"type": "array",
|
|
194
|
+
"items": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"minLength": 1
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"exclude": {
|
|
200
|
+
"default": [
|
|
201
|
+
"storage/framework/{cache,sessions,views}/**",
|
|
202
|
+
"storage/logs/**",
|
|
203
|
+
"**/.gitignore"
|
|
204
|
+
],
|
|
205
|
+
"description": "Glob patterns (relative to the project root) to leave out. 'dir/**' keeps the empty directory.",
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"minLength": 1
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"required": [
|
|
214
|
+
"name",
|
|
215
|
+
"path"
|
|
216
|
+
],
|
|
217
|
+
"additionalProperties": false
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"databases": {
|
|
221
|
+
"default": [],
|
|
222
|
+
"description": "Databases dumped with mariadb-dump.",
|
|
223
|
+
"type": "array",
|
|
224
|
+
"items": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"properties": {
|
|
227
|
+
"name": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"maxLength": 64,
|
|
230
|
+
"pattern": "^[a-z0-9][a-z0-9_-]*$",
|
|
231
|
+
"description": "Database name: lowercase letters, digits, '-' and '_'."
|
|
232
|
+
},
|
|
233
|
+
"source": {
|
|
234
|
+
"oneOf": [
|
|
235
|
+
{
|
|
236
|
+
"type": "object",
|
|
237
|
+
"properties": {
|
|
238
|
+
"type": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"const": "laravel"
|
|
241
|
+
},
|
|
242
|
+
"project": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"maxLength": 64,
|
|
245
|
+
"pattern": "^[a-z0-9][a-z0-9_-]*$",
|
|
246
|
+
"description": "Project (in the same environment) whose .env provides DB_* values."
|
|
247
|
+
},
|
|
248
|
+
"host": {
|
|
249
|
+
"description": "Server host.",
|
|
250
|
+
"type": "string",
|
|
251
|
+
"minLength": 1
|
|
252
|
+
},
|
|
253
|
+
"port": {
|
|
254
|
+
"description": "Server port.",
|
|
255
|
+
"type": "integer",
|
|
256
|
+
"minimum": 1,
|
|
257
|
+
"maximum": 65535
|
|
258
|
+
},
|
|
259
|
+
"socket": {
|
|
260
|
+
"description": "Unix socket path (instead of host/port).",
|
|
261
|
+
"type": "string",
|
|
262
|
+
"minLength": 1
|
|
263
|
+
},
|
|
264
|
+
"user": {
|
|
265
|
+
"description": "User name.",
|
|
266
|
+
"type": "string",
|
|
267
|
+
"minLength": 1
|
|
268
|
+
},
|
|
269
|
+
"password": {
|
|
270
|
+
"description": "Password. Prefer passwordFile.",
|
|
271
|
+
"type": "string"
|
|
272
|
+
},
|
|
273
|
+
"passwordFile": {
|
|
274
|
+
"description": "File containing the password (first line).",
|
|
275
|
+
"type": "string",
|
|
276
|
+
"minLength": 1
|
|
277
|
+
},
|
|
278
|
+
"database": {
|
|
279
|
+
"description": "Overrides DB_DATABASE.",
|
|
280
|
+
"type": "string",
|
|
281
|
+
"minLength": 1
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"required": [
|
|
285
|
+
"type",
|
|
286
|
+
"project"
|
|
287
|
+
],
|
|
288
|
+
"additionalProperties": false,
|
|
289
|
+
"description": "Read the connection from a Laravel project's .env; any field set here wins."
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"type": "object",
|
|
293
|
+
"properties": {
|
|
294
|
+
"type": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"const": "connection"
|
|
297
|
+
},
|
|
298
|
+
"host": {
|
|
299
|
+
"description": "Server host.",
|
|
300
|
+
"type": "string",
|
|
301
|
+
"minLength": 1
|
|
302
|
+
},
|
|
303
|
+
"port": {
|
|
304
|
+
"description": "Server port.",
|
|
305
|
+
"type": "integer",
|
|
306
|
+
"minimum": 1,
|
|
307
|
+
"maximum": 65535
|
|
308
|
+
},
|
|
309
|
+
"socket": {
|
|
310
|
+
"description": "Unix socket path (instead of host/port).",
|
|
311
|
+
"type": "string",
|
|
312
|
+
"minLength": 1
|
|
313
|
+
},
|
|
314
|
+
"user": {
|
|
315
|
+
"description": "User name.",
|
|
316
|
+
"type": "string",
|
|
317
|
+
"minLength": 1
|
|
318
|
+
},
|
|
319
|
+
"password": {
|
|
320
|
+
"description": "Password. Prefer passwordFile.",
|
|
321
|
+
"type": "string"
|
|
322
|
+
},
|
|
323
|
+
"passwordFile": {
|
|
324
|
+
"description": "File containing the password (first line).",
|
|
325
|
+
"type": "string",
|
|
326
|
+
"minLength": 1
|
|
327
|
+
},
|
|
328
|
+
"schemas": {
|
|
329
|
+
"minItems": 1,
|
|
330
|
+
"type": "array",
|
|
331
|
+
"items": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"minLength": 1
|
|
334
|
+
},
|
|
335
|
+
"description": "Schemas (databases) to dump into one file."
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"required": [
|
|
339
|
+
"type",
|
|
340
|
+
"schemas"
|
|
341
|
+
],
|
|
342
|
+
"additionalProperties": false,
|
|
343
|
+
"description": "An explicit MariaDB/MySQL connection."
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
"extraArgs": {
|
|
348
|
+
"default": [],
|
|
349
|
+
"description": "Extra arguments for mariadb-dump, e.g. ['--ignore-table=app.sessions'].",
|
|
350
|
+
"type": "array",
|
|
351
|
+
"items": {
|
|
352
|
+
"type": "string"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"required": [
|
|
357
|
+
"name",
|
|
358
|
+
"source"
|
|
359
|
+
],
|
|
360
|
+
"additionalProperties": false
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"required": [
|
|
365
|
+
"name"
|
|
366
|
+
],
|
|
367
|
+
"additionalProperties": false
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"additionalProperties": false
|
|
372
|
+
}
|