Compare commits

...

191 Commits

Author SHA1 Message Date
dave@tiredofit.ca
016c5c1a23 Release 4.1.21 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-08-08 09:26:13 -07:00
Dave Conroy
de8a952825 Merge pull request #421 from tlex/main 2025-08-08 09:24:55 -07:00
Alex Thomae
c7912d355e fix: tabs used instead of spaces 2025-08-08 07:37:56 +02:00
Alex Thomae
15902829c0 #420: fix exit_code got changed to exitcode 2025-08-08 07:37:29 +02:00
dave@tiredofit.ca
2c8f40e37c Release 4.1.20 - See CHANGELOG.md 2025-07-23 08:55:52 -07:00
Dave Conroy
c360150117 Merge pull request #418 from alteriks/main 2025-07-23 08:54:36 -07:00
Krzysztof Dajka
7c32879e80 fix: exitcode masking db errors 2025-07-22 16:56:53 +02:00
dave@tiredofit.ca
a475f7d0f3 Release 4.1.19 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-05-28 08:05:58 -07:00
dave@tiredofit.ca
399727cd37 Release 4.1.18 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-05-12 08:33:53 -07:00
Dave Conroy
f58de70dc4 Merge pull request #412 from logicoa/logicoa-mongodb-wildcard-drop-order
fix: wildcard case order
2025-05-12 08:33:01 -07:00
logicoa
5ab0cbe7c5 fix: wildcard case order
mongoDB restore always dropped schema, irrespective of flag variant, due to wildcard being the first option in case.
2025-05-12 11:18:43 +02:00
dave@tiredofit.ca
9d5406b6a9 Release 4.1.17 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-04-17 21:08:25 -07:00
dave@tiredofit.ca
53760fbe4d Release 4.1.16 - See CHANGELOG.md 2025-02-21 07:39:11 -08:00
Dave Conroy
a72b562c70 Merge pull request #402 from fermion2020/main
Update restore script
2025-02-21 07:38:17 -08:00
Ihor Kolos
fc586c204f Update restore script
Switch the mysql command to mariadb to resolve the deprecation warning.
Fix the restore issue caused by missing SSL configuration (error message: "TLS/SSL error: SSL is required, but the server does not support it").
2025-02-20 14:31:23 -06:00
dave@tiredofit.ca
e9ed8d1a72 Release 4.1.15 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-01-29 08:01:35 -08:00
Dave Conroy
78ac4a4a81 Add username/password check and append auth details to a couch db connectivity check 2025-01-29 07:59:49 -08:00
Dave Conroy
949aafdbe1 fix - zyclonite being attached to compression for couchdb 2025-01-29 07:53:39 -08:00
dave@tiredofit.ca
7a94472055 Release 4.1.14 - See CHANGELOG.md
Some checks failed
build_image / build (push) Has been cancelled
2025-01-21 12:59:35 -08:00
dave@tiredofit.ca
23aeaf58a2 Release 4.1.13 - See CHANGELOG.md
Some checks are pending
build_image / build (push) Waiting to run
2025-01-21 09:30:06 -08:00
Dave Conroy
b88816337f Seperate TLS configuration for MariaDB and MySQL 2025-01-21 09:29:29 -08:00
Dave Conroy
ac8181b3b5 Update MySQL client to 8.4.4 2025-01-21 08:33:22 -08:00
Dave Conroy
c75c41a34d Update AWS CLI to 1.37.2 2025-01-21 08:32:52 -08:00
dave@tiredofit.ca
244e411e76 Release 4.1.12 - See CHANGELOG.md 2024-12-13 07:51:35 -08:00
dave@tiredofit.ca
e69ac23898 Release 4.1.11 - See CHANGELOG.md 2024-12-13 07:40:04 -08:00
dave@tiredofit.ca
261951045f Release 4.1.10 - See CHANGELOG.md 2024-12-12 08:38:57 -08:00
dave@tiredofit.ca
67f4326d0b Release 4.1.9 - See CHANGELOG.md 2024-11-07 11:16:32 -08:00
dave@tiredofit.ca
2cd62b8732 Release 4.1.8 - See CHANGELOG.md 2024-10-29 18:58:34 -07:00
dave@tiredofit.ca
0d2b3ccc8c Release 4.1.4 - See CHANGELOG.md 2024-08-13 16:34:44 -07:00
Dave Conroy
90f53a7f00 Merge pull request #358 from ToshY/docs/blobxfer-mode
[docs] fixed blobxfer mode correct parameter name
2024-07-31 13:07:30 -07:00
ToshY
c5f89da681 fixed blobxfermode correct parameter name 2024-07-31 08:11:32 +00:00
dave@tiredofit.ca
753a780204 Release 4.1.3 - See CHANGELOG.md 2024-07-05 12:06:15 -07:00
dave@tiredofit.ca
7c07253428 Release 4.1.2 - See CHANGELOG.md 2024-07-02 16:15:22 -07:00
Dave Conroy
0fdb447706 Merge pull request #354 from effectivelywild/main
Resolve multiple issues using Azure blobs for remote storage
2024-07-02 16:13:41 -07:00
Frank Muise
0d23c2645c Add --no-overwrite to blobxfer download 2024-06-30 16:28:16 -04:00
Frank Muise
4786ea9c7f Update log entry for blob sync 2024-06-30 14:56:50 -04:00
Frank Muise
a26dba947b Fix issues with Azure blobs 2024-06-30 14:53:31 -04:00
dave@tiredofit.ca
b9fa7d18b1 Release 4.1.1 - See CHANGELOG.md 2024-06-19 15:41:45 -07:00
dave@tiredofit.ca
626d276c68 Release 4.1.0 - See CHANGELOG.md 2024-05-25 12:48:58 -07:00
dave@tiredofit.ca
f7f72ba2c1 Release 4.0.35 - See CHANGELOG.md 2024-01-14 20:22:08 -08:00
Dave Conroy
2f05d76f4e README weirdness 2024-01-03 17:33:52 -08:00
Dave Conroy
c9a634ff25 Convert > to - in README 2024-01-03 17:21:01 -08:00
dave@tiredofit.ca
0ce21e8f43 Release 4.0.34 - See CHANGELOG.md 2024-01-02 14:01:28 -08:00
Dave Conroy
a700eb0fef Merge pull request #315 from ToshY/docs/latest-symlink-format
[Docs] Updated `DEFAULT_CREATE_LATEST_SYMLINK` description format
2024-01-02 13:21:59 -08:00
Dave Conroy
7baa3774c7 Merge pull request #318 from devmethodgit/main
Fix environment variables in examples
2024-01-02 13:21:43 -08:00
Dave Conroy
341e4d12ea Update case statement to support arm64|aarch64 2024-01-02 13:21:07 -08:00
Dave Conroy
5c51bbcb7e Wrap if statement in double brackets 2024-01-02 12:54:57 -08:00
@vladimirzyuzin
24d9a9a937 Fix environment variables 2023-12-30 20:58:26 +03:00
ToshY
591b8d6dbd updated create latest symlink description format 2023-12-26 12:24:52 +00:00
dave@tiredofit.ca
a5b15b4412 Release 4.0.33 - See CHANGELOG.md 2023-12-18 07:58:54 -08:00
dave@tiredofit.ca
6692cf9834 Release 4.0.32 - See CHANGELOG.md 2023-12-15 15:32:32 -08:00
dave@tiredofit.ca
c37de5778d Release 4.0.31 - See CHANGELOG.md 2023-12-12 19:25:40 -08:00
dave@tiredofit.ca
eeeafd6ab8 Release 4.0.30 - See CHANGELOG.md 2023-12-11 15:21:01 -08:00
dave@tiredofit.ca
17daf26084 Release 4.0.29 - See CHANGELOG.md 2023-12-04 11:29:14 -08:00
Dave Conroy
b53cda99f7 Don't execute blobxfer functions if both key and secret are not set 2023-12-04 11:09:43 -08:00
Dave Conroy
2cf3e2ae70 Show proper DB Name when backing up Mongo or MSSQL 2023-12-04 08:06:57 -08:00
dave@tiredofit.ca
c7ee94aec2 Release 4.0.28 - See CHANGELOG.md 2023-12-04 07:04:08 -08:00
Dave Conroy
f44233e51a AWS CLI 1.31.5 2023-12-04 07:02:40 -08:00
dave@tiredofit.ca
ccda858b18 Release 4.0.27 - See CHANGELOG.md 2023-12-04 07:00:39 -08:00
Dave Conroy
d58b27d5ef Use alternate cron 2023-12-03 22:04:12 -08:00
dave@tiredofit.ca
fb9fe8a032 Release 4.0.26 - See CHANGELOG.md 2023-11-30 08:55:34 -08:00
Dave Conroy
b705982ae1 Restore missing _SPLIT_DB environment variable information for MySQL/Postgres 2023-11-30 08:54:49 -08:00
dave@tiredofit.ca
f031d787ae Release 4.0.25 - See CHANGELOG.md 2023-11-29 10:43:25 -08:00
Dave Conroy
3eed5fc8a0 Switch BLOBXFER_STORAGE_KEY to BLOBXFER_STORAGE_ACCOUNT_KEY 2023-11-29 10:39:58 -08:00
dave@tiredofit.ca
be619fb707 Release 4.0.24 - See CHANGELOG.md 2023-11-28 15:06:50 -08:00
dave@tiredofit.ca
cccc088b35 Release 4.0.23 - See CHANGELOG.md 2023-11-28 08:05:11 -08:00
dave@tiredofit.ca
4579f4057c Release 4.0.22 - See CHANGELOG.md 2023-11-25 08:50:25 -08:00
dave@tiredofit.ca
cd683648d0 Release 4.0.21 - See CHANGELOG.md 2023-11-22 15:40:38 -08:00
dave@tiredofit.ca
11f55f3d82 Release 4.0.20 - See CHANGELOG.md 2023-11-21 15:18:22 -08:00
dave@tiredofit.ca
674a98fcd8 Release 4.0.19 - See CHANGELOG.md 2023-11-20 15:26:21 -08:00
dave@tiredofit.ca
77c747e01b Release 4.0.18 - See CHANGELOG.md 2023-11-18 09:53:41 -08:00
Dave Conroy
2e30558a27 Merge pull request #282 from joergmschulz/patch-1
Update 10-db-backup msmtp -C
2023-11-18 09:52:23 -08:00
joergmschulz
c746fb641e Update 10-db-backup msmtp -C
the config file is referenced by -C , not -c
2023-11-17 23:28:08 +01:00
dave@tiredofit.ca
ca2f04cd59 Release 4.0.17 - See CHANGELOG.md 2023-11-17 08:16:34 -08:00
dave@tiredofit.ca
dfa94ecab7 Release 4.0.16 - See CHANGELOG.md 2023-11-17 08:07:54 -08:00
Dave Conroy
eaea6dc348 Update README.md 2023-11-16 09:38:18 -08:00
dave@tiredofit.ca
34abe88159 Release 4.0.15 - See CHANGELOG.md 2023-11-16 09:35:56 -08:00
Dave Conroy
5ffbeeb163 Merge pull request #280 from joergmschulz/patch-1
warn instead of warning
2023-11-14 07:14:55 -08:00
joergmschulz
c82cee80f8 warn instead of warning
see #279
2023-11-14 08:53:38 +01:00
dave@tiredofit.ca
ab059ccdf1 Release 4.0.14 - See CHANGELOG.md 2023-11-13 15:16:36 -08:00
dave@tiredofit.ca
1e8ccf4d56 Release 4.0.13 - See CHANGELOG.md 2023-11-12 17:07:07 -08:00
dave@tiredofit.ca
65c40cac0a Release 4.0.12 - See CHANGELOG.md 2023-11-12 09:03:01 -08:00
dave@tiredofit.ca
a9f2d51ff9 Release 4.0.11 - See CHANGELOG.md 2023-11-11 13:43:57 -08:00
dave@tiredofit.ca
7f455abc1a Release 4.0.10 - See CHANGELOG.md 2023-11-11 09:34:11 -08:00
dave@tiredofit.ca
c16add4525 Release 4.0.9 - See CHANGELOG.md 2023-11-11 09:16:02 -08:00
Dave Conroy
d5769b1588 Fix Ctrl-C Backup Concurrency 2023-11-11 08:48:59 -08:00
dave@tiredofit.ca
0b2c7836cf Release 4.0.8 - See CHANGELOG.md 2023-11-11 08:32:58 -08:00
Dave Conroy
535e011740 Add safety net to debug() SHOW_OUTPUT 2023-11-11 07:28:38 -08:00
Dave Conroy
5a391b908a Fix debug() duplicate variable 2023-11-11 07:23:13 -08:00
dave@tiredofit.ca
fddca646c8 Release 4.0.7 - See CHANGELOG.md 2023-11-11 07:15:00 -08:00
Dave Conroy
68f954c59b Fix SQLite3 Backups and clean up temp directory properly 2023-11-11 07:12:29 -08:00
Dave Conroy
0ab0a6d182 sqlit3 scheduler process name remove slashes 2023-11-11 06:48:39 -08:00
Dave Conroy
f6bf2993f7 Add seperate persmissions for _FILESYSTEM_PATH 2023-11-11 06:36:26 -08:00
dave@tiredofit.ca
5cf00a8b8e Release 4.0.6 - See CHANGELOG.md 2023-11-10 17:53:47 -08:00
dave@tiredofit.ca
2bc730013e Release 4.0.5 - See CHANGELOG.md 2023-11-10 07:25:25 -08:00
Dave Conroy
d628ed8ff4 Expand upon DEBUG_ statements to give more detail 2023-11-10 07:24:31 -08:00
Dave Conroy
d7399667a1 Update _FILESYSTEM_PERMISSIONS from 700 to 600 and add undocumented DBBACKUP_USER|GROUP variable 2023-11-10 07:16:56 -08:00
dave@tiredofit.ca
9caec737e0 Release 4.0.4 - See CHANGELOG.md 2023-11-09 11:49:26 -08:00
Dave Conroy
87a803512d Merge pull request #269 from tiredofit/4.x
New Restore Script
2023-11-09 11:48:19 -08:00
Dave Conroy
c6a8fb0ae0 Merge branch 'main' into 4.x 2023-11-09 11:48:08 -08:00
Dave Conroy
8fafdeb45c Restore - Support multiple DB Hosts 2023-11-09 11:46:04 -08:00
Dave Conroy
4a3a79d328 restore - we're actually using FILESYSTEM_PATH 2023-11-09 09:21:19 -08:00
dave@tiredofit.ca
bad5057bcf Release 4.0.3 - See CHANGELOG.md 2023-11-09 09:20:27 -08:00
Dave Conroy
d2acfc4a88 restore - dont browse .gpg files 2023-11-09 09:19:39 -08:00
Dave Conroy
3d794a819f Commence work on restore scripts 2023-11-09 09:19:13 -08:00
dave@tiredofit.ca
aaf6309cc4 Release 4.0.2 - See CHANGELOG.md 2023-11-09 08:09:59 -08:00
dave@tiredofit.ca
55d2067b43 Release 4.0.1 - See CHANGELOG.md 2023-11-09 08:04:05 -08:00
Dave Conroy
0d56a26f0f restore - remove reference to DB_DUMP_TARGET and instead use DEFAULT_BACKUP_PATH 2023-11-09 08:03:39 -08:00
Dave Conroy
635411bdd5 Update README.md 2023-11-08 22:37:39 -08:00
Dave Conroy
39776a96b8 Release 4.0.0 - See CHANGELOG.md and README.md 2023-11-08 18:55:57 -08:00
Dave Conroy
d24cdc5db5 Merge pull request #266 from tiredofit/4.x
Release 4.0.0
2023-11-08 18:49:42 -08:00
Dave Conroy
2df35e46e5 Merge 4.x prep 2023-11-08 18:48:58 -08:00
Dave Conroy
41b518f2f0 Add a failsafe for _original_debug_mode 2023-11-08 18:18:05 -08:00
Dave Conroy
89e6956cdd Adjust debug statements 2023-11-08 15:08:32 -08:00
Dave Conroy
089687dc55 Add DEBUG_ statements 2023-11-08 14:48:27 -08:00
Dave Conroy
c88fbacde9 Update Zabbix Template to fix trigger 2023-11-08 13:14:09 -08:00
Dave Conroy
3010a4d187 Rework Zabbix Payloads 2023-11-08 10:48:18 -08:00
Dave Conroy
fd59daf125 Update Zabbix Template 2023-11-08 10:48:06 -08:00
Dave Conroy
140e3183a4 Update Zabbix Template 2023-11-08 10:43:25 -08:00
Dave Conroy
45eba40360 Update Zabbix Template 2023-11-08 10:40:02 -08:00
Dave Conroy
440b24da8d Update Zabbix Template 2023-11-08 10:06:19 -08:00
Dave Conroy
9849c7339e Add PGSQL to override and force backing up globals 2023-11-08 09:11:24 -08:00
Dave Conroy
80e407d81d switch globals to only get backed up if using all 2023-11-08 08:55:21 -08:00
Dave Conroy
40ad7abac4 No more extra now 2023-11-08 08:35:22 -08:00
Dave Conroy
3ecb24c603 Fix naming issue with backup_job_filesystem_archive 2023-11-08 08:29:35 -08:00
Dave Conroy
ff96f09e33 future_time is time_future 2023-11-08 08:25:08 -08:00
Dave Conroy
77f54d06fa Rearrange variables and polish: 2023-11-08 08:00:21 -08:00
Dave Conroy
633cc8410e Fix cron expression stepping 2023-11-08 07:43:37 -08:00
Dave Conroy
f5b92854da Cleanup cron expression 2023-11-07 13:06:06 -08:00
Dave Conroy
50039f8d0c Rearrange timer() 2023-11-07 13:03:01 -08:00
Dave Conroy
b8a825a3af Rework write_log to not output more than it needs to 2023-11-07 12:33:03 -08:00
Dave Conroy
2ccc867a75 Write Legacy vars to file instead 2023-11-07 12:13:04 -08:00
Dave Conroy
11205be091 Properly handle BACKUP_BEGIN plus values 2023-11-07 12:00:19 -08:00
Dave Conroy
57193cc824 Properly translate legacy _DUMP var to DEFAULT_BACKUP 2023-11-07 11:50:59 -08:00
Dave Conroy
9863358469 Split debug statement for backup/move exit codes 2023-11-07 11:05:39 -08:00
Dave Conroy
bb3c942b35 Properly output exit code for notifications 2023-11-07 11:02:49 -08:00
Dave Conroy
72f90876e3 Fix writing logfiles to filessytem 2023-11-06 17:00:29 -08:00
Dave Conroy
c94a85b523 Change Zabbix autoregister string to dbbackup4 2023-11-06 16:53:20 -08:00
Dave Conroy
c9fd36db72 Fix DEFAULT_MYSQL table 2023-11-06 11:09:15 -08:00
Dave Conroy
a629282093 Update dependencies 2023-11-05 10:42:51 -08:00
Dave Conroy
050cc3ef62 Cleanup Mongo compression routine 2023-11-05 10:12:32 -08:00
Dave Conroy
da54cdf48b Code formatting and cleanup 2023-11-05 10:10:59 -08:00
Dave Conroy
2b446f1e4c Add encrypt/checksum duration graphs 2023-11-05 09:48:23 -08:00
Dave Conroy
9e7904ce4d Cleanup Formatting 2023-11-05 09:47:59 -08:00
Dave Conroy
c5c026d0fd Merge pull request #232 from benvia/feature-cron
Adds a cronjob-like mechanism
2023-11-05 09:17:33 -08:00
Dave Conroy
5d8a7f1720 Optimize write_log function 2023-11-05 08:54:43 -08:00
Dave Conroy
ca6b045d7d Optimize write_log function 2023-11-05 08:51:32 -08:00
Dave Conroy
da22217e7b Refactor timer/datetime 2023-11-05 08:36:15 -08:00
Dave Conroy
59854c1715 Refactor timer/datetime 2023-11-05 08:35:40 -08:00
Dave Conroy
e090eeda3f feat - add MySQL Event backup support 2023-11-05 07:55:40 -08:00
Dave Conroy
0ba1989083 modify MSSQL backups to get compressed post initial backup 2023-11-05 07:45:52 -08:00
Dave Conroy
5392bf5179 feat - add basic cron expression scheduling 2023-11-05 07:40:30 -08:00
Benoit Vianin
e42f8e9a8c Code refactoring 2023-11-05 06:48:47 +00:00
Benoit Vianin
6a28ac2d92 Fix code for absolute time 2023-11-04 18:53:42 +00:00
Dave Conroy
3af9ef6d3d Rework timers 2023-11-04 08:07:10 -07:00
Dave Conroy
5e3d8b3083 Also use ionice for DB_RESOURCE_OPTIMIZED 2023-11-04 07:43:32 -07:00
Benoit Vianin
06cfba4952 Modify DB_DUMP_BEGIN to support a full date as cron 2023-11-04 11:43:45 +00:00
Benoit Vianin
250cae98ef Restore the +XX minutes fucntion and move print to debug mode 2023-11-04 10:34:40 +00:00
Dave Conroy
5dafa69439 feat - add file encryption 2023-11-03 19:46:46 -07:00
Dave Conroy
0159a13746 Add gpg to rundeps 2023-11-03 18:18:05 -07:00
Dave Conroy
dad5294295 Update Zabbix Template 2023-11-03 18:15:30 -07:00
Dave Conroy
3837beae97 feat - Add checksum time, and hash output to Zabbix 2023-11-03 18:11:58 -07:00
Dave Conroy
20bfcec1a9 feat - Add DEFAULT_RESOURCE_OPTIMIZED to adjust CPU scheduler 2023-11-03 18:03:52 -07:00
Dave Conroy
2cc97694f4 Fix formatting: 2023-11-03 15:53:54 -07:00
Dave Conroy
0a867f9719 feat - Add Support for MSSQL Transaction logs - Closes #200 2023-11-03 15:48:39 -07:00
Dave Conroy
7d77266d2a Use relative path insteasd of absolute when creating_latest_symlink - Closes #256 2023-11-03 15:32:33 -07:00
Dave Conroy
50b61ad358 Merge pull request #236 from eoehen/feature/blobxfer-download-befor-move-new-backup-file
feat(235) Synchronize local storage from S3 before upload
2023-11-03 15:23:22 -07:00
Dave Conroy
a10eb1dfba Synchronize local storage from blobxfer before upload 2023-11-03 15:22:59 -07:00
Dave Conroy
b0bf624ad3 Add Postgres GLobals Backup if SPLIT_DB=TRUE 2023-11-03 15:14:02 -07:00
Dave Conroy
07e74ca746 Merge pull request #228 from oscarsiles/main
add postgres globals backup if SPLIT_DB=true
2023-11-03 15:11:35 -07:00
Dave Conroy
599c3d7940 Rework bin directory 2023-11-03 15:02:52 -07:00
Dave Conroy
3e666ef655 Add coreutils to run-deps 2023-11-03 15:02:36 -07:00
Dave Conroy
c0c7202b6d Add multi host support 2023-11-03 15:02:13 -07:00
Dave Conroy
82d8175eeb Support 4.0.x defaults 2023-11-03 15:01:59 -07:00
Dave Conroy
ee294c08a2 Update scheduler template 2023-11-03 15:01:41 -07:00
Dave Conroy
cfbac00268 Zabbix Template > 4.0.x 2023-11-03 15:01:17 -07:00
Dave Conroy
b0413e6708 Version 4.0.x examples 2023-11-03 15:00:56 -07:00
Dave Conroy
57c853d02a MIT 2023-11-03 15:00:33 -07:00
Dave Conroy
0845ec30b3 Update install/etc folder contents 2023-11-03 15:00:13 -07:00
Dave Conroy
96f9825e19 Update README.md with new options 2023-11-03 14:59:44 -07:00
Dave Conroy
2b10a0b679 feat - only cleanup / mv backups of the same file_name pattern 2023-11-01 15:55:32 -07:00
Dave Conroy
1450a33c27 feat - add file logging support 2023-11-01 15:44:03 -07:00
Dave Conroy
74e7a7e74c feat - optimize zabbix sending routines to be one process 2023-11-01 14:43:43 -07:00
Dave Conroy
e03fefeb02 fix - Optimize generating checksum routines 2023-11-01 14:34:34 -07:00
Dave Conroy
3ff3cdb19c feat - Add TARGET_DB_DUMP_PERMISSION to set file and directory permissions 2023-11-01 14:32:43 -07:00
Dave Conroy
bcf7bc5ecd rearrange compression function 2023-11-01 14:18:27 -07:00
Dave Conroy
5a01b6118e feat - make processes and files save as username dbbackup instead of root 2023-11-01 14:13:37 -07:00
Elias Oehen
f67170c1ec feat(235) Synchronize local storage from S3 before upload
close #235
2023-09-26 13:05:20 +02:00
Oscar Siles Brügge
03d2362b6d Merge branch 'tiredofit:main' into main 2023-09-16 21:43:45 +01:00
Benoit Vianin
3c6beeaae9 Adds a cronjob-like mechanism 2023-06-14 04:36:21 +00:00
Oscar Siles Brugge
5f58ce81c8 add postgres globals backup if SPLIT_DB=true 2023-06-07 09:19:25 +01:00
20 changed files with 4018 additions and 1482 deletions

