mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
065887f789 | ||
|
|
5aba713b73 | ||
|
|
9a6039d71d | ||
|
|
c5f1618231 | ||
|
|
7dd9fa890f |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,3 +1,20 @@
|
||||
## 2.10.3 2022-01-07 <dave at tiredofit dot ca>
|
||||
|
||||
### 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 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Remove logrotate configuration for redis which shouldn't exist in the first place
|
||||
|
||||
|
||||
## 2.10.1 2021-12-22 <milenkara@github>
|
||||
|
||||
### Added
|
||||
- Allow for choosing region when backing up to S3
|
||||
|
||||
## 2.10.0 2021-12-22 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -61,6 +61,7 @@ RUN set -ex && \
|
||||
### Cleanup
|
||||
apk del .db-backup-build-deps && \
|
||||
rm -rf /usr/src/* && \
|
||||
rm -rf /etc/logrotate.d/redis && \
|
||||
rm -rf /root/.cache /tmp/* /var/cache/apk/*
|
||||
|
||||
### S6 Setup
|
||||
|
||||
58
README.md
58
README.md
@@ -31,29 +31,40 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
|
||||
|
||||
## 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)
|
||||
- [Configuration](#configuration)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Persistent Storage](#persistent-storage)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Base Images used](#base-images-used)
|
||||
- [Backing Up to S3 Compatible Services](#backing-up-to-s3-compatible-services)
|
||||
- [Maintenance](#maintenance)
|
||||
- [Shell Access](#shell-access)
|
||||
- [Manual Backups](#manual-backups)
|
||||
- [Custom Scripts](#custom-scripts)
|
||||
- [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)
|
||||
- [Configuration](#configuration)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Persistent Storage](#persistent-storage)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Base Images used](#base-images-used)
|
||||
- [Backing Up to S3 Compatible Services](#backing-up-to-s3-compatible-services)
|
||||
- [Maintenance](#maintenance)
|
||||
- [Shell Access](#shell-access)
|
||||
- [Manual Backups](#manual-backups)
|
||||
- [Custom Scripts](#custom-scripts)
|
||||
- [#### Example Post Script](#-example-post-script)
|
||||
- [#### $1=EXIT_CODE (After running backup routine)](#-1exit_code-after-running-backup-routine)
|
||||
- [#### $2=DB_TYPE (Type of Backup)](#-2db_type-type-of-backup)
|
||||
- [#### $3=DB_HOST (Backup Host)](#-3db_host-backup-host)
|
||||
- [#### #4=DB_NAME (Name of Database backed up](#-4db_name-name-of-database-backed-up)
|
||||
- [#### $5=DATE (Date of Backup)](#-5date-date-of-backup)
|
||||
- [#### $6=TIME (Time of Backup)](#--6time-time-of-backup)
|
||||
- [#### $7=BACKUP_FILENAME (Filename of Backup)](#--7backup_filename-filename-of-backup)
|
||||
- [#### $8=FILESIZE (Filesize of backup)](#--8filesize-filesize-of-backup)
|
||||
- [#### $9=MD5_RESULT (MD5Sum if enabled)](#--9md5_result-md5sum-if-enabled)
|
||||
- [Support](#support)
|
||||
- [Usage](#usage)
|
||||
- [Bugfixes](#bugfixes)
|
||||
- [Feature Requests](#feature-requests)
|
||||
- [Updates](#updates)
|
||||
- [License](#license)
|
||||
|
||||
## Prerequisites and Assumptions
|
||||
|
||||
@@ -147,6 +158,7 @@ If `BACKUP_LOCATION` = `S3` then the following options are used.
|
||||
| `S3_KEY_SECRET` | S3 Key Secret |
|
||||
| `S3_PATH` | S3 Pathname to save to e.g. '`backup`' |
|
||||
| `S3_PROTOCOL` | Use either `http` or `https` to access service - Default `https` |
|
||||
| `S3_REGION` | Define region in which bucket is defined. Example: `ap-northeast-2` |
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
@@ -89,6 +89,7 @@ if [ "$BACKUP_TYPE" = "S3" ] || [ "$BACKUP_TYPE" = "s3" ] || [ "$BACKUP_TYPE" =
|
||||
sanity_var S3_KEY_SECRET "S3 Key Secret"
|
||||
sanity_var S3_URI_STYLE "S3 URI Style (Virtualhost or Path)"
|
||||
sanity_var S3_PATH "S3 Path"
|
||||
sanity_var S3_REGION "S3 Region"
|
||||
file_env 'S3_KEY_ID'
|
||||
file_env 'S3_KEY_SECRET'
|
||||
fi
|
||||
@@ -295,17 +296,10 @@ check_availability() {
|
||||
"mysql" )
|
||||
COUNTER=0
|
||||
export MYSQL_PWD=${dbpass}
|
||||
while true; do
|
||||
mysqlcmd='mysql -u'${dbuser}' -P '${dbport}' -h '${dbhost}
|
||||
out="$($mysqlcmd -e "SELECT COUNT(*) FROM information_schema.FILES;" 2>&1)"
|
||||
echo "$out" | grep -E "COUNT|Enter" 2>&1 > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
:
|
||||
break
|
||||
fi
|
||||
print_warn "MySQL/MariaDB Server '${dbhost}' is not accessible, retrying.. ($COUNTER seconds so far)"
|
||||
sleep 5
|
||||
(( COUNTER+=5 ))
|
||||
while ! (mysql -u"${dbuser}" -P"${dbport}" -h"${dbhost}" -e "SHOW GRANTS FOR CURRENT_USER;" 2>&1 | grep -E "GRANT ALL PRIVILEGES ON \`${DB_NAME}\`" > /dev/null 2>&1) ; do
|
||||
sleep 5
|
||||
(( COUNTER+=5 ))
|
||||
print_warn "MySQL/MariaDB Server '${maria_host}' is not accessible, retrying.. ($counter seconds so far)"
|
||||
done
|
||||
;;
|
||||
"mssql" )
|
||||
@@ -419,7 +413,7 @@ move_backup() {
|
||||
"S3" | "s3" | "MINIO" | "minio" )
|
||||
export AWS_ACCESS_KEY_ID=${S3_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${S3_KEY_SECRET}
|
||||
export AWS_DEFAULT_REGION=ap-northeast-2
|
||||
export AWS_DEFAULT_REGION=${S3_REGION}
|
||||
|
||||
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user