Compare commits

...

2 Commits
3.1.0 ... 3.1.1

Author SHA1 Message Date
Dave Conroy
24ed769429 Release 3.1.1 - See CHANGELOG.md 2022-03-28 10:29:00 -07:00
Dave Conroy
cbd87a5ede Update README.md 2022-03-23 19:16:51 -07:00
3 changed files with 22 additions and 14 deletions

View File

@@ -1,3 +1,9 @@
## 3.1.1 2022-03-28 <dave at tiredofit dot ca>
### Changed
- Resolve some issues with backups of Mongo and others not saving the proper timestamp
## 3.1.0 2022-03-23 <dave at tiredofit dot ca> ## 3.1.0 2022-03-23 <dave at tiredofit dot ca>
### Added ### Added

View File

@@ -16,7 +16,8 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
* dump to local filesystem or backup to S3 Compatible services * dump to local filesystem or backup to S3 Compatible services
* select database user and password * select database user and password
* backup all databases * 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 * choose to have an MD5 or SHA1 sum after backup for verification
* delete old backups after specific amount of time * delete old backups after specific amount of time
* choose compression type (none, gz, bz, xz, zstd) * choose compression type (none, gz, bz, xz, zstd)

View File

@@ -77,58 +77,60 @@ bootstrap_variables() {
} }
backup_couch() { backup_couch() {
pre_dbbackup
target=couch_${dbname}_${dbhost}_${now}.txt target=couch_${dbname}_${dbhost}_${now}.txt
compression compression
print_notice "Dumping CouchDB database: '${dbname}'" print_notice "Dumping CouchDB database: '${dbname}' ${compression_string}"
curl -X GET http://${dbhost}:${dbport}/${dbname}/_all_docs?include_docs=true ${compress_cmd} | $compress_cmd > ${TEMP_LOCATION}/${target} curl -X GET http://${dbhost}:${dbport}/${dbname}/_all_docs?include_docs=true ${compress_cmd} | $compress_cmd > ${TEMP_LOCATION}/${target}
exit_code=$? exit_code=$?
check_exit_code $target check_exit_code $target
generate_checksum generate_checksum
move_dbbackup move_dbbackup
post_dbbackup_hooks post_dbbackup
send_statistics
} }
backup_influx() { backup_influx() {
if [ "${ENABLE_COMPRESSION,,}" = "none" ] || [ "${ENABLE_COMPRESSION,,}" = "false" ] ; then if [ "${ENABLE_COMPRESSION,,}" = "none" ] || [ "${ENABLE_COMPRESSION,,}" = "false" ] ; then
: :
else else
print_notice "Compressing InfluxDB backup with gzip"
influx_compression="-portable" influx_compression="-portable"
compression_string=" and compressing with gzip"
fi fi
for db in ${DB_NAME}; do for db in ${DB_NAME}; do
print_notice "Dumping Influx database: '${db}'" pre_dbbackup
target=influx_${db}_${dbhost}_${now} target=influx_${db}_${dbhost}_${now}
print_notice "Dumping Influx database: '${db}' ${compression_string}"
influxd backup ${influx_compression} -database $db -host ${dbhost}:${dbport} ${TEMP_LOCATION}/${target} influxd backup ${influx_compression} -database $db -host ${dbhost}:${dbport} ${TEMP_LOCATION}/${target}
exit_code=$? exit_code=$?
check_exit_code $target check_exit_code $target
generate_checksum generate_checksum
move_dbbackup move_dbbackup
send_statistics post_dbbackup
post_dbbackup_hooks
done done
} }
backup_mongo() { backup_mongo() {
pre_dbbackup
if [ "${ENABLE_COMPRESSION,,}" = "none" ] || [ "${ENABLE_COMPRESSION,,}" = "false" ] ; then if [ "${ENABLE_COMPRESSION,,}" = "none" ] || [ "${ENABLE_COMPRESSION,,}" = "false" ] ; then
target=${dbtype}_${dbname}_${dbhost}_${now}.archive target=${dbtype}_${dbname}_${dbhost}_${now}.archive
else else
print_notice "Compressing MongoDB backup with gzip"
target=${dbtype}_${dbname}_${dbhost}_${now}.archive.gz target=${dbtype}_${dbname}_${dbhost}_${now}.archive.gz
mongo_compression="--gzip" mongo_compression="--gzip"
compression_string="and compressing with gzip"
fi fi
print_notice "Dumping MongoDB database: '${DB_NAME}'" print_notice "Dumping MongoDB database: '${DB_NAME}' ${compression_string}"
mongodump --archive=${TEMP_LOCATION}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_AUTH_STR}${MONGO_DB_STR} ${EXTRA_OPTS} mongodump --archive=${TEMP_LOCATION}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_AUTH_STR}${MONGO_DB_STR} ${EXTRA_OPTS}
exit_code=$? exit_code=$?
check_exit_code $target check_exit_code $target
cd "${TEMP_LOCATION}" cd "${TEMP_LOCATION}"
generate_checksum generate_checksum
move_dbbackup move_dbbackup
send_statistics post_dbbackup
post_dbbackup_hooks
} }
backup_mssql() { backup_mssql() {
pre_dbbackup
target=mssql_${dbname}_${dbhost}_${now}.bak target=mssql_${dbname}_${dbhost}_${now}.bak
print_notice "Dumping MSSQL database: '${dbname}'" print_notice "Dumping MSSQL database: '${dbname}'"
/opt/mssql-tools/bin/sqlcmd -E -C -S ${dbhost}\,${dbport} -U ${dbuser} -P ${dbpass} Q "BACKUP DATABASE \[${dbname}\] TO DISK = N'${TEMP_LOCATION}/${target}' WITH NOFORMAT, NOINIT, NAME = '${dbname}-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10" /opt/mssql-tools/bin/sqlcmd -E -C -S ${dbhost}\,${dbport} -U ${dbuser} -P ${dbpass} Q "BACKUP DATABASE \[${dbname}\] TO DISK = N'${TEMP_LOCATION}/${target}' WITH NOFORMAT, NOINIT, NAME = '${dbname}-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
@@ -136,8 +138,7 @@ backup_mssql() {
check_exit_code $target check_exit_code $target
generate_checksum generate_checksum
move_dbbackup move_dbbackup
send_statistics post_dbbackup
post_dbbackup_hooks
} }
backup_mysql() { backup_mysql() {