diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e949d..b17d6df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,483 +1,493 @@ ## 3.11.1 2023-10-23 - ### Added +### Added + - Switch to tiredofit/alpine:edge for newer packages - Postgresql 16 support - ### Changed - - Add --break-system-packages flag to pip when installing blobxfer +### Changed + - Add --break-system-packages flag to pip when installing blobxfer ## 3.11.0 2023-10-12 - ### Added +### Added + - Introduce aarch64 (ARMv8) support for Microsoft SQL Server backups - Microsoft ODBC Driver 18.3.2.1-1 - Microsoft SQL Client 18.3.1.1-1 - ## 3.10.5 2023-10-11 - ### Added - - Add option to drop exsiting data from MongoDB restore +### Added + + - Add option to drop existing data from MongoDB restore + +### Changed - ### Changed - Fix some capabilities of not being able to select mongodb manually to restore - ## 3.10.4 2023-10-11 - ### Changed - - Use authentication database for MongoDB restores +### Changed + - Use authentication database for MongoDB restores ## 3.10.3 2023-10-11 - ### Changed - - Change sorting for restore script +### Changed + - Change sorting for restore script ## 3.10.2 2023-09-14 - ### Changed +### Changed + - Update to wording when sending files to blobxfer - Remove --databases flag when backing up a single mysql/mariadb backup which allows to omit the "USE " statement in the backup allowing for better restores - ## 3.10.1 2023-09-13 - ### Changed - - Bugfix to 3.10.0 with syntax error revolving around unbraced variable +### Changed + - Bugfix to 3.10.0 with syntax error revolving around unbraced variable ## 3.10.0 2023-09-13 - ### Added - - Add EXTRA_DUMP_OPTS and EXTRA_ENUMERATION_OPTS to add different arguments when checking for databases, vs doing the actual backup +### Added + - Add EXTRA_DUMP_OPTS and EXTRA_ENUMERATION_OPTS to add different arguments when checking for databases, vs doing the actual backup ## 3.9.12 2023-09-04 - ### Changed - - Perform additional checks for ENABLE_CHECKSUM=FALSE and skip executing actions for S3/BlobXfer +### Changed + - Perform additional checks for ENABLE_CHECKSUM=FALSE and skip executing actions for S3/BlobXfer ## 3.9.11 2023-08-24 - ### Changed - - AWS CLI 2.13.9 +### Changed + - AWS CLI 2.13.9 ## 3.9.10 2023-08-23 - ### Changed - - Stop trying to move a non existent checksum file when ENABLE_CHECKSUM=FALSE +### Changed + - Stop trying to move a non existent checksum file when ENABLE_CHECKSUM=FALSE ## 3.9.9 2023-08-21 - ### Changed - - Start compiling aws-cli instead of from packages to continue to support arm/v7 +### Changed + - Start compiling aws-cli instead of from packages to continue to support arm/v7 ## 3.9.8 2023-08-20 - ### Changed - - Restore armv7 and aarch64 builds +### Changed + - Restore armv7 and aarch64 builds ## 3.9.7 2023-07-18 - ### Changed - - Cleanup check_exit_code parameter and reduce duplicate output +### Changed + - Cleanup check_exit_code parameter and reduce duplicate output ## 3.9.6 2023-06-16 - ### Changed - - Resolve issues introduced with 3.9.3. Split exit codes to be specific for backing up and moving. Uses paremter $11 for post backup scripts +### Changed + - Resolve issues introduced with 3.9.3. Split exit codes to be specific for backing up and moving. Uses parameter $11 for post backup scripts ## 3.9.5 2023-06-13 - ### Changed - - Start building Influx DB v1 manually due to being removed from Alpine repositories +### Changed + - Start building Influx DB v1 manually due to being removed from Alpine repositories ## 3.9.4 2023-06-13 - ### Added - - Add abliity to use --rsyncable argument to zstd archives +### Added + - Add ability to use --rsyncable argument to zstd archives ## 3.9.3 2023-06-05 - ### Added +### Added + - Add notification if blobxfer/s3 upload fails (credit @alwynpan) - Add zip package - ## 3.9.2 2023-05-10 - ### Changed - - Alpine 3.18 base +### Changed + - Alpine 3.18 base ## 3.9.1 2023-05-03 - ### Changed +### Changed + - Properly allow multiple _FILE environment variables to execute solving an issue with MySQL backups - Fix _FILE functionality for DB_NAME variable - ## 3.9.0 2023-04-26 - ### Added - - Add support for _FILE environment variables +### Added + - Add support for _FILE environment variables ## 3.8.5 2023-04-11 - ### Changed - - Fix SQLite3, Influx, and MSSQL backups failing due to malformed/non existent ltarget +### Changed + - Fix SQLite3, Influx, and MSSQL backups failing due to malformed/non existent ltarget ## 3.8.4 2023-04-06 - ### Changed - - Fix issue with Influx2 and MSSQL clients not installing properly +### Changed + - Fix issue with Influx2 and MSSQL clients not installing properly ## 3.8.3 2023-03-30 - ### Changed - - Patchup for 3.8.2 +### Changed + - Patchup for 3.8.2 ## 3.8.2 2023-03-30 - ### Changed - - Patchup for 3.8.1 +### Changed + - Patchup for 3.8.1 ## 3.8.1 2023-03-30 - ### Changed +### Changed + - Cleanup Dockerfile - Fix issue with DB_ARCHIVE_TIME not firing correctly - ## 3.8.0 2023-03-27 - ### Added +### Added + - Introduce DB_DUMP_TARGET_ARCHIVE which works with DB_ARCHIVE_TIME to move backups older than (x) minutes from DB_DUMP_TARGET to DB_DUMP_TARGET_ARCHIVE for use with external backup systems and custom exclude rules - Introduce CREATE_LATEST_SYMLINK which creates a symbolic link in DB_DUMP_TARGET of `latest-(DB_TYPE)-(DB_NAME)-(DB_HOST)` - ## 3.7.7 2023-03-20 - ### Changed - - Simplify pg_isready usage +### Changed + - Simplify pg_isready usage ## 3.7.6 2023-03-14 - ### Changed - - Remove EXTRA_OPT variable from MySQL/MariaDB check +### Changed + - Remove EXTRA_OPT variable from MySQL/MariaDB check ## 3.7.5 2023-03-02 - ### Added - - Add support for Docker Swarm mode Secrets for BLOBXFER_STORAGE_ACCOUNT_*_FILE +### Added + - Add support for Docker Swarm mode Secrets for BLOBXFER_STORAGE_ACCOUNT_*_FILE ## 3.7.4 2023-02-22 - ### Changed - - Fix when running in MANUAL_RUN_FOREVER mode looping +### Changed + - Fix when running in MANUAL_RUN_FOREVER mode looping ## 3.7.3 2022-12-20 - ### Changed - - Make S3_KEY_ID and S3_KEY_SECRET optional should IAM roles be used (Credit to alwynpan@github) +### Changed + - Make S3_KEY_ID and S3_KEY_SECRET optional should IAM roles be used (Credit to alwynpan@github) ## 3.7.2 2022-12-19 - ### Changed - - Bugfix for 3.7.1 +### Changed + - Bugfix for 3.7.1 ## 3.7.1 2022-12-19 - ### Changed +### Changed + - Add MYSQL_ENABLE_TLS environment variable to switch on and off - ### Reverted - - Set default for MYSQL_TLS_CA_FILE to accomodate for most use cases +### Reverted + - Set default for MYSQL_TLS_CA_FILE to accomodate for most use cases ## 3.7.0 2022-12-16 - ### Added +### Added + - Introduce support for connecting via TLS to MySQL / MariaDB Hosts with MYSQL_TLS_* variables - See README for more details - ### Changed - - Fix for cleaning up filesystems that are syncing to Azure via blobxfer +### Changed + - Fix for cleaning up file systems that are syncing to Azure via blobxfer ## 3.6.1 2022-11-23 - ### Added +### Added + - Switch to Alpine 3.17 base - Switch to OpenSSL instead of LibreSSL - ## 3.6.0 2022-11-21 - ### Added - - Postgresql 15 Support +### Added + - Postgresql 15 Support ## 3.5.6 2022-11-15 - ### Changed - - Add failure if DB_TYPE empty or malformed +### Changed + - Add failure if DB_TYPE empty or malformed ## 3.5.5 2022-10-18 - ### Changed - - Fix for S3 backups and trailing slashes (@greena13) +### Changed + - Fix for S3 backups and trailing slashes (@greena13) ## 3.5.4 2022-10-13 - ### Changed - - Fix for Influx DB 1 backups when compression enabled +### Changed + - Fix for Influx DB 1 backups when compression enabled ## 3.5.3 2022-10-12 - ### Changed +### Changed + - Remove build dependencies for blobxfer making image size smaller - Remove silencing commands limiting Postgres backups from working without DEBUG_MODE=TRUE - ## 3.5.2 2022-10-11 - ### Added - - Update Influxdb client to 2.4.0 (jauderho@github) +### Added + - Update Influxdb client to 2.4.0 (jauderho@github) ## 3.5.1 2022-10-11 - ### Changed - - Tighten up cleanup routines to not call blobxfer unless absolutely necessary +### Changed + - Tighten up cleanup routines to not call blobxfer unless absolutely necessary ## 3.5.0 2022-10-10 - ### Added +### Added + - Blobxfer / Microsoft Azure Support (credit: eoehen@github) - Introduce MONGO_CUSTOM_URI environment variable for those not wanting to use DB_* variables - ### Changed +### Changed + - Force filenames to be in lowercase - Fix S3 Database cleanups (credit greenatwork@github) - Remove MONGO_DB_TYPE variable as MONGO_CUSTOM_URI overrides - Fix MSSQL Backups (credit eoehen@github) - Seperate examples for MySQL and MSSQL - ## 3.4.2 2022-09-19 - ### Changed - - Skip availability check for Mongo Atlas connections +### Changed + - Skip availability check for Mongo Atlas connections ## 3.4.1 2022-09-13 ### Added -- Introduce environment variables for SCRIPT_LOCATION_POST and SCRIPT_LOCATION_PRE for better seperation - + +- Introduce environment variables for SCRIPT_LOCATION_POST and SCRIPT_LOCATION_PRE for better separation + ### Deprecated - Introduce deprecation warning for the custom script paths `/assets/custom-scripts` and `/assets/custom-scripts/pre`. These -paths will continue to work for now but support may be removed in the next major version release. To support the new -default paths your scripts should be moved as follows: - - |Script Type|Old Path (Deprecated)|New Environment Variable|Environment Value Default| - |-----------|--------|-------------------------|----------------| - |Pre|`/assets/custom-scripts/pre`|SCRIPT_LOCATION_PRE|`/assets/scripts/pre`| - |Post|`/assets/custom-scripts`|SCRIPT_LOCATION_POST|`/assets/scripts/post`| + paths will continue to work for now but support may be removed in the next major version release. To support the new + default paths your scripts should be moved as follows: + | Script Type | Old Path (Deprecated) | New Environment Variable | Environment Value Default | + | ----------- | ---------------------------- | ------------------------ | ------------------------- | + | Pre | `/assets/custom-scripts/pre` | SCRIPT_LOCATION_PRE | `/assets/scripts/pre` | + | Post | `/assets/custom-scripts` | SCRIPT_LOCATION_POST | `/assets/scripts/post` | ## 3.4.0 2022-09-12 - ### Added +### Added + - Add GZ_RSYNCABLE environment variable for better rsync compatibility (Credit teun95@github) - Add Pre Backup Script Support - Add MongoDB Atlas Support - ### Changed - - Fix Default Port for Influx 2 DB Hosts +### Changed + - Fix Default Port for Influx 2 DB Hosts ## 3.3.12 2022-08-15 - ### Changed - - arifer612@github contributed a fix for incorrect case of "filesize" variable when using post backup scripts +### Changed + - arifer612@github contributed a fix for incorrect case of "filesize" variable when using post backup scripts ## 3.3.11 2022-07-22 - ### Fixed - - Restore script not properly detecting postgres backups +### Fixed + - Restore script not properly detecting postgres backups ## 3.3.10 2022-07-19 - ### Changed - - Remove MSSQL install packages properly +### Changed + - Remove MSSQL install packages properly ## 3.3.9 2022-07-09 - ### Fixed - - Remaining work on interactive mode for entering port on restore script +### Fixed + - Remaining work on interactive mode for entering port on restore script ## 3.3.8 2022-07-09 - ### Added - - MSSQL Client Tools 18.0.1.1-1 +### Added + - MSSQL Client Tools 18.0.1.1-1 ## 3.3.7 2022-06-23 - ### Changed - - Allow overrides to actually override with the restore script +### Changed + - Allow overrides to actually override with the restore script ## 3.3.6 2022-06-23 - ### Changed - - Fix for restore script when using all 7 arguments +### Changed + - Fix for restore script when using all 7 arguments ## 3.3.5 2022-06-08 - ### Changed +### Changed + - Fix DB Port parameter not being able to be input in restore script - Fix MongoDB restore questionnaire - ## 3.3.4 2022-06-03 - ### Fixed - - S3 backups failing with special characters in filename +### Fixed + - S3 backups failing with special characters in filename ## 3.3.3 2022-05-24 - ### Added - - Alpine 3.16 base +### Added + - Alpine 3.16 base ## 3.3.2 2022-05-02 - ### Added - - Add POST_SCRIPT_SKIP_X_VERIFY environment variables to allow for more host compatibility for post scripts +### Added + - Add POST_SCRIPT_SKIP_X_VERIFY environment variables to allow for more host compatibility for post scripts ## 3.3.1 2022-04-30 - ### Changed - - Compressing silently was causing 0 byte backups +### Changed + - Compressing silently was causing 0 byte backups ## 3.3.0 2022-04-30 - ### Added - - Ability to auto clean old S3 / Minio Hosts like what occurs on filesysten +### Added + + - Ability to auto clean old S3 / Minio Hosts like what occurs on filesystem - Alert user how to turn off Zabbix Monitoring if fails - Allow Zabbix Monitoring to work with S3 - Silence some more compression statements - ### Changed + +### Changed + - Fix for Redis not backing up properly - Start sending checksums for S3 Outputs - Cleanup some code functions - FIx Container Log Level always in DEBUG - ## 3.2.4 2022-04-21 - ### Changed - - Add -portable flag when backing up Influx +### Changed + - Add -portable flag when backing up Influx ## 3.2.3 2022-04-21 - ### Changed +### Changed + - Fix for bucket / db name InfluxDB 1.xx - Minor aesthetics, spacing, spelling - ## 3.2.2 2022-04-21 - ### Changed +### Changed + - Restore script properly parses DB_PORT entry - Influx Database ready performs different checks dependent on V1/V2 - - Stop using weird database lowercase variables unneccessarily breaking Docker Secrets - + - Stop using weird database lowercase variables unnecessarily breaking Docker Secrets ## 3.2.1 2022-04-03 - ### Changed - - Fix a variety of issues iwth 3.2.0 relating to InfluxDB +### Changed + - Fix a variety of issues iwth 3.2.0 relating to InfluxDB ## 3.2.0 2022-03-31 - ### Added +### Added + - Install InfluxDB2 Client alongside version 1 (amd64 and arm64) - Introduce InfluxDB 2 backup support - Introduce multiple compression types other than Gzip for Influx 1/2 - Introduce compression for MSSQL backups - ### Changed - - Testing for Host availability for CouchDB and InfluxDB +### Changed + - Testing for Host availability for CouchDB and InfluxDB ## 3.1.3 2022-03-30 - ### Changed +### Changed + - Fix for MariaDB not sending database name to post script - Check for executible bit on post scripts both via environment variable and /assets/custom - SPLIT_DB defaulted to TRUE - ## 3.1.2 2022-03-29 - ### Changed - - Fix for blank Notice when individual backup is completed (time taken) +### Changed + - Fix for blank Notice when individual backup is completed (time taken) ## 3.1.1 2022-03-28 - ### Changed - - Resolve some issues with backups of Mongo and others not saving the proper timestamp +### Changed + - Resolve some issues with backups of Mongo and others not saving the proper timestamp ## 3.1.0 2022-03-23 - ### Added - - Backup multiple databases by seperating with comma e.g. db1,db2 +### Added + + - Backup multiple databases by separating with comma e.g. db1,db2 - Backup ALL databases bu setting DB_NAME to ALL - - Exclude databases from being backed up comma seperated when DB_NAME is all eg DB_NAME_EXCLUDE=db3,db4 + - Exclude databases from being backed up comma separated when DB_NAME is all eg DB_NAME_EXCLUDE=db3,db4 - Backup timers execute per database, not per the whole script run - Post scripts run after each database backup - Checksum does not occur when database backup failed @@ -485,99 +495,101 @@ default paths your scripts should be moved as follows: - MongoDB now supported with 'restore' script - Credit to piemonkey@github - Lots of reshuffling, optimizations with script due to botched 3.0 release - ### Changed +### Changed + - ZSTD replaces GZ as default compression type - Output is cleaner when backups are occurring ## 3.0.16 2022-03-23 - ### Changed - - Fix for SPLIT_DB not looping through all databse names properly +### Changed + - Fix for SPLIT_DB not looping through all database names properly ## 3.0.15 2022-03-22 - ### Changed +### Changed + - Rework compression function - Fix for Bzip compression failing - ## 3.0.14 2022-03-22 - ### Changed - - Rearrange Notice stating when next backup is going to start +### Changed + - Rearrange Notice stating when next backup is going to start ## 3.0.13 2022-03-21 - ### Added - - Add compression levels to debug mode +### Added + - Add compression levels to debug mode ## 3.0.12 2022-03-21 - ### Added - - Throw Errors for MANUAL mode when certain other CONTAINER_* services are enabled +### Added + - Throw Errors for MANUAL mode when certain other CONTAINER_* services are enabled ## 3.0.11 2022-03-21 - ### Changed - - Fix for Parallel Compression +### Changed + - Fix for Parallel Compression ## 3.0.10 2022-03-21 - ### Changed - - Fix for restore script not taking "custom" usernames or passwords +### Changed + - Fix for restore script not taking "custom" usernames or passwords ## 3.0.9 2022-03-21 - ### Changed - - Switch to using parallel versions of compression tools all the time, yet explicitly state the threads in use (1 or ++) +### Changed + - Switch to using parallel versions of compression tools all the time, yet explicitly state the threads in use (1 or ++) ## 3.0.8 2022-03-21 - ### Added - - Add PARALLEL_COMPRESSION_THREADS environment variable to limit amount of threads when compressing - Currently autodetects however many processors are avaialable to the container +### Added + - Add PARALLEL_COMPRESSION_THREADS environment variable to limit amount of threads when compressing - Currently auto detects however many processors are available to the container ## 3.0.7 2022-03-21 - ### Reverted - - Strip unused LOG directives +### Reverted + - Strip unused LOG directives ## 3.0.6 2022-03-21 - ### Changed - - Fix for parallel compression +### Changed + - Fix for parallel compression ## 3.0.5 2022-03-21 - ### Changed - - Add more detail regarding manual modes +### Changed + - Add more detail regarding manual modes ## 3.0.4 2022-03-21 - ### Changed - - Fix for 3.0.3 +### Changed + - Fix for 3.0.3 ## 3.0.3 2022-03-21 - ### Changed +### Changed + - Add documentation for Manual mode - Revert Compression variables - ## 3.0.2 2022-03-18 - ### Changed +### Changed + - Cleanup of Zabbix Agent options - Updated Zabbix template - Split apart S3 options for better debugging and also cleaned up their variables @@ -585,449 +597,465 @@ default paths your scripts should be moved as follows: - Cleaned up some notifications - Rearranged code - ## 3.0.1 2022-03-17 - ### Changed - - Fix for Environment variable not reading correctly for restore script for DB TYPE +### Changed + - Fix for Environment variable not reading correctly for restore script for DB TYPE ## 3.0.0 2022-03-17 - ### Added +### Added + - Rewrote entire image - Ability to choose which file hash after backup (MD5 or SHA1) - Restore Script (execute 'restore' in container) - Allow to map custom CA certs for S3 backups - Allow to skip certificate certification for S3 Backups - Revamped Logging and parameters - File logs also exist in /var/log/container/container.log - - Added more functionality to send to zabbix to track start, end, duration and status + - Added more functionality to send to Zabbix to track start, end, duration and status - Ability to backup stored procedures for MySQL / MariaDB - Ability to backup as a single transaction for MySQL / MariaDB - Ability to execute "manually" and still allow container to execute to accommodate for Kubernetes cron usage - ### Changed - - Environment variables have changed! Specifically relating to COMPRESSION, PARALLEL COMPRESSION, CHECKSUMs +### Changed + - Environment variables have changed! Specifically relating to COMPRESSION, PARALLEL COMPRESSION, CHECKSUMs ## 2.12.0 2022-03-16 - ### Changed +### Changed + - Last release of 2.x series - Fix timer for backups that take excessively long time, and allow it to start repetitively at the same time daily. What was happening is that if a backup took 30 minutes, time would shift by 30 minutes daily eventually taking backups mid day. - ## 2.11.5 2022-03-15 - ### Added - - Add additional debug statements +### Added + - Add additional debug statements ## 2.11.4 2022-03-15 - ### Added - - Add debug statement around the scheduling component +### Added + - Add debug statement around the scheduling component ## 2.11.3 2022-02-09 - ### Changed - - Rework to support new base image +### Changed + - Rework to support new base image ## 2.11.2 2022-02-09 - ### Changed - - Refresh base image +### Changed + - Refresh base image ## 2.11.1 2022-01-20 - ### Changed +### Changed + - Modernized S3 variables and sanity checks - Change exit code to 0 when executing a manual backup - ## 2.11.0 2022-01-20 - ### Added +### Added + - Add capability to select `TEMP_LOCATION` for initial backup and compression before backup completes to avoid filling system memory - ### Changed +### Changed + - Cleanup for MariaDB/MySQL DB ready routines that half worked in 2.10.3 - Code cleanup - ## 2.10.3 2022-01-07 - ### Changed - - Change the way MariaD/MySQL connectivity check is performed to allow for better compatibility without requiring the DB_USER to have PROCESS privileges +### Changed + - Change the way MariaD/MySQL connectivity check is performed to allow for better compatibility without requiring the DB_USER to have PROCESS privileges ## 2.10.2 2021-12-28 - ### Changed - - Remove logrotate configuration for redis which shouldn't exist in the first place +### Changed + - Remove logrotate configuration for redis which shouldn't exist in the first place ## 2.10.1 2021-12-22 - ### Added +### Added + - Allow for choosing region when backing up to S3 ## 2.10.0 2021-12-22 - ### Changed +### Changed + - Revert back to Postgresql 14 from packages as its now in the repositories - Fix for Zabbix Monitoring - ## 2.9.7 2021-12-15 - ### Changed - - Fixup for Zabbix Autoagent registration +### Changed + - Fixup for Zabbix Autoagent registration ## 2.9.6 2021-12-03 - ### Changed +### Changed + - Fix for S3 Minio backup targets - Fix for annoying output on certain target time print conditions ## 2.9.5 2021-12-07 - ### Changed - - Fix for 2.9.3 +### Changed + - Fix for 2.9.3 ## 2.9.4 2021-12-07 - ### Added - - Add Zabbix auto register support for templates +### Added + - Add Zabbix auto register support for templates ## 2.9.3 2021-11-24 - ### Added - - Alpine 3.15 base +### Added + - Alpine 3.15 base ## 2.9.2 2021-10-22 - ### Fixed +### Fixed + - Fix compression failing on Redis backup ## 2.9.1 2021-10-15 - ### Fixed +### Fixed + - Allow MariaDB 8.0 servers to be backed up - Fixed DB available check getting stuck with empty password ## 2.9.0 2021-10-15 - ### Added +### Added + - Postgresql 14 Support (compiled) - MSSQL 17.8.1.1 - ## 2.8.2 2021-10-15 - ### Changed - - Change to using aws cli from Alpine repositories (fixes #81) +### Changed + - Change to using aws cli from Alpine repositories (fixes #81) ## 2.8.1 2021-09-01 - ### Changed - - Modernize image with updated environment varialbes from upstream +### Changed + - Modernize image with updated environment variables from upstream ## 2.8.0 2021-08-27 - ### Added +### Added + - Alpine 3.14 Base - ### Changed +### Changed + - Fix for syntax error in 2.7.0 Release (Credit the1ts@github) - Cleanup image and leftover cache with AWS CLI installation - ## 2.7.0 2021-06-17 - ### Added - - MongoDB Authentication Database support (DB_AUTH) +### Added + - MongoDB Authentication Database support (DB_AUTH) ## 2.6.1 2021-06-08 - ### Changed - - Fix for Issue #14 - SPLIT_DB=TRUE was not working for Postgres DB server +### Changed + - Fix for Issue #14 - SPLIT_DB=TRUE was not working for Postgres DB server ## 2.6.0 2021-02-19 - ### Added - - SQLite support +### Added + - SQLite support ## 2.5.1 2021-02-14 - ### Changed - - Fix xz backups with `PARALLEL_COMPRESION=TRUE` +### Changed + - Fix xz backups with `PARALLEL_COMPRESION=TRUE` ## 2.5.0 2021-01-25 - ### Added +### Added + - Multi Platform Build Variants (ARMv7 AMD64 AArch64) - ### Changed +### Changed + - Alpine 3.13 Base - Compile Pixz as opposed to relying on testing repository - MSSQL Support only available under AMD64. Container exits if any other platform detected when MSSQL set to be backed up. ## 2.4.0 2020-12-07 - ### Added - - Switch back to packges for Postgresql (now 13.1) +### Added + - Switch back to packges for Postgresql (now 13.1) ## 2.3.2 2020-11-14 - ### Changed - - Reapply S6-Overlay into filesystem as Postgresql build is removing S6 files due to edge containing S6 overlay +### Changed + - Reapply S6-Overlay into filesystem as Postgresql build is removing S6 files due to edge containing S6 overlay ## 2.3.1 2020-11-11 - ### Fixed +### Fixed + - Multiple Influx DB's not being backed up correctly ## 2.3.0 2020-10-15 - ### Added +### Added + - Microsoft SQL Server support (experimental) - ### Changed +### Changed + - Compiled Postgresql 13 from source to backup psql/13 hosts ## 2.2.2 2020-09-22 - ### Fixed +### Fixed + - Patch for 2.2.0 release fixing Docker Secrets Support. Was skipping password check. ## 2.2.1 2020-09-17 - ### Fixed - - Ondemand/Manual backup with `backup-now` was throwing errors not being able to find a proper date +### Fixed + + - On-demand/Manual backup with `backup-now` was throwing errors not being able to find a proper date ## 2.2.0 2020-09-14 - ### Fixed +### Fixed + - Allow to use MariaDB and MongoDBs with no username and password while still allowing Docker Secrets - Changed source of Alpine package repositories - ## 2.1.1 2020-09-01 - ### Fixed - - Add eval to POST_SCRIPT execution +### Fixed + - Add eval to POST_SCRIPT execution ## 2.1.0 2020-08-29 - ### Added +### Added + - Add Exit Code variable to be used for custom scripts - See README.md for placement - Add POST_SCRIPT environment variable to execute command instead of relying on custom script - ## 2.0.0 2020-06-17 - ### Added +### Added + - Reworked compression routines to remove dependency on temporary files - Changed the way that MongoDB compression works - only supports GZ going forward - ### Changed +### Changed + - Code cleanup (removed function prefixes, added verbosity) - ### Reverted - - Removed Rethink Support +### Reverted + - Removed Rethink Support ## 1.23.0 2020-06-15 - ### Added +### Added + - Add zstd compression support - Add choice of compression level - ## 1.22.0 2020-06-10 - ### Added - - Added EXTRA_OPTS variable to all backup commands to pass extra arguments +### Added + - Added EXTRA_OPTS variable to all backup commands to pass extra arguments ## 1.21.3 2020-06-10 - ### Changed - - Fix `backup-now` manual script due to services.available change +### Changed + - Fix `backup-now` manual script due to services.available change ## 1.21.2 2020-06-08 - ### Added - - Change to support tiredofit/alpine base image 5.0.0 +### Added + - Change to support tiredofit/alpine base image 5.0.0 ## 1.21.1 2020-06-04 - ### Changed - - Bugfix to initalization routine +### Changed + - Bugfix to initialization routine ## 1.21.0 2020-06-03 - ### Added +### Added + - Add S3 Compatible Storage Support - ### Changed +### Changed + - Switch some variables to support tiredofit/alpine base image better - Fix issue with parallel compression not working correctly - ## 1.20.1 2020-04-24 - ### Changed - - Fix Auto Cleanup routines when using `root` as username +### Changed + - Fix Auto Cleanup routines when using `root` as username ## 1.20.0 2020-04-22 - ### Added - - Docker Secrets Support for DB_USER and DB_PASS variables +### Added + - Docker Secrets Support for DB_USER and DB_PASS variables ## 1.19.0 2020-04-22 - ### Added - - Custom Script support to execute upon compleition of backup +### Added + - Custom Script support to execute upon completion of backup ## 1.18.2 2020-04-08 - ### Changed +### Changed + - Rework to allow passwords with spaces in them for MariaDB / MySQL ## 1.18.1 2020-03-14 - ### Changed - - Allow for passwords with spaces in them for MariaDB / MySQL +### Changed + - Allow for passwords with spaces in them for MariaDB / MySQL ## 1.18.0 2019-12-29 - ### Added - - Update image to support new tiredofit/alpine base images +### Added + - Update image to support new tiredofit/alpine base images ## 1.17.3 2019-12-12 - ### Changed - - Quiet down Zabbix Agent +### Changed + - Quiet down Zabbix Agent ## 1.17.2 2019-12-12 - ### Changed - - Re Enable ZABBIX +### Changed + - Re Enable ZABBIX ## 1.17.1 2019-12-10 - ### Changed - - Fix spelling mistake in container initialization +### Changed + - Fix spelling mistake in container initialization ## 1.17.0 2019-12-09 - ### Changed +### Changed + - Stop compiling mongodb-tools as it is back in Alpine:edge repositories - Cleanup Code - ## 1.16 - 2019-06-16 - -* Check to see if Database Exists before performing backup -* Fix for MysQL/MariaDB custom ports - Credit to +- Check to see if Database Exists before performing backup +- Fix for MysQL/MariaDB custom ports - Credit to ## 1.15 - 2019-05-24 - -* Added abaility to backup password protected Redis Hosts +- Added abaility to backup password protected Redis Hosts ## 1.14 - 2019-04-20 - -* Switch to using locally built mongodb-tools from tiredofit/mongo-builder due to Alpine removing precompiled packages from repositories +- Switch to using locally built mongodb-tools from tiredofit/mongo-builder due to Alpine removing precompiled packages from repositories ## 1.13 - 2019-03-09 - -* Fixed Postgres backup without SPLIT_DB enabled (credit MelwinKfr@github) -* Added DB_PORT reference to properly backup Postgres with non default ports (thanks Maxximus007@github) +- Fixed Postgres backup without SPLIT_DB enabled (credit MelwinKfr@github) +- Added DB_PORT reference to properly backup Postgres with non default ports (thanks Maxximus007@github) ## 1.12 - 2019-03-01 - -* Fix for XZ Compression failing +- Fix for XZ Compression failing ## 1.11 - 2018-11-19 - -* Fix for Urnary Operator Error +- Fix for Urnary Operator Error ## 1.10 - 2018-11-19 - -* Fix for InfluxDB for backing up and supporting DB_PORT variable - Thanks skylord123@github +- Fix for InfluxDB for backing up and supporting DB_PORT variable - Thanks skylord123@github ## 1.9 - 2018-11-03 - -* Switch from OpenSSL to LibreSSL +- Switch from OpenSSL to LibreSSL ## 1.8 - 2018-07-18 - -* Fix warnings on startup related to 1.7 Changes +- Fix warnings on startup related to 1.7 Changes ## 1.7 - 2018-06-06 - -* Added ability for Manual Backup (enter container and type `backup-now`) +- Added ability for Manual Backup (enter container and type `backup-now`) ## 1.6 - 2018-02-26 - -* Add Parallel Compression mode (Default TRUE +- Add Parallel Compression mode (Default TRUE ## 1.5 - 2018-01-28 - -* Add Zabbix Checks +- Add Zabbix Checks ## 1.4 - 2017-11-17 - -* Switch to Packages Postgres +- Switch to Packages Postgres ## 1.31 - 2017-11-17 - -* Fix to SPLIT_DB Postgresql Backup +- Fix to SPLIT_DB Postgresql Backup ## 1.3 - 2017-10-25 - -* Remove Alpine postgres package and recompile version 10 +- Remove Alpine postgres package and recompile version 10 ## 1.2 - 2017-10-19 - -* Syntax Error Fix -* Fix some environment variables for Postgres and Redis +- Syntax Error Fix +- Fix some environment variables for Postgres and Redis ## 1.1 - 2017-09-14 - -* Added CouchDB +- Added CouchDB ## 1.0 - 2017-09-14 - -* Initial Release -* Alpine:Edge - +- Initial Release +- Alpine:Edge diff --git a/README.md b/README.md index 881de9d..5e408f1 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,27 @@ [![Become a sponsor](https://img.shields.io/badge/sponsor-tiredofit-181717.svg?logo=github&style=flat-square)](https://github.com/sponsors/tiredofit) [![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/tiredofit) -* * * +--- + ## About This will build a container for backing up multiple types of DB Servers Currently backs up CouchDB, InfluxDB, MySQL, Microsoft SQL, MongoDB, Postgres, Redis servers. -* dump to local filesystem or backup to S3 Compatible services, and Azure. -* select database user and password -* backup all databases, single, or multiple databases -* backup all to seperate files or one singular file -* choose to have an MD5 or SHA1 sum after backup for verification -* delete old backups after specific amount of time -* choose compression type (none, gz, bz, xz, zstd) -* connect to any container running on the same system -* Script to perform restores -* Zabbix Monitoring capabilities -* select how often to run a dump -* select when to start the first dump, whether time of day or relative to container start time -* Execute script after backup for monitoring/alerting purposes +- dump to local filesystem or backup to S3 Compatible services, and Azure. +- select database user and password +- backup all databases, single, or multiple databases +- backup all to separate files or one singular file +- choose to have an MD5 or SHA1 sum after backup for verification +- delete old backups after specific amount of time +- choose compression type (none, gz, bz, xz, zstd) +- connect to any container running on the same system +- Script to perform restores +- Zabbix Monitoring capabilities +- select how often to run a dump +- select when to start the first dump, whether time of day or relative to container start time +- Execute script after backup for monitoring/alerting purposes ## Maintainer @@ -34,57 +35,61 @@ Currently backs up CouchDB, InfluxDB, MySQL, Microsoft SQL, MongoDB, Postgres, R ## Table of Contents -- [About](#about) -- [Maintainer](#maintainer) -- [Table of Contents](#table-of-contents) -- [Prerequisites and Assumptions](#prerequisites-and-assumptions) -- [Installation](#installation) - - [Build from Source](#build-from-source) - - [Prebuilt Images](#prebuilt-images) - - [Multi Architecture](#multi-architecture) -- [Configuration](#configuration) - - [Quick Start](#quick-start) - - [Persistent Storage](#persistent-storage) - - [Environment Variables](#environment-variables) - - [Base Images used](#base-images-used) - - [Container Options](#container-options) - - [Database Specific Options](#database-specific-options) - - [For Influx DB2:](#for-influx-db2) - - [Scheduling Options](#scheduling-options) - - [Backup Options](#backup-options) - - [Backing Up to S3 Compatible Services](#backing-up-to-s3-compatible-services) - - [Upload to a Azure storage account by `blobxfer`](#upload-to-a-azure-storage-account-by-blobxfer) -- [Maintenance](#maintenance) - - [Shell Access](#shell-access) - - [Manual Backups](#manual-backups) - - [Restoring Databases](#restoring-databases) - - [Custom Scripts](#custom-scripts) - - [Path Options](#path-options) - - [Pre Backup](#pre-backup) - - [Post backup](#post-backup) -- [Support](#support) - - [Usage](#usage) - - [Bugfixes](#bugfixes) - - [Feature Requests](#feature-requests) - - [Updates](#updates) -- [License](#license) +- [github.com/tiredofit/docker-db-backup](#githubcomtiredofitdocker-db-backup) + - [About](#about) + - [Maintainer](#maintainer) + - [Table of Contents](#table-of-contents) + - [Prerequisites and Assumptions](#prerequisites-and-assumptions) + - [Installation](#installation) + - [Build from Source](#build-from-source) + - [Prebuilt Images](#prebuilt-images) + - [Multi Architecture](#multi-architecture) + - [Configuration](#configuration) + - [Quick Start](#quick-start) + - [Persistent Storage](#persistent-storage) + - [Environment Variables](#environment-variables) + - [Base Images used](#base-images-used) + - [Container Options](#container-options) + - [Database Specific Options](#database-specific-options) + - [For Influx DB2](#for-influx-db2) + - [Scheduling Options](#scheduling-options) + - [Backup Options](#backup-options) + - [Backing Up to S3 Compatible Services](#backing-up-to-s3-compatible-services) + - [Upload to a Azure storage account by `blobxfer`](#upload-to-a-azure-storage-account-by-blobxfer) + - [Maintenance](#maintenance) + - [Shell Access](#shell-access) + - [Manual Backups](#manual-backups) + - [Restoring Databases](#restoring-databases) + - [Custom Scripts](#custom-scripts) + - [Path Options](#path-options) + - [Pre Backup](#pre-backup) + - [Post backup](#post-backup) + - [Support](#support) + - [Usage](#usage) + - [Bugfixes](#bugfixes) + - [Feature Requests](#feature-requests) + - [Updates](#updates) + - [License](#license) > **NOTE**: If you are using this with a docker-compose file along with a seperate SQL container, take care not to set the variables to backup immediately, more so have it delay execution for a minute, otherwise you will get a failed first backup. ## Prerequisites and Assumptions -* You must have a working connection to one of the supported DB Servers and appropriate credentials + +- You must have a working connection to one of the supported DB Servers and appropriate credentials ## Installation ### Build from Source + Clone this repository and build the image with `docker build (imagename) .` ### Prebuilt Images + Builds of the image are available on [Docker Hub](https://hub.docker.com/r/tiredofit/db-backup) Builds of the image are also available on the [Github Container Registry](https://github.com/tiredofit/docker-db-backup/pkgs/container/docker-db-backup) -``` +```bash docker pull ghcr.io/tiredofit/docker-db-backup:(imagetag) ``` @@ -95,20 +100,22 @@ The following image tags are available along with their tagged release based on | latest | `:latest` | ```bash -docker pull docker.io/tiredofdit/db-backup:(imagetag) +docker pull docker.io/tiredofit/db-backup:(imagetag) ``` + #### Multi Architecture -Images are built primarily for `amd64` architecture, and may also include builds for `arm/v7`, `arm64` and others. These variants are all unsupported. Consider [sponsoring](https://github.com/sponsors/tiredofit) my work so that I can work with various hardware. To see if this image supports multiple architecures, type `docker manifest (image):(tag)` + +Images are built primarily for `amd64` architecture, and may also include builds for `arm/v7`, `arm64` and others. These variants are all unsupported. Consider [sponsoring](https://github.com/sponsors/tiredofit) my work so that I can work with various hardware. To see if this image supports multiple architectures, type `docker manifest (image):(tag)` ## Configuration ### Quick Start -* The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [docker-compose.yml](examples/docker-compose.yml) that can be modified for development or production use. +- The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [docker-compose.yml](examples/docker-compose.yml) that can be modified for development or production use. -* Set various [environment variables](#environment-variables) to understand the capabilities of this image. -* Map [persistent storage](#data-volumes) for access to configuration and data files for backup. -* Make [networking ports](#networking) available for public access if necessary +- Set various [environment variables](#environment-variables) to understand the capabilities of this image. +- Map [persistent storage](#data-volumes) for access to configuration and data files for backup. +- Make [networking ports](#networking) available for public access if necessary ### Persistent Storage @@ -116,14 +123,14 @@ The following directories are used for configuration and can be mapped for persi | Directory | Description | | ---------------------- | ----------------------------------------------------------------------------------- | | `/backup` | Backups | -| `/assets/scripts/pre` | *Optional* Put custom scripts in this directory to execute before backup operations | -| `/assets/scripts/post` | *Optional* Put custom scripts in this directory to execute after backup operations | +| `/assets/scripts/pre` | _Optional_ Put custom scripts in this directory to execute before backup operations | +| `/assets/scripts/post` | _Optional_ Put custom scripts in this directory to execute after backup operations | ### Environment Variables #### Base Images used -This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handlded via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.org). Additional tools include: `bash`,`curl`,`less`,`logrotate`, `nano`. +This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handled via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.org). Additional tools include: `bash`,`curl`,`less`,`logrotate`, `nano`. Be sure to view the following repositories to understand all the customizable options: @@ -146,42 +153,46 @@ Be sure to view the following repositories to understand all the customizable op | `SPLIT_DB` | For each backup, create a new archive. `TRUE` or `FALSE` (MySQL and Postgresql Only) | `TRUE` | ### Database Specific Options -| Parameter | Description | Default | `_FILE` | -| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- | ------- | -| `DB_AUTH` | (Mongo Only - Optional) Authentication Database | | | -| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `mssql` `pgsql` `mongo` `redis` `sqlite3` | | | -| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` | | x | -| `DB_NAME` | Schema Name e.g. `database` or `ALL` to backup all databases the user has access to. Backup multiple by seperating with commas eg `db1,db2` | | x | -| `DB_NAME_EXCLUDE` | If using `ALL` - use this as to exclude databases seperated via commas from being backed up | | x | -| `DB_USER` | username for the database(s) - Can use `root` for MySQL | | x | -| `DB_PASS` | (optional if DB doesn't require it) password for the database | | x | -| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided | varies | x | -| `INFLUX_VERSION` | What Version of Influx are you backing up from `1`.x or `2` series - AMD64 and ARM64 only for `2` | | | -| `MONGO_CUSTOM_URI` | If you wish to override the MongoDB Connection string enter it here e.g. `mongodb+srv://username:password@cluster.id.mongodb.net` | | x | -| | This environment variable will be parsed and populate the `DB_NAME` and `DB_HOST` variables to properly build your backup filenames. You can overrde them by making your own entries | | | -#### For Influx DB2: +| Parameter | Description | Default | `_FILE` | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------- | +| `DB_AUTH` | (Mongo/PGSQL Only - Optional) Authentication Database | | | +| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `mssql` `pgsql` `mongo` `redis` `sqlite3` | | | +| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` | | x | +| `DB_NAME` | Schema Name e.g. `database` or `ALL` to backup all databases the user has access to. Backup multiple by separating with commas eg `db1,db2` | | x | +| `DB_NAME_EXCLUDE` | If using `ALL` - use this as to exclude databases separated via commas from being backed up | | x | +| `DB_USER` | username for the database(s) - Can use `root` for MySQL | | x | +| `DB_PASS` | (optional if DB doesn't require it) password for the database | | x | +| `DB_PORT` | (optional) Set port to connect to DB_HOST. Defaults are provided | varies | x | +| `INFLUX_VERSION` | What Version of Influx are you backing up from `1`.x or `2` series - AMD64 and ARM64 only for `2` | | | +| `MONGO_CUSTOM_URI` | If you wish to override the MongoDB Connection string enter it here e.g. `mongodb+srv://username:password@cluster.id.mongodb.net` | | x | +| | This environment variable will be parsed and populate the `DB_NAME` and `DB_HOST` variables to properly build your backup filenames. You can override them by making your own entries | | | + +#### For Influx DB2 + Your Organization will be mapped to `DB_USER` and your root token will need to be mapped to `DB_PASS`. You may use `DB_NAME=ALL` to backup the entire set of databases. For `DB_HOST` use syntax of `http(s)://db-name` ### Scheduling Options -| Parameter | Description | Default | -| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | -| `DB_DUMP_FREQ` | How often to do a dump, in minutes after the first backup. Defaults to 1440 minutes, or once per day. | `1440` | -| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | | -| | Absolute HHMM, e.g. `2330` or `0415` | | -| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | | -| `DB_DUMP_TARGET` | Directory where the database dumps are kept. | `${DB_DUMP_TARGET}/archive/` | -| `DB_DUMP_TARGET_ARCHIVE` | Optional Directory where the database dumps archives are kept. | | -| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. | `FALSE` | -| `DB_ARCHIVE_TIME` | Value in minutes to move all files files older than (x) from `DB_DUMP_TARGET` to `DB_DUMP_TARGET_ARCHIVE` - which is useful when pairing against an external backup system. | | + +| Parameter | Description | Default | +| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | +| `DB_DUMP_FREQ` | How often to do a dump, in minutes after the first backup. Defaults to 1440 minutes, or once per day. | `1440` | +| `DB_DUMP_BEGIN` | What time to do the first dump. Defaults to immediate. Must be in one of two formats | | +| | Absolute HHMM, e.g. `2330` or `0415` | | +| | Relative +MM, i.e. how many minutes after starting the container, e.g. `+0` (immediate), `+10` (in 10 minutes), or `+90` in an hour and a half | | +| `DB_DUMP_TARGET` | Directory where the database dumps are kept. | `${DB_DUMP_TARGET}/archive/` | +| `DB_DUMP_TARGET_ARCHIVE` | Optional Directory where the database dumps archives are kept. | | +| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump frequency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything. | `FALSE` | +| `DB_ARCHIVE_TIME` | Value in minutes to move all files files older than (x) from `DB_DUMP_TARGET` to `DB_DUMP_TARGET_ARCHIVE` - which is useful when pairing against an external backup system. | | - You may need to wrap your `DB_DUMP_BEGIN` value in quotes for it to properly parse. There have been reports of backups that start with a `0` get converted into a different format which will not allow the timer to start at the correct time. ### Backup Options + | Parameter | Description | Default | `_FILE` | -|--------------------------------|------------------------------------------------------------------------------------------------------------------------------|---------------------------|---------| +| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------- | | `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, ZSTD `ZSTD` or none `NONE` | `ZSTD` | | -| `COMPRESSION_LEVEL` | Numberical value of what level of compression to use, most allow `1` to `9` except for `ZSTD` which allows for `1` to `19` - | `3` | | +| `COMPRESSION_LEVEL` | Numerical value of what level of compression to use, most allow `1` to `9` except for `ZSTD` which allows for `1` to `19` - | `3` | | | `ENABLE_PARALLEL_COMPRESSION` | Use multiple cores when compressing backups `TRUE` or `FALSE` | `TRUE` | | | `PARALLEL_COMPRESSION_THREADS` | Maximum amount of threads to use when compressing - Integer value e.g. `8` | `autodetected` | | | `GZ_RSYNCABLE` | Use `--rsyncable` (gzip only) for faster rsync transfers and incremental backup deduplication. e.g. `TRUE` | `FALSE` | | @@ -224,7 +235,7 @@ If `BACKUP_LOCATION` = `S3` then the following options are used. #### Upload to a Azure storage account by `blobxfer` -Support to upload backup files with [blobxfer](https://github.com/Azure/blobxfer) to the Azure fileshare storage. +Support to upload backup files with [blobxfer](https://github.com/Azure/blobxfer) to the Azure file share storage. If `BACKUP_LOCATION` = `blobxfer` then the following options are used. @@ -243,27 +254,31 @@ If `BACKUP_LOCATION` = `blobxfer` then the following options are used. For debugging and maintenance purposes you may want access the containers shell. -``bash +`bash docker exec -it (whatever your container name is) bash -`` +` + ### Manual Backups + Manual Backups can be performed by entering the container and typing `backup-now` - Recently there was a request to have the container work with Kubernetes cron scheduling. This can theoretically be accomplished by setting the container `MODE=MANUAL` and then setting `MANUAL_RUN_FOREVER=FALSE` - You would also want to disable a few features from the upstream base images specifically `CONTAINER_ENABLE_SCHEDULING` and `CONTAINER_ENABLE_MONITORING`. This should allow the container to start, execute a backup by executing and then exit cleanly. An alternative way to running the script is to execute `/etc/services.available/10-db-backup/run`. ### Restoring Databases + Entering in the container and executing `restore` will execute a menu based script to restore your backups - MariaDB, Postgres, and Mongo supported. You will be presented with a series of menus allowing you to choose: - - What file to restore - - What type of DB Backup - - What Host to restore to - - What Database Name to restore to - - What Database User to use - - What Database Password to use - - What Database Port to use -The image will try to do autodetection based on the filename for the type, hostname, and database name. +- What file to restore +- What type of DB Backup +- What Host to restore to +- What Database Name to restore to +- What Database User to use +- What Database Password to use +- What Database Port to use + +The image will try to do auto detection based on the filename for the type, hostname, and database name. The image will also allow you to use environment variables or Docker secrets used to backup the images The script can also be executed skipping the interactive mode by using the following syntax/ @@ -282,9 +297,10 @@ If you only enter some of the arguments you will be prompted to fill them in. | `SCRIPT_LOCATION_POST` | Location on filesystem inside container to execute bash scripts post backup | `/assets/scripts/post/` | #### Pre Backup + If you want to execute a custom script before a backup starts, you can drop bash scripts with the extension of `.sh` in the location defined in `SCRIPT_LOCATION_PRE`. See the following example to utilize: -````bash +```bash $ cat pre-script.sh ##!/bin/bash @@ -296,21 +312,20 @@ $ cat pre-script.sh # #### $5=BACKUP FILENAME (Filename) echo "${1} Backup Starting on ${2} for ${3} at ${4}. Filename: ${5}" -```` +``` ## script DB_TYPE DB_HOST DB_NAME STARTEPOCH BACKUP_FILENAME ${f} "${dbtype}" "${dbhost}" "${dbname}" "${backup_start_time}" "${target}" - Outputs the following on the console: `mysql Backup Starting on example-db for example at 1647370800. Filename: mysql_example_example-db_202200315-000000.sql.bz2 - #### Post backup + If you want to execute a custom script at the end of a backup, you can drop bash scripts with the extension of `.sh` in the location defined in `SCRIPT_LOCATION_POST`. Also to support legacy users `/assets/custom-scripts` is also scanned and executed.See the following example to utilize: -````bash +```bash $ cat post-script.sh ##!/bin/bash @@ -328,37 +343,43 @@ $ cat post-script.sh # #### $11=MOVE_EXIT_CODE echo "${1} ${2} Backup Completed on ${3} for ${4} on ${5} ending ${6} for a duration of ${7} seconds. Filename: ${8} Size: ${9} bytes MD5: ${10}" -```` +``` ## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE ${f} "${exit_code}" "${dbtype}" "${dbhost}" "${dbname}" "${backup_start_timme}" "${backup_finish_time}" "${backup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}" "${move_exit_code} - Outputs the following on the console: `0 mysql Backup Completed on example-db for example on 1647370800 ending 1647370920 for a duration of 120 seconds. Filename: mysql_example_example-db_202200315-000000.sql.bz2 Size: 7795 bytes Hash: 952fbaafa30437494fdf3989a662cd40 0` If you wish to change the size value from bytes to megabytes set environment variable `SIZE_VALUE=megabytes` -You must make your scripts executible otherwise there is an internal check that will skip trying to run it otherwise. +You must make your scripts executable otherwise there is an internal check that will skip trying to run it otherwise. If for some reason your filesystem or host is not detecting it right, use the environment variable `POST_SCRIPT_SKIP_X_VERIFY=TRUE` to bypass. ## Support These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community. + ### Usage + - The [Discussions board](../../discussions) is a great place for working with the community on tips and tricks of using this image. - Consider [sponsoring me](https://github.com/sponsors/tiredofit) for personalized support + ### Bugfixes + - Please, submit a [Bug Report](issues/new) if something isn't working as expected. I'll do my best to issue a fix in short order. ### Feature Requests + - Feel free to submit a feature request, however there is no guarantee that it will be added, or at what timeline. - Consider [sponsoring me](https://github.com/sponsors/tiredofit) regarding development of features. ### Updates + - Best effort to track upstream changes, More priority if I am actively using the image in a production environment. - Consider [sponsoring me](https://github.com/sponsors/tiredofit) for up to date releases. ## License + MIT. See [LICENSE](LICENSE) for more details. diff --git a/install/assets/functions/10-db-backup b/install/assets/functions/10-db-backup index 47892e8..afd0af8 100644 --- a/install/assets/functions/10-db-backup +++ b/install/assets/functions/10-db-backup @@ -298,8 +298,12 @@ backup_mysql() { } backup_pgsql() { - export PGPASSWORD=${DB_PASS} - authdb=${DB_USER} + export PGPASSWORD=${DB_PASS} + if [ -n "${DB_AUTH}" ] ; then + authdb=${DB_AUTH} + else + authdb=${DB_USER} + fi if [ "${DB_NAME,,}" = "all" ] ; then print_debug "Preparing to back up all databases" db_names=$(psql -h ${DB_HOST} -U ${DB_USER} -p ${DB_PORT} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' ) @@ -341,7 +345,7 @@ backup_pgsql() { pre_dbbackup all print_notice "Dumping all PostgreSQL databases: '$(echo ${db_names} | xargs | tr ' ' ',')' ${compression_string}" tmp_db_names=$(psql -h ${DB_HOST} -U ${DB_USER} -p ${DB_PORT} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' ) - for r_db_name in $(echo $db_names | xargs); do + for r_db_name in $(echo $db_names | xargs); do tmp_db_names=$(echo "$tmp_db_names" | xargs | sed "s|${r_db_name}||g" ) done sleep 5