View File

@@ -8,7 +8,7 @@ on:
jobs:
build:
uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
secrets: inherit

View File

@@ -9,7 +9,7 @@ on:
jobs:
build:
uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64.yml@main
#uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
secrets: inherit

View File

@@ -1,3 +1,435 @@
## 4.1.21 2025-08-08 <dave at tiredofit dot ca>
### Changed
- Fix for 4.1.20 release inadvertently failing backups (credit tlex@github)
## 4.1.20 2025-07-23 <dave at tiredofit dot ca>
### Changed
- Fix backup error checking routines #417 - credit alteriks@github
## 4.1.19 2025-05-28 <dave at tiredofit dot ca>
### Changed
- Force overwrite manual scripts as opposed to append (#414)
## 4.1.18 2025-05-12 <dave at tiredofit dot ca>
### Changed
- Fix MongoDB restore from not dropping DB each time before restore except explicitly told (credit logicoa@github)
## 4.1.17 2025-04-17 <dave at tiredofit dot ca>
### Changed
- Fix issue with Postgres database cleanup when ALL databases being backed up as one file (SPLIT_DB=FALSE)
## 4.1.16 2025-02-21 <dave at tiredofit dot ca>
### Added
- Update to tiredofit/alpine:7.10.28
- Support TLS connectivity with restore script (credit fermion2020@github)
## 4.1.15 2025-01-29 <dave at tiredofit dot ca>
### Added
- Add support for username and password support when checking for connectivity to couchdb (credit: JvSomeren)
### Changed
- Fix issue with couchdb compression routines
## 4.1.14 2025-01-21 <dave at tiredofit dot ca>
### Changed
- Downgrade AWS Client to 1.36.40 due to incompatibilities with providers with 1.37x. for time being
## 4.1.13 2025-01-21 <dave at tiredofit dot ca>
### Added
- Update MySQL client to 8.4.4
- Update AWS Client to 1.37.2
### Changed
- Seperate MySQL and MariaDB TLS Configurationf for arguments that have deviated
## 4.1.12 2024-12-13 <dave at tiredofit dot ca>
### Changed
- Fix for 4.1.11
## 4.1.11 2024-12-13 <dave at tiredofit dot ca>
### Changed
- Fix when backing up 'ALL' databases with MariaDB
## 4.1.10 2024-12-12 <dave at tiredofit dot ca>
### Added
- Use tiredofit/alpine:3.21-7.10.27 base
- Use the actual binary name when dumping mariadb and mysql databases
- Silence warnings that are appearing due to filenames, ssl warnings re MariaDB / MySQL
## 4.1.9 2024-11-07 <dave at tiredofit dot ca>
### Added
- Pin to tiredofit/alpine:edge-7.10.19
- MySQL 8.4.3 client
- MSSQL and MSODBC 18.4.1.1-1
- Mysql 11.x Support
- Influx2 Client 2.7.5
- AWS Client 1.35.13
- Postgresql 17.x Support
## 4.1.8 2024-10-29 <dave at tiredofit dot ca>
Rebuild using 4.1.4 sources - ignore any versions of 4.1.5-4.1.7
### Added
## 4.1.4 2024-08-13 <dave at tiredofit dot ca>
Please note that if using encryption using a passphrase, you may be encountering issues with manual decryption. This release fixes that.
If you try to manually decrypt and your passphrase fails. Try wrapping it in single (') or double (") quotes.
### Changed
- Fix for stray quotes appearing inside of ENCRYPT_PASSPHRASE variables
## 4.1.3 2024-07-05 <dave at tiredofit dot ca>
### Changed
- Rebuild to support tiredofit/alpine:7.10.0
## 4.1.2 2024-07-02 <effectivelywild@github>
### Added
- Add support for Azure Blob containers
- Fix timestamps when comparing previous backups
- Resolve unnecessary read operations in Azure
- Resolve issues with backup cleanup operations in Azure
## 4.1.1 2024-06-19 <dave at tiredofit dot ca>
### Changed
- Fix issue where postgresql globals when backing up ALL not being deleted (#352)
## 4.1.0 2024-05-25 <dave at tiredofit dot ca>
Note that arm/v7 builds have been removed from this release going forward
### Added
- Introduce DEFAULT/DBXX_MYSQL_CLIENT option to use mariadb or mysql for client dumping to solve incompatibility issues
- Alpine 3.20 Base
- MariaDB 10.11.8 Client
- AWS Client 1.32.113
- MySQL Client 8.4.0
## 4.0.35 2024-01-14 <dave at tiredofit dot ca>
### Changed
- Fix issue with emaail notifications and not being able to add from statement
## 4.0.34 2024-01-02 <dave at tiredofit dot ca>
### Changed
- Change the way architectures are detected to re-enable backups with MSSQL and Influx2
## 4.0.33 2023-12-18 <dave at tiredofit dot ca>
### Changed
- Allow _OPTS variabls to contain spaces
- Switch references of _DUMP_OPTS to _BACKUP_OPTS
## 4.0.32 2023-12-15 <dave at tiredofit dot ca>
### Changed
- Fix issue with directories not properly being backed up (InfluxDB)
## 4.0.31 2023-12-12 <dave at tiredofit dot ca>
### Changed
- Support backing up databases with spaces in them
## 4.0.30 2023-12-11 <dave at tiredofit dot ca>
### Added
- Seperate each job with its own temporary folder for isolation and to better cleanup jobs that backup as a directory instead of a flat file
## 4.0.29 2023-12-04 <dave at tiredofit dot ca>
### Changed
- Skip blobxfer if either account or key is not present
## 4.0.28 2023-12-04 <dave at tiredofit dot ca>
### Changed
- AWS Cli 1.31.5
- Switch to using PIP for installing AWS-Cli to remove deprecation warnings
## 4.0.27 2023-12-04 <dave at tiredofit dot ca>
### Changed
- Switch to using actual crontab for cron expressions
## 4.0.26 2023-11-30 <dave at tiredofit dot ca>
### Added
- AWS CLI 1.31.4
## 4.0.25 2023-11-29 <dave at tiredofit dot ca>
### Changed
- Fix #297 - Add parameters to blobxfer to restore functionality
## 4.0.24 2023-11-28 <dave at tiredofit dot ca>
### Changed
- Fix issue with cron parsing and 0 being a value getting clobbered by sort command
## 4.0.23 2023-11-28 <dave at tiredofit dot ca>
### Changed
- Resolve issue with custom notification scripts not executing
## 4.0.22 2023-11-25 <dave at tiredofit dot ca>
### Changed
- Move cleanup_old_data routines to happen within backup_ function to properly accomodate for globals, and ALL DB_NAME use cases
## 4.0.21 2023-11-22 <dave at tiredofit dot ca>
### Changed
- Fix for SQLite backups not being cleaned up properly due to a malformed base
## 4.0.20 2023-11-21 <dave at tiredofit dot ca>
### Changed
- Update base image to support S6 Overlay 3.1.6.2 to solve shutdown issues specifically with MODE=MANUAL and MANUAL_RUN_FOREVER=TRUE
- Add some safety nets for Manual scheduling
## 4.0.19 2023-11-20 <dave at tiredofit dot ca>
### Changed
- Make adjustments to cron scheduling feature to be able to handle whitespace properly"
## 4.0.18 2023-11-18 <joergmschulz@github>
### Changed
- Fix loading msmtp configuration
## 4.0.17 2023-11-17 <dave at tiredofit dot ca>
### Changed
- Provide more details when notifying via instant messages
## 4.0.16 2023-11-17 <dave at tiredofit dot ca>
### Changed
- Switch to using msmtp instead of s-mail for notify()
## 4.0.15 2023-11-16 <dave at tiredofit dot ca>
### Changed
- Fix cleanup of old backups
## 4.0.14 2023-11-13 <dave at tiredofit dot ca>
### Changed
- Bugfix when PRE/POST scripts found not giving legacy warning
- Run pre / post scripts as root
## 4.0.13 2023-11-12 <dave at tiredofit dot ca>
### Changed
- Check for any quotes if using MONGO_CUSTOM_URI and remove
## 4.0.12 2023-11-12 <dave at tiredofit dot ca>
### Changed
- Allow creating schedulers if _MONGO_CUSTOM_URI is set and _DB_HOST blank
## 4.0.11 2023-11-11 <dave at tiredofit dot ca>
### Changed
- Resolve issue with backing up ALL databases with PGSQL and MySQL
## 4.0.10 2023-11-11 <dave at tiredofit dot ca>
### Changed
- Change environment variable parsing routines to properly accomodate for Passwords containing '=='
## 4.0.9 2023-11-11 <dave at tiredofit dot ca>
### Changed
- Fix issue with quotes being wrapped around _PASS variables
## 4.0.8 2023-11-11 <dave at tiredofit dot ca>
### Changed
- Tidy up file_encryption() routines
- Change environment variable _ENCRYPT_PUBKEY to _ENCRYPT_PUBLIC_KEY
- Add new environment variable _ENCRYPT_PRIVATE_KEY
## 4.0.7 2023-11-11 <dave at tiredofit dot ca>
### Added
- Add seperate permissions for _FILESYSTEM_PATH
### Changed
- More output and debugging additions
- SQLite3 now backs up without running into file permission/access problems
- Cleanup old sqlite backups from temp directory
- Handle multiple SQLite3 backups concurrently
## 4.0.6 2023-11-10 <dave at tiredofit dot ca>
### Added
- Add additional DEBUG_ statements
### Changed
- Fix issue with Influx DB not properly detecting the correct version
## 4.0.5 2023-11-10 <dave at tiredofit dot ca>
### Added
- Add undocumented DBBACKUP_USER|GROUP environment variables for troubleshooting permissions
- Add more verbosity when using DEBUG_ statements
### Changed
- Change _FILESYSTEM_PERMISSION to 600 from 700
## 4.0.4 2023-11-09 <dave at tiredofit dot ca>
### Added
- Add support for restoring from different DB_ variables in restore script
## 4.0.3 2023-11-09 <dave at tiredofit dot ca>
### Changed
- Resolve issue with _MYSQL_TLS_CERT_FILE not being read
## 4.0.2 2023-11-09 <dave at tiredofit dot ca>
### Changed
- Properly use custom _S3_HOST variables
## 4.0.1 2023-11-09 <dave at tiredofit dot ca>
### Changed
- Restore - Stop using DB_DUMP_TARGET and instead browse using DEFAULT_BACKUP_PATH
## 4.0.0 2023-11-08 <dave at tiredofit dot ca>
This is the fourth major release to the DB Backup image which started as a basic MySQL backup service in early 2017. With each major release brings enhancements, bugfixes, removals along with breaking changes and this one is no different.
This release brings functionality requested by the community such as multiple host backup support by means of independent scheduler tasks,blackout periods, better resource usage, better security via file encryption, file permissions, and more verbosity via log files. , and also merges contributions from other developers.
Upgrading to this image should for the most part work for most users, but will involve event upgrading environment variables as the formathas changed significantly. Old variables should continue to work, however are unsupported and will be removed with the `4.3.0` release, whenever that will be.
A significant amount of development hours were put in to accomodate for feature requests by the community. If you are using this in a commercial setting or find this image valuable, please consider sponsoring my work for a period of time or engaging in a private support offering. More details at https://www.tiredofit.ca/sponsor
### Added
- Backup Multiple Hosts in same image all with different options (scheduling, compression, destination, cleanup) (Use `DBXX_option` variables)
- Backup limits how many backup jobs run concurrently
- Backup Scheduling now allows using a timestamp (e.g. `Dec 12 2023 03:00:00`) - credit benvia@github
- Backup Scheduling now allows using a cron expression (e.g `00 03 * * *`)
- Backup Blackout period to skip backing up during a period of time
- Backup runs as dedicated user (no longer root)
- Backup can have specific file permissions set upon completion (e.g. `700` or `rwx------`)
- Backups can run with reduced priority mode to allow for fair scheduling across system
- Backups - MySQL/MariaDB now has ability to backup events
- Backups - Microsoft SQL server now has option to backup transaction logs
- Backups - Postgres now backs up globals - credit oscarsiles@github
- Backups with Azure synchronize storage before upload - credit eoehen@github
- Encrypt backup file with a passphrase or a GPG Public Key ability
- Log backup jobs to file along with log rotation
- Notification support upon job failure via Email, Mattermost, Matrix, Rocketchat
- Zabbix Metrics now auto discovers new jobs
- Zabbix Metrics sends metrics relating to backed up filename, checksum hash, and the duration of backup/compression time, checksum time, encryption time
- New Debug Capabilities
### Changed
- Reworked Documentation
- Reworked all functions and renamed all variables
- Many variables now use a prefix of `DEFAULT_` to operate on all backup jobs
- Can be overridden per backup job by setting `DB_<option>` or to unset default variable `DB_<option>=unset`
- Renamed variables and terms
- `_DUMP_LOCATION` -> `_BACKUP_LOCATION`
- `_DUMP_BEGIN` -> `_BACKUP_BEGIN`
- `_DUMP_FREQ` -> `_BACKUP_INTERVAL`
- `_DUMP_TARGET`` -> `_FILESYSTEM_PATH`
- `_DUMP_ARCHIVE`` -> `_FILESYSTEM_PATH`
- `EXTRA_DUMP_OPTS`` -> `_EXTRA_BACKUP_OPTS`
- `TEMP_LOCATION`` -> `TEMP_PATH`
- Backups - AWS CLI updated to 1.29.78
- Backups - InfluxDB 2 Client version updated to 2.7.3
- Backups - Microsoft SQL server now compresses files post initial backup
- Backups - Manual backups handle aborting gracefully
- Checksum routines now complete in half the time
- Checksum variable now supports "NONE"
- Zabbix metrics sending occurs in one process as opposed to singular
- Cleanup Only cleanup files that match same backup name pattern
- Cleanup/Archive uses relative path instead of absolute with creating_latest_symlink
- A handful of code optimizations and cleanup
### Removed
- `ENABLE_CHECKSUM` - has been wrapped into `_CHECKSUM=none`
## 3.12.0 2023-10-29 <alwynpan@github>
### Added

View File

@@ -1,100 +1,123 @@
ARG DISTRO=alpine
ARG DISTRO_VARIANT=edge
ARG DISTRO_VARIANT=3.21-7.10.28
FROM docker.io/tiredofit/${DISTRO}:${DISTRO_VARIANT}
LABEL maintainer="Dave Conroy (github.com/tiredofit)"
### Set Environment Variables
ENV INFLUX_VERSION=1.8.0 \
INFLUX2_VERSION=2.4.0 \
MSODBC_VERSION=18.3.2.1-1 \
MSSQL_VERSION=18.3.1.1-1 \
AWS_CLI_VERSION=1.25.97 \
CONTAINER_ENABLE_MESSAGING=FALSE \
ENV INFLUX1_CLIENT_VERSION=1.8.0 \
INFLUX2_CLIENT_VERSION=2.7.5 \
MSODBC_VERSION=18.4.1.1-1 \
MSSQL_VERSION=18.4.1.1-1 \
MYSQL_VERSION=mysql-8.4.4 \
MYSQL_REPO_URL=https://github.com/mysql/mysql-server \
AWS_CLI_VERSION=1.36.40 \
CONTAINER_ENABLE_MESSAGING=TRUE \
CONTAINER_ENABLE_MONITORING=TRUE \
CONTAINER_PROCESS_RUNAWAY_PROTECTOR=FALSE \
IMAGE_NAME="tiredofit/db-backup" \
IMAGE_REPO_URL="https://github.com/tiredofit/docker-db-backup/"
### Dependencies
RUN source /assets/functions/00-container && \
set -ex && \
addgroup -S -g 10000 dbbackup && \
adduser -S -D -H -u 10000 -G dbbackup -g "Tired of I.T! DB Backup" dbbackup && \
\
package update && \
package upgrade && \
package install .db-backup-build-deps \
build-base \
bzip2-dev \
cargo \
git \
go \
libarchive-dev \
openssl-dev \
libffi-dev \
python3-dev \
py3-pip \
xz-dev \
&& \
build-base \
bzip2-dev \
cargo \
cmake \
git \
go \
libarchive-dev \
libtirpc-dev \
openssl-dev \
libffi-dev \
ncurses-dev \
python3-dev \
py3-pip \
xz-dev \
&& \
\
package install .db-backup-run-deps \
bzip2 \
groff \
libarchive \
mariadb-client \
mariadb-connector-c \
mongodb-tools \
openssl \
pigz \
postgresql16 \
postgresql16-client \
pv \
py3-botocore \
py3-colorama \
py3-cryptography \
py3-docutils \
py3-jmespath \
py3-rsa \
py3-setuptools \
py3-s3transfer \
py3-yaml \
python3 \
redis \
sqlite \
xz \
zip \
zstd \
&& \
bzip2 \
coreutils \
gpg \
gpg-agent \
groff \
libarchive \
libtirpc \
mariadb-client \
mariadb-connector-c \
mongodb-tools \
ncurses \
openssl \
pigz \
pixz \
postgresql17 \
postgresql17-client \
pv \
py3-botocore \
py3-colorama \
py3-cryptography \
py3-docutils \
py3-jmespath \
py3-rsa \
py3-setuptools \
py3-s3transfer \
py3-yaml \
python3 \
redis \
sqlite \
xz \
zip \
zstd \
&& \
\
apkArch="$(uname -m)"; \
case "$apkArch" in \
x86_64) mssql=true ; mssql_arch=amd64; influx2=true ; influx_arch=amd64; ;; \
arm64 ) mssql=true ; mssql_arch=amd64; influx2=true ; influx_arch=arm64 ;; \
case "$(uname -m)" in \
"x86_64" ) mssql=true ; mssql_arch=amd64; influx2=true ; influx_arch=amd64; ;; \
"arm64" | "aarch64" ) mssql=true ; mssql_arch=arm64; influx2=true ; influx_arch=arm64 ;; \
*) sleep 0.1 ;; \
esac; \
\
if [ $mssql = "true" ] ; then curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_${MSODBC_VERSION}_${mssql_arch}.apk ; curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_${MSSQL_VERSION}_${mssql_arch}.apk ; ls -l ; echo y | apk add --allow-untrusted msodbcsql18_${MSODBC_VERSION}_${mssql_arch}.apk mssql-tools18_${MSSQL_VERSION}_${mssql_arch}.apk ; else echo >&2 "Detected non x86_64 or ARM64 build variant, skipping MSSQL installation" ; fi; \
if [ $influx2 = "true" ] ; then curl -sSL https://dl.influxdata.com/influxdb/releases/influxdb2-client-${INFLUX2_VERSION}-linux-${influx_arch}.tar.gz | tar xvfz - --strip=1 -C /usr/src/ ; chmod +x /usr/src/influx ; mv /usr/src/influx /usr/sbin/ ; else echo >&2 "Unable to build Influx 2 on this system" ; fi ; \
clone_git_repo https://github.com/aws/aws-cli "${AWS_CLI_VERSION}" && \
python3 setup.py install --prefix=/usr && \
clone_git_repo https://github.com/influxdata/influxdb "${INFLUX_VERSION}" && \
if [ "${mssql,,}" = "true" ] ; then \
curl -sSLO https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/msodbcsql18_${MSODBC_VERSION}_${mssql_arch}.apk ; \
curl -sSLO https://download.microsoft.com/download/7/6/d/76de322a-d860-4894-9945-f0cc5d6a45f8/mssql-tools18_${MSSQL_VERSION}_${mssql_arch}.apk ; \
echo y | apk add --allow-untrusted msodbcsql18_${MSODBC_VERSION}_${mssql_arch}.apk mssql-tools18_${MSSQL_VERSION}_${mssql_arch}.apk ; \
else \
echo >&2 "Detected non x86_64 or ARM64 build variant, skipping MSSQL installation" ; \
fi; \
\
if [ "${influx2,,}" = "true" ] ; then \
curl -sSL https://dl.influxdata.com/influxdb/releases/influxdb2-client-${INFLUX2_CLIENT_VERSION}-linux-${influx_arch}.tar.gz | tar xvfz - --strip=1 -C /usr/src/ ; \
chmod +x /usr/src/influx ; \
mv /usr/src/influx /usr/sbin/ ; \
else \
echo >&2 "Unable to build Influx 2 on this system" ; \
fi ; \
\
clone_git_repo https://github.com/influxdata/influxdb "${INFLUX1_CLIENT_VERSION}" && \
go build -o /usr/sbin/influxd ./cmd/influxd && \
strip /usr/sbin/influxd && \
\
clone_git_repo "${MYSQL_REPO_URL}" "${MYSQL_VERSION}" && \
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DFORCE_INSOURCE_BUILD=1 \
-DWITHOUT_SERVER:BOOL=ON \
&& \
make -j$(nproc) install && \
\
pip3 install --break-system-packages awscli==${AWS_CLI_VERSION} && \
pip3 install --break-system-packages blobxfer && \
\
mkdir -p /usr/src/pbzip2 && \
curl -sSL https://launchpad.net/pbzip2/1.1/1.1.13/+download/pbzip2-1.1.13.tar.gz | tar xvfz - --strip=1 -C /usr/src/pbzip2 && \
cd /usr/src/pbzip2 && \
make && \
make install && \
mkdir -p /usr/src/pixz && \
curl -sSL https://github.com/vasi/pixz/releases/download/v1.0.7/pixz-1.0.7.tar.xz | tar xvfJ - --strip 1 -C /usr/src/pixz && \
cd /usr/src/pixz && \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
&& \
make && \
make install && \
\
pip3 install --break-system-packages blobxfer && \
\
package remove .db-backup-build-deps && \
package cleanup && \
@@ -106,5 +129,4 @@ RUN source /assets/functions/00-container && \
/tmp/* \
/usr/src/*
COPY install /

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2022 Dave Conroy
Copyright (c) 2025 Dave Conroy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

907
README.md

File diff suppressed because it is too large Load Diff

67
examples/compose.yml Normal file
View File

@@ -0,0 +1,67 @@
services:
example-db:
hostname: example-db-host
container_name: example-db
image: tiredofit/mariadb:10.11
ports:
- 3306:3306
volumes:
- ./db:/var/lib/mysql
environment:
- ROOT_PASS=examplerootpassword
- DB_NAME=example
- DB_USER=example
- DB_PASS=examplepassword
restart: always
networks:
- example-db-network
example-db-backup:
container_name: example-db-backup
image: tiredofit/db-backup
volumes:
- ./backups:/backup
#- ./post-script.sh:/assets/custom-scripts/post-script.sh
environment:
- TIMEZONE=America/Vancouver
- CONTAINER_NAME=example-db-backup
- CONTAINER_ENABLE_MONITORING=FALSE
# - DEBUG_MODE=TRUE
- BACKUP_JOB_CONCURRENCY=1 # Only run one job at a time
- DEFAULT_CHECKSUM=NONE # Don't create checksums
- DEFAULT_COMPRESSION=ZSTD # Compress all with ZSTD
- DEFAULT_BACKUP_INTERVAL=1440 # Backup every 1440 minutes
- DEFAULT_BACKUP_BEGIN=0000 # Start backing up at midnight
- DEFAULT_CLEANUP_TIME=8640 # Cleanup backups after a week
- DB01_TYPE=mariadb
- DB01_HOST=example-db-host
- DB01_NAME=example
- DB01_USER=example
- DB01_PASS=examplepassword
- DB01_BACKUP_INTERVAL=30 # (override) Backup every 30 minutes
- DB01_BACKUP_BEGIN=+1 # (override) Backup starts immediately
- DB01_CLEANUP_TIME=180 # (override) Cleanup backups they are older than 180 minutes
- DB01_CHECKSUM=SHA1 # (override) Create a SHA1 checksum
- DB01_COMPRESSION=GZ # (override) Compress with GZIP
#- DB02_TYPE=postgres
#- DB02_HOST=example-postgres-host
#- DB02_NAME=example
#- DB02_USER=example
#- DB02_PASS=examplepassword
#- DB02_BACKUP_INTERVAL=60 # (override) Backup every 60 minutes
#- DB02_BACKUP_BEGIN=+10 # (override) Backup starts in ten minutes
#- DB02_CLEANUP_TIME=240 # (override) Cleanup backups they are older than 240 minutes
#- DB02_CHECKSUM=MD5 # (override) Create a SHA1 checksum
#- DB02_COMPRESSION=BZ # (override) Compress with BZIP
restart: always
networks:
- example-db-network
networks:
example-db-network:
name: example-db-network

View File

@@ -1,13 +1,7 @@
#
#
# Example for Microsoft SQL Server
# upload with blobxfer to azure storage
#
version: '2'
networks:
example-mssql-blobxfer-net:
name: example-mssql-blobxfer-net
#
services:
example-mssql-s3-db:
@@ -32,7 +26,7 @@ services:
# execute in terminal --> docker build -t tiredofit/db-backup-mssql-blobxfer .
# replace --> image: tiredofit/db-backup-mssql
# image: tiredofit/db-backup
image: tiredofit/db-backup-mssql-blobxfer
image: tiredofit/db-backup
links:
- example-mssql-s3-db
volumes:
@@ -40,30 +34,35 @@ services:
- ./tmp/backups:/tmp/backups # shared tmp backup directory
#- ./post-script.sh:/assets/custom-scripts/post-script.sh
environment:
# - DEBUG_MODE=TRUE
- DB_TYPE=mssql
- DB_HOST=example-db-host
# - DB_PORT=1488
# - DB_NAME=ALL # [ALL] not working on sql server.
# create database with name `test1` manually first
- DB_NAME=test1 # Create this database
- DB_USER=sa
- DB_PASS=5hQa0utRFBpIY3yhoIyE
- DB_DUMP_FREQ=1 # backup every 5 minute
# - DB_DUMP_BEGIN=0000 # backup starts immediately
- DB_CLEANUP_TIME=3 # clean backups they are older than 60 minutes
- ENABLE_CHECKSUM=TRUE
- CHECKSUM=SHA1
- COMPRESSION=GZ
- SPLIT_DB=FALSE
- TIMEZONE=America/Vancouver
- CONTAINER_ENABLE_MONITORING=FALSE
- CONTAINER_NAME=example-mssql-blobxfer-db-backup
# - DEBUG_MODE=TRUE
- DB01_TYPE=mssql
- DB01_HOST=example-db-host
# - DB01_PORT=1488
# create database with name `test1` manually first
- DB01_NAME=test1 # Create this database
- DB01_USER=sa
- DB01_PASS=5hQa0utRFBpIY3yhoIyE
- DB01_BACKUP_INTERVAL=5 # backup every 5 minute
# - DB01_DUMP_BEGIN=0000 # backup starts at midnight vs not set immediately
- DB01_CLEANUP_TIME=60 # clean backups they are older than 60 minutes
- DB01_CHECKSUM=SHA1 # Set Checksum to be SHA1
- DB01_COMPRESSION=GZ # Set compression to use GZIP
# === S3 Blobxfer ===
- BACKUP_LOCATION=blobxfer
- DB01_BACKUP_LOCATION=blobxfer
# Add here azure storage account
- BLOBXFER_STORAGE_ACCOUNT={TODO Add Storage Name}
- DB01_BLOBXFER_STORAGE_ACCOUNT={TODO Add Storage Name}
# Add here azure storage account key
- BLOBXFER_STORAGE_ACCOUNT_KEY={TODO Add Key}
- BLOBXFER_REMOTE_PATH=docker-db-backup
- DB01_BLOBXFER_STORAGE_ACCOUNT_KEY={TODO Add Key}
- DB01_BLOBXFER_REMOTE_PATH=docker-db-backup
restart: always
networks:
example-mssql-blobxfer-net:
example-mssql-blobxfer-net:
networks:
example-mssql-blobxfer-net:
name: example-mssql-blobxfer-net

View File

@@ -1,12 +1,6 @@
#
#
# Example for Microsoft SQL Server
#
version: '2'
networks:
example-mssql-net:
name: example-mssql-net
#
services:
example-mssql-db:
@@ -31,7 +25,7 @@ services:
# execute in terminal --> docker build -t tiredofit/db-backup-mssql .
# replace --> image: tiredofit/db-backup-mssql
# image: tiredofit/db-backup
image: tiredofit/db-backup-mssql
image: tiredofit/db-backup
links:
- example-mssql-db
volumes:
@@ -39,23 +33,28 @@ services:
- ./tmp/backups:/tmp/backups # shared tmp backup directory
#- ./post-script.sh:/assets/custom-scripts/post-script.sh
environment:
- TIMEZONE=America/Vancouver
- CONTAINER_ENABLE_MONITORING=FALSE
- CONTAINER_NAME=example-mssql-blobxfer-db-backup
# - DEBUG_MODE=TRUE
- DB_TYPE=mssql
- DB_HOST=example-db-host
- DB01_TYPE=mssql
- DB01_HOST=example-db-host
# - DB_PORT=1488
# - DB_NAME=ALL # [ALL] not working on sql server.
# create database with name `test1` manually first
- DB_NAME=test1
- DB_USER=sa
- DB_PASS=5hQa0utRFBpIY3yhoIyE
- DB_DUMP_FREQ=1 # backup every minute
# - DB_DUMP_BEGIN=0000 # backup starts immediately
- DB_CLEANUP_TIME=5 # clean backups they are older than 5 minute
- ENABLE_CHECKSUM=FALSE
- CHECKSUM=SHA1
- COMPRESSION=GZ
- SPLIT_DB=FALSE
- CONTAINER_ENABLE_MONITORING=FALSE
- DB01_NAME=test1
- DB01_USER=sa
- DB01_PASS=5hQa0utRFBpIY3yhoIyE
- DB01_BACKUP_INTERVAL=1 # backup every minute
# - DB01_DUMP_BEGIN=0000 # backup starts at midnight vs unset immediately
- DB01_CLEANUP_TIME=5 # clean backups they are older than 5 minute
- DB01_CHECKSUM=NONE
- DB01_COMPRESSION=GZ
restart: always
networks:
example-mssql-net:
example-mssql-net:
networks:
example-mssql-net:
name: example-mssql-net

View File

@@ -1,53 +0,0 @@
version: '2'
networks:
example-db-network:
name: example-db-network
services:
example-db:
hostname: example-db-host
container_name: example-db
image: mariadb:latest
ports:
- 13306:3306
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=examplerootpassword
- MYSQL_DATABASE=example
- MYSQL_USER=example
- MYSQL_PASSWORD=examplepassword
restart: always
networks:
- example-db-network
example-db-backup:
container_name: example-db-backup
image: tiredofit/db-backup
links:
- example-db
volumes:
- ./backups:/backup
#- ./post-script.sh:/assets/custom-scripts/post-script.sh
environment:
- TIMEZONE=America/Vancouver
- CONTAINER_ENABLE_MONITORING=FALSE
# - DEBUG_MODE=TRUE
- DB_TYPE=mariadb
- DB_HOST=example-db-host
- DB_NAME=example
- DB_USER=example
- DB_PASS=examplepassword
- DB_DUMP_FREQ=1 # backup every minute
# - DB_DUMP_BEGIN=0000 # backup starts immediately
- DB_CLEANUP_TIME=5 # clean backups they are older than 5 minute
- CHECKSUM=SHA1
- COMPRESSION=GZ
- SPLIT_DB=FALSE
restart: always
networks:
- example-db-network

View File

@@ -4,7 +4,7 @@
# #### $1=EXIT_CODE (After running backup routine)
# #### $2=DB_TYPE (Type of Backup)
# #### $3=DB_HOST (Backup Host)
# #### #4=DB_NAME (Name of Database backed up
# #### #4=DB_NAME (Name of Database backed up)
# #### $5=BACKUP START TIME (Seconds since Epoch)
# #### $6=BACKUP FINISH TIME (Seconds since Epoch)
# #### $7=BACKUP TOTAL TIME (Seconds between Start and Finish)

View File

@@ -0,0 +1,120 @@
#!/command/with-contenv bash
source /assets/functions/00-container
PROCESS_NAME="db-backup{{BACKUP_NUMBER}}-scheduler"
check_container_initialized
check_service_initialized init 10-db-backup
source /assets/functions/10-db-backup
source /assets/defaults/10-db-backup
bootstrap_variables backup_init {{BACKUP_NUMBER}}
bootstrap_variables parse_variables {{BACKUP_NUMBER}}
if [ -z "${backup_job_db_name}" ]; then
PROCESS_NAME="{{BACKUP_NUMBER}}${backup_job_db_host//\//_}"
else
PROCESS_NAME="{{BACKUP_NUMBER}}-${backup_job_db_host//\//_}__${backup_job_db_name}"
fi
trap ctrl_c INT
if [[ "${MODE,,}" =~ "standalone" ]] || [ "${MODE,,}" = "manual" ] || [ "${1,,}" = "manual" ] || [ "${1,,}" = "now" ]; then
print_debug "Detected Manual Mode"
persist=false
backup_job_backup_begin=+0
else
silent sleep {{BACKUP_NUMBER}}
time_last_run=0
time_current=$(date +'%s')
if [[ "${backup_job_backup_begin}" =~ ^\+(.*)$ ]]; then
print_debug "BACKUP_BEGIN is a jump of minute starting with +"
timer plusvalue
elif [[ "${backup_job_backup_begin}" =~ ^[0-9]{4}$ ]]; then
print_debug "BACKUP_BEGIN is a HHMM value"
timer time
elif [[ "${backup_job_backup_begin}" =~ ([0-9]{4})-([0-9]{2})-([0-9]{2})[[:space:]]([0-9]{2}):([0-9]{2}):([0-9]{2}) ]]; then
print_debug "BACKUP_BEGIN is a full date timestamp"
timer datetime
#elif echo "${backup_job_backup_begin//\*/#}" | grep -qP "^(.*((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|#) ?){5}$" ; then # Allow slashes, yet not supporting advanced cron yet
elif echo "${backup_job_backup_begin//\*/#}" | grep -qP "^(((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|#) ?){5}$" ; then
print_debug "BACKUP_BEGIN is a cron expression"
if var_false "${CRON_ALTERNATE}"; then
time_last_run=$(date +"%s")
backup_job_backup_begin=${backup_job_backup_begin//\"/}
backup_job_backup_begin=${backup_job_backup_begin//\'/}
timer cron "${backup_job_backup_begin}" "${time_current}" "${time_last_run}"
else
echo "${backup_job_backup_begin} /var/run/s6/legacy-services/dbbackup-{{BACKUP_NUMBER}}/run now" > /tmp/.container/cron/{{BACKUP_NUMBER}}-backup
crontab -l | { cat; echo "${backup_job_backup_begin} /var/run/s6/legacy-services/dbbackup-{{BACKUP_NUMBER}}/run now"; } | crontab -
s6-svc -d /var/run/s6/legacy-services/dbbackup-{{BACKUP_NUMBER}}
exit 0
fi
else
print_error "_BACKUP_BEGIN is invalid - Unable to perform scheduling"
cat <<EOF
Valid Methods:
+(number) - Start in however many minutes
HHMM - Start at hour (00-24) and minute (00-59)
YYYY-MM-DD HH:mm:ss - Start at a specific date and time
0 23 * * * - Cron expression
EOF
print_error "Stopping backup_scheduler {{BACKUP_NUMBER}} due to detected errors. Fix and restart container."
stop_scheduler_backup=true
s6-svc -d /var/run/s6/legacy-services/dbbackup-{{BACKUP_NUMBER}}
fi
print_debug "Wait Time: ${time_wait} Future execution time: ${time_future} Current Time: ${time_current}"
print_info "Next Backup at $(date -d @"${time_future}" +'%Y-%m-%d %T %Z')"
silent sleep "${time_wait}"
fi
while true; do
if [ -n "${backup_job_blackout_start}" ] && [ -n "${backup_job_blackout_finish}" ] ; then
time_current_hour_minute=$(date +%H%M)
if [[ "${time_current_hour_minute}" > "${backup_job_blackout_start}" ]] && [[ "${time_current_hour_minute}" < "${backup_job_blackout_finish}" ]] ; then
blackout=true
else
blackout=false
fi
fi
if var_true "${blackout}" ; then
print_notice "Detected Blackout Period - Not performing backup operations"
else
timer job start
process_limiter
echo "{{BACKUP_NUMBER}}" >> /tmp/.container/db-backup-backups
print_debug "Backup {{BACKUP_NUMBER}} routines started time: $(date +'%Y-%m-%d %T %Z')"
bootstrap_filesystem
check_availability
backup_"${dbtype,,}"
timer job stop
if [ -z "${exitcode_backup}" ] ; then exitcode_backup="0" ; fi
print_info "Backup {{BACKUP_NUMBER}} routines finish time: $(date -d @"${backup_job_finish_time}" +'%Y-%m-%d %T %Z') with exit code ${exitcode_backup}"
print_notice "Backup {{BACKUP_NUMBER}} routines time taken: $(echo "${backup_job_total_time}" | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
sed -i "/^{{BACKUP_NUMBER}}/d" /tmp/.container/db-backup-backups
fi
symlink_log
if var_false "${persist}" ; then
print_debug "Exiting due to manual mode"
exit "${exitcode_backup}";
else
if var_true "${stop_scheduler_backup}" ; then
print_error "Stopping backup_scheduler {{BACKUP_NUMBER}} due to detected errors. Fix and restart container."
s6-svc -d /var/run/s6/legacy-services/dbbackup-{{BACKUP_NUMBER}}
else
if [ ! "${time_cron}" = "true" ]; then
print_notice "Sleeping for another $((backup_job_backup_interval*60-backup_job_total_time)) seconds. Waking up at $(date -d@"$(( $(date +%s)+$((backup_job_backup_interval*60-backup_job_total_time))))" +'%Y-%m-%d %T %Z') "
silent sleep $((backup_job_backup_interval*60-backup_job_total_time))
else
time_last_run=$(date +"%s")
timer cron "${backup_job_backup_begin}" "${time_current}" "${time_last_run}"
print_notice "Sleeping for another ${time_wait} seconds. Waking up at $(date -d@"${time_future}" +'%Y-%m-%d %T %Z') "
silent sleep "${time_wait}"
fi
fi
fi
done

View File

@@ -1,32 +1,48 @@
#!/command/with-contenv bash
BACKUP_LOCATION=${BACKUP_LOCATION:-"FILESYSTEM"}
BLOBXFER_REMOTE_PATH=${BLOBXFER_REMOTE_PATH:-"/docker-db-backup"}
CHECKSUM=${CHECKSUM:-"MD5"}
COMPRESSION=${COMPRESSION:-"ZSTD"}
COMPRESSION_LEVEL=${COMPRESSION_LEVEL:-"3"}
CREATE_LATEST_SYMLINK=${CREATE_LATEST_SYMLINK:-"TRUE"}
DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0}
DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440}
DB_DUMP_TARGET=${DB_DUMP_TARGET:-"/backup"}
DB_DUMP_TARGET_ARCHIVE=${DB_DUMP_TARGET_ARCHIVE:-"${DB_DUMP_TARGET}/archive/"}
ENABLE_CHECKSUM=${ENABLE_CHECKSUM:-"TRUE"}
ENABLE_PARALLEL_COMPRESSION=${ENABLE_PARALLEL_COMPRESSION:-"TRUE"}
BACKUP_JOB_CONCURRENCY=${BACKUP_JOB_CONCURRENCY:-"1"}
CRON_ALTERNATE=${CRON_ALTERNATE:-"TRUE"}
DBBACKUP_USER=${DBBACKUP_USER:-"dbbackup"}
DBBACKUP_GROUP=${DBBACKUP_GROUP:-"${DBBACKUP_USER}"} # Must go after DBBACKUP_USER
DEFAULT_BACKUP_BEGIN=${DEFAULT_BACKUP_BEGIN:-+0}
DEFAULT_BACKUP_INTERVAL=${DEFAULT_BACKUP_INTERVAL:-1440}
DEFAULT_BACKUP_LOCATION=${DEFAULT_BACKUP_LOCATION:-"FILESYSTEM"}
DEFAULT_BLOBXFER_REMOTE_PATH=${DEFAULT_BLOBXFER_REMOTE_PATH:-"/docker-db-backup"}
DEFAULT_BLOBXFER_MODE=${DEFAULT_BLOBXFER_MODE:-"auto"}
DEFAULT_CHECKSUM=${DEFAULT_CHECKSUM:-"MD5"}
DEFAULT_COMPRESSION=${DEFAULT_COMPRESSION:-"ZSTD"}
DEFAULT_COMPRESSION_LEVEL=${DEFAULT_COMPRESSION_LEVEL:-"3"}
DEFAULT_CREATE_LATEST_SYMLINK=${DEFAULT_CREATE_LATEST_SYMLINK:-"TRUE"}
DEFAULT_ENABLE_PARALLEL_COMPRESSION=${DEFAULT_ENABLE_PARALLEL_COMPRESSION:-"TRUE"}
DEFAULT_ENCRYPT=${DEFAULT_ENCRYPT:-"FALSE"}
DEFAULT_FILESYSTEM_PATH=${DEFAULT_FILESYSTEM_PATH:-"/backup"}
DEFAULT_FILESYSTEM_PATH_PERMISSION=${DEFAULT_FILESYSTEM_PATH_PERMISSION:-"700"}
DEFAULT_FILESYSTEM_PERMISSION=${DEFAULT_FILESYSTEM_PERMISSION:-"600"}
DEFAULT_FILESYSTEM_ARCHIVE_PATH=${DEFAULT_FILESYSTEM_ARCHIVE_PATH:-"${DEFAULT_FILESYSTEM_PATH}/archive/"}
DEFAULT_LOG_LEVEL=${DEFAULT_LOG_LEVEL:-"notice"}
DEFAULT_MYSQL_CLIENT=${DEFAULT_MYSQL_CLIENT:-"mariadb"}
DEFAULT_MYSQL_ENABLE_TLS=${DEFAULT_MYSQL_ENABLE_TLS:-"FALSE"}
DEFAULT_MYSQL_EVENTS=${DEFAULT_MYSQL_EVENTS:-"TRUE"}
DEFAULT_MYSQL_MAX_ALLOWED_PACKET=${DEFAULT_MYSQL_MAX_ALLOWED_PACKET:-"512M"}
DEFAULT_MYSQL_SINGLE_TRANSACTION=${DEFAULT_MYSQL_SINGLE_TRANSACTION:-"TRUE"}
DEFAULT_MYSQL_STORED_PROCEDURES=${DEFAULT_MYSQL_STORED_PROCEDURES:-"TRUE"}
DEFAULT_MYSQL_TLS_CA_FILE=${DEFAULT_MYSQL_TLS_CA_FILE:-"/etc/ssl/cert.pem"}
DEFAULT_MYSQL_TLS_VERIFY=${DEFAULT_MYSQL_TLS_VERIFY:-"FALSE"}
DEFAULT_MYSQL_TLS_VERSION=${DEFAULT_MYSQL_TLS_VERSION:-"TLSv1.1,TLSv1.2,TLSv1.3"}
DEFAULT_MSSQL_MODE=${DEFAULT_MSSQL_MODE:-"database"}
DEFAULT_PARALLEL_COMPRESSION_THREADS=${DEFAULT_PARALLEL_COMPRESSION_THREADS:-"$(nproc)"}
DEFAULT_RESOURCE_OPTIMIZED=${DEFAULT_RESOURCE_OPTIMIZED:-"FALSE"}
DEFAULT_S3_CERT_SKIP_VERIFY=${DEFAULT_S3_CERT_SKIP_VERIFY:-"TRUE"}
DEFAULT_S3_PROTOCOL=${DEFAULT_S3_PROTOCOL:-"https"}
DEFAULT_SCRIPT_LOCATION_PRE=${DEFAULT_SCRIPT_LOCATION_PRE:-"/assets/scripts/pre/"}
DEFAULT_SCRIPT_LOCATION_POST=${DEFAULT_SCRIPT_LOCATION_POST:-"/assets/scripts/post/"}
DEFAULT_SIZE_VALUE=${DEFAULT_SIZE_VALUE:-"bytes"}
DEFAULT_SKIP_AVAILABILITY_CHECK=${DEFAULT_SKIP_AVAILABILITY_CHECK:-"FALSE"}
DEFAULT_SPLIT_DB=${DEFAULT_SPLIT_DB:-"TRUE"}
LOG_PATH=${LOG_PATH:-"/logs"}
MANUAL_RUN_FOREVER=${MANUAL_RUN_FOREVER:-"TRUE"}
MODE=${MODE:-"AUTO"}
MYSQL_ENABLE_TLS=${MYSQL_ENABLE_TLS:-"FALSE"}
MYSQL_MAX_ALLOWED_PACKET=${MYSQL_MAX_ALLOWED_PACKET:-"512M"}
MYSQL_SINGLE_TRANSACTION=${MYSQL_SINGLE_TRANSACTION:-"TRUE"}
MYSQL_STORED_PROCEDURES=${MYSQL_STORED_PROCEDURES:-"TRUE"}
MYSQL_TLS_CA_FILE=${MYSQL_TLS_CA_FILE:-"/etc/ssl/cert.pem"}
MYSQL_TLS_VERIFY=${MYSQL_TLS_VERIFY:-"FALSE"}
MYSQL_TLS_VERSION=${MYSQL_TLS_VERSION:-"TLSv1.1,TLSv1.2,TLSv1.3"}
PARALLEL_COMPRESSION_THREADS=${PARALLEL_COMPRESSION_THREADS:-"$(nproc)"}
S3_CERT_SKIP_VERIFY=${S3_CERT_SKIP_VERIFY:-"TRUE"}
S3_PROTOCOL=${S3_PROTOCOL:-"https"}
SCRIPT_LOCATION_PRE=${SCRIPT_LOCATION_PRE:-"/assets/scripts/pre/"}
SCRIPT_LOCATION_POST=${SCRIPT_LOCATION_POST:-"/assets/scripts/post/"}
SIZE_VALUE=${SIZE_VALUE:-"bytes"}
SKIP_AVAILABILITY_CHECK=${SKIP_AVAILABILITY_CHECK:-"FALSE"}
SPLIT_DB=${SPLIT_DB:-"TRUE"}
TEMP_LOCATION=${TEMP_LOCATION:-"/tmp/backups"}
TEMP_PATH=${TEMP_PATH:-"/tmp/backups"}
if [ -n "${TEMP_LOCATION}" ] ; then TEMP_PATH=${TEMP_LOCATION:-"/tmp/backups"} ; fi # To be removed 4.3.0

File diff suppressed because it is too large Load Diff

View File

@@ -6,9 +6,9 @@ prepare_service 03-monitoring
PROCESS_NAME="db-backup"
output_off
bootstrap_variables
sanity_test
setup_mode
create_zabbix dbbackup
db_backup_container_init
create_schedulers backup
create_zabbix dbbackup4
liftoff

View File

@@ -1,88 +0,0 @@
#!/command/with-contenv bash
source /assets/functions/00-container
source /assets/functions/10-db-backup
source /assets/defaults/10-db-backup
PROCESS_NAME="db-backup"
bootstrap_variables
if [ "${MODE,,}" = "manual" ] || [ "${1,,}" = "manual" ] || [ "${1,,}" = "now" ]; then
DB_DUMP_BEGIN=+0
manual=TRUE
print_debug "Detected Manual Mode"
else
sleep 5
current_time=$(date +"%s")
today=$(date +"%Y%m%d")
if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
target_time=$(($current_time + $waittime))
else
target_time=$(date --date="${today}${DB_DUMP_BEGIN}" +"%s")
if [[ "$target_time" < "$current_time" ]]; then
target_time=$(($target_time + 24*60*60))
fi
waittime=$(($target_time - $current_time))
fi
print_debug "Wait Time: ${waittime} Target time: ${target_time} Current Time: ${current_time}"
print_info "Next Backup at $(date -d @${target_time} +"%Y-%m-%d %T %Z")"
sleep $waittime
fi
while true; do
mkdir -p "${TEMP_LOCATION}"
backup_start_time=$(date +"%s")
print_debug "Backup routines started time: $(date +'%Y-%m-%d %T %Z')"
case "${dbtype,,}" in
"couch" )
check_availability
backup_couch
;;
"influx" )
check_availability
backup_influx
;;
"mssql" )
check_availability
backup_mssql
;;
"mysql" )
check_availability
backup_mysql
;;
"mongo" )
check_availability
backup_mongo
;;
"pgsql" )
check_availability
backup_pgsql
;;
"redis" )
check_availability
backup_redis
;;
"sqlite3" )
check_availability
backup_sqlite3
;;
esac
backup_finish_time=$(date +"%s")
backup_total_time=$(echo $((backup_finish_time-backup_start_time)))
if [ -z "$master_exit_code" ] ; then master_exit_code="0" ; fi
print_info "Backup routines finish time: $(date -d @${backup_finish_time} +"%Y-%m-%d %T %Z") with overall exit code ${master_exit_code}"
print_notice "Backup routines time taken: $(echo ${backup_total_time} | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
cleanup_old_data
if var_true "${manual}" ; then
print_debug "Exiting due to manual mode"
exit ${master_exit_code};
else
print_notice "Sleeping for another $(($DB_DUMP_FREQ*60-backup_total_time)) seconds. Waking up at $(date -d@"$(( $(date +%s)+$(($DB_DUMP_FREQ*60-backup_total_time))))" +"%Y-%m-%d %T %Z") "
sleep $(($DB_DUMP_FREQ*60-backup_total_time))
fi
done

View File

@@ -1,4 +0,0 @@
#!/command/with-contenv bash
echo '** Performing Manual Backup'
/etc/services.available/10-db-backup/run manual

View File

@@ -0,0 +1,24 @@
#!/command/with-contenv bash
source /assets/functions/00-container
source /assets/defaults/05-logging
source /assets/defaults/10-db-backup
## Compress each log 2 days old
timestamp_2dayold_unixtime="$(stat -c %Y "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')")"
for logfile in "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')"/"$(date --date='2 days ago' +'%Y%m%d')"_*.log ; do
sudo -u restic zstd --rm --rsyncable "${logfile}"
done
touch -t $(date -d"@${timestamp_2dayold_unixtime}" +'%Y%m%d%H%m.%S') "${LOG_PATH}"/"$(date --date='2 days ago' +'%Y%m%d')"
# Look fook files older than certain day and delete
if [ -n "${LOG_PATH}" ] && [ -d "${LOG_PATH}" ] ; then
find "${LOG_PATH}" -mtime +"${LOGROTATE_RETAIN_DAYS}" -type d -exec rm -rf {} +
fi
# Look for stale symbolic links and delete accordingly
for symbolic_link in "${LOG_PATH}"/latest*.log ; do
if [ ! -e "${symbolic_link}" ] ; then
rm -rf "${symbolic_link}"
fi
done

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,9 @@
{
"zabbix_export": {
"version": "6.0",
"date": "2022-03-18T13:32:12Z",
"groups": [
"version": "6.4",
"template_groups": [
{
"uuid": "fa56524b5dbb4ec09d9777a6f7ccfbe4",
"uuid": "10b88d2b3a3a4c72b43bdce9310e1162",
"name": "DB/Backup"
},
{
@@ -14,10 +13,10 @@
],
"templates": [
{
"uuid": "5fc64d517afb4cc5bc09a3ef58b43ef7",
"template": "DB Backup",
"name": "DB Backup",
"description": "Template for Docker DB Backup Image\n\nMeant for use specifically with https://github.com/tiredofit/docker-db-backup\nLast tested with version 3.0.2",
"uuid": "5a16c1bd694145389eed5ee803d954cc",
"template": "DB Backup4",
"name": "DB Backup4",
"description": "Template for Docker DB Backup Image\n\nMeant for use specifically with https://github.com/tiredofit/docker-db-backup Version > 4.0.0\n\nSupports auto discovery of backup jobs and creates graphs and triggers",
"groups": [
{
"name": "DB/Backup"
@@ -26,134 +25,260 @@
"name": "Templates/Databases"
}
],
"items": [
"discovery_rules": [
{
"uuid": "72fd00fa2dd24e479f5affe03e8711d8",
"name": "DB Backup: Backup Duration",
"uuid": "94bb6f862e1841f8b2834b04c41c1d86",
"name": "Backup",
"type": "TRAP",
"key": "dbbackup.backup_duration",
"key": "dbbackup.backup",
"delay": "0",
"history": "7d",
"units": "uptime",
"description": "How long the backup took",
"tags": [
"item_prototypes": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"uuid": "3549a2c9d56849babc6dc3c855484c1e",
"name": "DB Backup: Backup Time",
"type": "TRAP",
"key": "dbbackup.datetime",
"delay": "0",
"history": "7d",
"units": "unixtime",
"request_method": "POST",
"tags": [
"uuid": "5a2c4d1cacf844829bc1fbf912e071c5",
"name": "[{#NAME}] Checksum - Duration",
"type": "TRAP",
"key": "dbbackup.backup.checksum.duration.[{#NAME}]",
"delay": "0",
"history": "7d",
"units": "uptime",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"tag": "Application",
"value": "DB Backup"
"uuid": "6e49769ec07344a4974b13dab00c3539",
"name": "[{#NAME}] Checksum - Hash",
"type": "TRAP",
"key": "dbbackup.backup.checksum.hash.[{#NAME}]",
"delay": "0",
"history": "30d",
"trends": "0",
"value_type": "TEXT",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"uuid": "bb6472e30bff4d9c908b1d34b893e622",
"name": "[{#NAME}] Backup - Last Backup",
"type": "TRAP",
"key": "dbbackup.backup.datetime.[{#NAME}]",
"delay": "0",
"history": "7d",
"units": "unixtime",
"description": "Datestamp of last database backup",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
],
"trigger_prototypes": [
{
"uuid": "3681b56bb882466fb304a48b4beb15f0",
"expression": "fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],172800s)=0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],259200s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],345600s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],432800s)<>0",
"name": "[{#NAME}] No backups detected in 2 days",
"priority": "HIGH",
"manual_close": "YES"
},
{
"uuid": "6c70136c84994197b6396a143b4e956f",
"expression": "fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],172800s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],259200s)=0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],345600s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],432800s)<>0",
"name": "[{#NAME}] No backups detected in 3 days",
"priority": "DISASTER",
"manual_close": "YES"
},
{
"uuid": "d2038025cab643019cb9610c301f0cb9",
"expression": "fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],172800s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],259200s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],345600s)=0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],432800s)<>0",
"name": "[{#NAME}] No backups detected in 4 days",
"priority": "DISASTER",
"manual_close": "YES"
},
{
"uuid": "ea85f02d032c4a1dbc1b6e91a3b2b37b",
"expression": "fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],172800s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],259200s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],345600s)<>0 and fuzzytime(/DB Backup4/dbbackup.backup.datetime.[{#NAME}],432800s)=0",
"name": "[{#NAME}] No backups detected in 5 days",
"priority": "DISASTER",
"manual_close": "YES"
}
]
},
{
"uuid": "8ec2b2f44ddf4f36b3dbb2aa15e3a32f",
"name": "[{#NAME}] Backup - Duration",
"type": "TRAP",
"key": "dbbackup.backup.duration.[{#NAME}]",
"delay": "0",
"history": "7d",
"units": "uptime",
"description": "How long the DB Backup job took",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"uuid": "3f0dc3c75261447c93482815c3d69524",
"name": "[{#NAME}] Encrypt - Duration",
"type": "TRAP",
"key": "dbbackup.backup.encrypt.duration.[{#NAME}]",
"delay": "0",
"history": "7d",
"units": "uptime",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"uuid": "c3d5ad0789c443859d6a673e03db9cec",
"name": "[{#NAME}] Backup - Filename",
"type": "TRAP",
"key": "dbbackup.backup.filename.[{#NAME}]",
"delay": "0",
"history": "30d",
"trends": "0",
"value_type": "TEXT",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
]
},
{
"uuid": "43b700c03897465eb7e49bbfe8fc9fc5",
"name": "[{#NAME}] Backup - Size",
"type": "TRAP",
"key": "dbbackup.backup.size.[{#NAME}]",
"delay": "0",
"history": "7d",
"description": "Backup Size",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
],
"trigger_prototypes": [
{
"uuid": "849f8660bee04427aff55af47b6f509c",
"expression": "last(/DB Backup4/dbbackup.backup.size.[{#NAME}])/last(/DB Backup4/dbbackup.backup.size.[{#NAME}],#2)>1.2",
"name": "[{#NAME}] Backup 20% Greater in size",
"priority": "WARNING",
"manual_close": "YES"
},
{
"uuid": "74d16a7680544c65af22cc568ce3d59d",
"expression": "last(/DB Backup4/dbbackup.backup.size.[{#NAME}])/last(/DB Backup4/dbbackup.backup.size.[{#NAME}],#2)<0.2",
"name": "[{#NAME}] Backup 20% Smaller in Size",
"priority": "WARNING",
"manual_close": "YES"
},
{
"uuid": "5595d769c73f4eaeadda95c84c2c0f17",
"expression": "last(/DB Backup4/dbbackup.backup.size.[{#NAME}])<1K",
"name": "[{#NAME}] Backup Empty",
"priority": "HIGH",
"manual_close": "YES"
}
]
},
{
"uuid": "a6fc542a565c4baba8429ed9ab31b5ae",
"name": "[{#NAME}] Backup - Status",
"type": "TRAP",
"key": "dbbackup.backup.status.[{#NAME}]",
"delay": "0",
"history": "7d",
"description": "Maps exit code by DB Backup procedure",
"valuemap": {
"name": "Backup Status"
},
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
],
"trigger_prototypes": [
{
"uuid": "74b91e28453b4c2a84743f5e371495c1",
"expression": "last(/DB Backup4/dbbackup.backup.status.[{#NAME}])=1",
"name": "[{#NAME}] Backup - Failed with errors",
"priority": "WARNING",
"manual_close": "YES"
}
]
}
],
"triggers": [
"graph_prototypes": [
{
"uuid": "3ac1e074ffea46eb8002c9c08a85e7b4",
"expression": "nodata(/DB Backup/dbbackup.datetime,2d)=1",
"name": "DB-Backup: No backups detected in 2 days",
"priority": "DISASTER",
"manual_close": "YES"
"uuid": "b5e8e9fe0c474fedba2b06366234afdf",
"name": "[{#NAME}] Backup Duration",
"graph_items": [
{
"color": "199C0D",
"calc_fnc": "ALL",
"item": {
"host": "DB Backup4",
"key": "dbbackup.backup.duration.[{#NAME}]"
}
}
]
},
{
"uuid": "b8b5933dfa1a488c9c37dd7f4784c1ff",
"expression": "fuzzytime(/DB Backup/dbbackup.datetime,172800s)=0 and fuzzytime(/DB Backup/dbbackup.datetime,259200s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,345600s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,432800s)<>0",
"name": "DB Backup: No Backups occurred in 2 days",
"priority": "AVERAGE"
"uuid": "99b5deb4e28f40059c50846c7be2ef26",
"name": "[{#NAME}] Backup Size",
"graph_items": [
{
"color": "199C0D",
"calc_fnc": "ALL",
"item": {
"host": "DB Backup4",
"key": "dbbackup.backup.size.[{#NAME}]"
}
}
]
},
{
"uuid": "35c5f420d0e142cc9601bae38decdc40",
"expression": "fuzzytime(/DB Backup/dbbackup.datetime,172800s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,259200s)=0 and fuzzytime(/DB Backup/dbbackup.datetime,345600s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,432800s)<>0",
"name": "DB Backup: No Backups occurred in 3 days",
"priority": "AVERAGE"
"uuid": "8c641e33659e4c8b866da64e252cfc2a",
"name": "[{#NAME}] Checksum Duration",
"graph_items": [
{
"color": "199C0D",
"calc_fnc": "ALL",
"item": {
"host": "DB Backup4",
"key": "dbbackup.backup.checksum.duration.[{#NAME}]"
}
}
]
},
{
"uuid": "03c3719d82c241e886a0383c7d908a77",
"expression": "fuzzytime(/DB Backup/dbbackup.datetime,172800s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,259200s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,345600s)=0 and fuzzytime(/DB Backup/dbbackup.datetime,432800s)<>0",
"name": "DB Backup: No Backups occurred in 4 days",
"priority": "AVERAGE"
},
{
"uuid": "1634a03e44964e42b7e0101f5f68499c",
"expression": "fuzzytime(/DB Backup/dbbackup.datetime,172800s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,259200s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,345600s)<>0 and fuzzytime(/DB Backup/dbbackup.datetime,432800s)=0",
"name": "DB Backup: No Backups occurred in 5 days or more",
"priority": "HIGH"
}
]
},
{
"uuid": "467dfec952b34f5aa4cc890b4351b62d",
"name": "DB Backup: Backup Size",
"type": "TRAP",
"key": "dbbackup.size",
"delay": "0",
"history": "7d",
"units": "B",
"request_method": "POST",
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
],
"triggers": [
{
"uuid": "a41eb49b8a3541afb6de247dca750e38",
"expression": "last(/DB Backup/dbbackup.size)/last(/DB Backup/dbbackup.size,#2)>1.2",
"name": "DB Backup: 20% Greater in Size",
"priority": "WARNING",
"manual_close": "YES"
},
{
"uuid": "422f66be5049403293f3d96fc53f20cd",
"expression": "last(/DB Backup/dbbackup.size)/last(/DB Backup/dbbackup.size,#2)<0.2",
"name": "DB Backup: 20% Smaller in Size",
"priority": "WARNING",
"manual_close": "YES"
},
{
"uuid": "d6d9d875b92f4d799d4bc89aabd4e90e",
"expression": "last(/DB Backup/dbbackup.size)<1K",
"name": "DB Backup: empty",
"priority": "HIGH"
}
]
},
{
"uuid": "a6b13e8b46a64abab64a4d44d620d272",
"name": "DB Backup: Last Backup Status",
"type": "TRAP",
"key": "dbbackup.status",
"delay": "0",
"history": "7d",
"description": "Maps Exit Codes received by backup applications",
"valuemap": {
"name": "DB Backup Status"
},
"tags": [
{
"tag": "Application",
"value": "DB Backup"
}
],
"triggers": [
{
"uuid": "23d71e356f96493180f02d4b84a79fd6",
"expression": "last(/DB Backup/dbbackup.status)=1",
"name": "DB Backup: Failed Backup Detected",
"priority": "HIGH",
"manual_close": "YES"
"uuid": "65b8770f71ed4cff9111b82c42b17571",
"name": "[{#NAME}] Encrypt Duration",
"graph_items": [
{
"color": "199C0D",
"calc_fnc": "ALL",
"item": {
"host": "DB Backup4",
"key": "dbbackup.backup.encrypt.duration.[{#NAME}]"
}
}
]
}
]
}
@@ -168,38 +293,10 @@
"value": "Database"
}
],
"dashboards": [
{
"uuid": "90c81bb47184401ca9663626784a6f30",
"name": "DB Backup",
"pages": [
{
"widgets": [
{
"type": "GRAPH_CLASSIC",
"name": "Backup Size",
"width": "23",
"height": "5",
"fields": [
{
"type": "GRAPH",
"name": "graphid",
"value": {
"name": "DB Backup: Backup Size",
"host": "DB Backup"
}
}
]
}
]
}
]
}
],
"valuemaps": [
{
"uuid": "82f3a3d01b3c42b8942b59d2363724e0",
"name": "DB Backup Status",
"uuid": "92a87279388b4fd1ac51c1e417e1776e",
"name": "Backup Status",
"mappings": [
{
"value": "0",
@@ -214,36 +311,6 @@
}
]
}
],
"graphs": [
{
"uuid": "6e02c200b76046bab76062cd1ab086b2",
"name": "DB Backup: Backup Duration",
"graph_items": [
{
"color": "199C0D",
"item": {
"host": "DB Backup",
"key": "dbbackup.backup_duration"
}
}
]
},
{
"uuid": "b881ee18f05c4f4c835982c9dfbb55d6",
"name": "DB Backup: Backup Size",
"type": "STACKED",
"graph_items": [
{
"sortorder": "1",
"color": "1A7C11",
"item": {
"host": "DB Backup",
"key": "dbbackup.size"
}
}
]
}
]
}
}