mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-22 05:33:53 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e46996812 | ||
|
|
e71334564f | ||
|
|
f83f97bf76 | ||
|
|
94a8e45af6 | ||
|
|
9d90e37339 | ||
|
|
085b7cd6ce | ||
|
|
12484bb3f3 | ||
|
|
8fc2721dd4 |
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -8,8 +8,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
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.yml@main
|
||||||
#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_arm64.yml@main
|
uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
4
.github/workflows/manual.yml
vendored
4
.github/workflows/manual.yml
vendored
@@ -9,8 +9,8 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
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.yml@main
|
||||||
#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_arm64.yml@main
|
uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,3 +1,16 @@
|
|||||||
|
## 3.9.4 2023-06-13 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add abliity to use --rsyncable argument to zstd archives
|
||||||
|
|
||||||
|
|
||||||
|
## 3.9.3 2023-06-05 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add notification if blobxfer/s3 upload fails (credit @alwynpan)
|
||||||
|
- Add zip package
|
||||||
|
|
||||||
|
|
||||||
## 3.9.2 2023-05-10 <dave at tiredofit dot ca>
|
## 3.9.2 2023-05-10 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ RUN source /assets/functions/00-container && \
|
|||||||
redis \
|
redis \
|
||||||
sqlite \
|
sqlite \
|
||||||
xz \
|
xz \
|
||||||
|
zip \
|
||||||
zstd \
|
zstd \
|
||||||
&& \
|
&& \
|
||||||
\
|
\
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ Be sure to view the following repositories to understand all the customizable op
|
|||||||
|
|
||||||
| Parameter | Description | Default |
|
| Parameter | Description | Default |
|
||||||
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
||||||
| `BACKUP_LOCATION` | Backup to `FILESYSTEM` or `S3` compatible services like S3, Minio, Wasabi | `FILESYSTEM` |
|
| `BACKUP_LOCATION` | Backup to `FILESYSTEM`, `blobxfer` or `S3` compatible services like S3, Minio, Wasabi | `FILESYSTEM` |
|
||||||
| `MODE` | `AUTO` mode to use internal scheduling routines or `MANUAL` to simply use this as manual backups only executed by your own means | `AUTO` |
|
| `MODE` | `AUTO` mode to use internal scheduling routines or `MANUAL` to simply use this as manual backups only executed by your own means | `AUTO` |
|
||||||
| `MANUAL_RUN_FOREVER` | `TRUE` or `FALSE` if you wish to try to make the container exit after the backup | `TRUE` |
|
| `MANUAL_RUN_FOREVER` | `TRUE` or `FALSE` if you wish to try to make the container exit after the backup | `TRUE` |
|
||||||
| `TEMP_LOCATION` | Perform Backups and Compression in this temporary directory | `/tmp/backups/` |
|
| `TEMP_LOCATION` | Perform Backups and Compression in this temporary directory | `/tmp/backups/` |
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ backup_couch() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup ${DB_NAME}
|
post_dbbackup ${DB_NAME}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +168,7 @@ backup_influx() {
|
|||||||
ltarget=influx_${db}_${DB_HOST#*//}
|
ltarget=influx_${db}_${DB_HOST#*//}
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $db
|
post_dbbackup $db
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -187,6 +189,7 @@ backup_influx() {
|
|||||||
ltarget=influx2_${db}_${DB_HOST#*//}
|
ltarget=influx2_${db}_${DB_HOST#*//}
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $db
|
post_dbbackup $db
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
@@ -216,6 +219,7 @@ backup_mongo() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup "${DB_NAME}"
|
post_dbbackup "${DB_NAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,6 +235,7 @@ backup_mssql() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $DB_NAME
|
post_dbbackup $DB_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,6 +276,7 @@ backup_mysql() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $db
|
post_dbbackup $db
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@@ -286,6 +292,7 @@ backup_mysql() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup all
|
post_dbbackup all
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -322,6 +329,7 @@ backup_pgsql() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $db
|
post_dbbackup $db
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@@ -345,6 +353,7 @@ backup_pgsql() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup all
|
post_dbbackup all
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -376,6 +385,7 @@ backup_redis() {
|
|||||||
check_exit_code $target
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup all
|
post_dbbackup all
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +404,7 @@ backup_sqlite3() {
|
|||||||
cat "${TEMP_LOCATION}"/backup.sqlite3 | ${dir_compress_cmd} > "${TEMP_LOCATION}/${target}"
|
cat "${TEMP_LOCATION}"/backup.sqlite3 | ${dir_compress_cmd} > "${TEMP_LOCATION}/${target}"
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
|
check_exit_code "move backup file"
|
||||||
post_dbbackup $db
|
post_dbbackup $db
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,15 +565,16 @@ cleanup_old_data() {
|
|||||||
|
|
||||||
|
|
||||||
compression() {
|
compression() {
|
||||||
if var_false "${ENABLE_PARALLEL_COMPRESSION}" ; then
|
if var_false "${ENABLE_PARALLEL_COMPRESSION}" ; then
|
||||||
PARALLEL_COMPRESSION_THREADS=1
|
PARALLEL_COMPRESSION_THREADS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${COMPRESSION,,}" in
|
if var_true "${GZ_RSYNCABLE}" ; then
|
||||||
|
gz_rsyncable=--rsyncable
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${COMPRESSION,,}" in
|
||||||
gz* )
|
gz* )
|
||||||
if var_true "${GZ_RSYNCABLE}" ; then
|
|
||||||
gz_rsyncable=--rsyncable
|
|
||||||
fi
|
|
||||||
compress_cmd="pigz -q -${COMPRESSION_LEVEL} -p ${PARALLEL_COMPRESSION_THREADS} ${gz_rsyncable}"
|
compress_cmd="pigz -q -${COMPRESSION_LEVEL} -p ${PARALLEL_COMPRESSION_THREADS} ${gz_rsyncable}"
|
||||||
compression_type="gzip"
|
compression_type="gzip"
|
||||||
extension=".gz"
|
extension=".gz"
|
||||||
@@ -587,7 +599,7 @@ compression() {
|
|||||||
target=${target}.xz
|
target=${target}.xz
|
||||||
;;
|
;;
|
||||||
zst* )
|
zst* )
|
||||||
compress_cmd="zstd -q -q --rm -${COMPRESSION_LEVEL} -T${PARALLEL_COMPRESSION_THREADS} "
|
compress_cmd="zstd -q -q --rm -${COMPRESSION_LEVEL} -T${PARALLEL_COMPRESSION_THREADS} ${gz_rsyncable}"
|
||||||
compression_type="zstd"
|
compression_type="zstd"
|
||||||
dir_compress_cmd=${compress_cmd}
|
dir_compress_cmd=${compress_cmd}
|
||||||
extension=".zst"
|
extension=".zst"
|
||||||
@@ -711,6 +723,7 @@ move_dbbackup() {
|
|||||||
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
||||||
|
|
||||||
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
||||||
|
exit_code=$?
|
||||||
if var_true "${ENABLE_CHECKSUM}" ; then
|
if var_true "${ENABLE_CHECKSUM}" ; then
|
||||||
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/*.${checksum_extension} s3://${S3_BUCKET}/${S3_PATH}/ ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/*.${checksum_extension} s3://${S3_BUCKET}/${S3_PATH}/ ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
||||||
fi
|
fi
|
||||||
@@ -726,6 +739,7 @@ move_dbbackup() {
|
|||||||
mv "${TEMP_LOCATION}"/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
mv "${TEMP_LOCATION}"/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
||||||
|
|
||||||
silent blobxfer upload --mode file --remote-path ${BLOBXFER_REMOTE_PATH} --local-path ${DB_DUMP_TARGET}
|
silent blobxfer upload --mode file --remote-path ${BLOBXFER_REMOTE_PATH} --local-path ${DB_DUMP_TARGET}
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
rm -rf "${TEMP_LOCATION}"/*."${checksum_extension}"
|
rm -rf "${TEMP_LOCATION}"/*."${checksum_extension}"
|
||||||
rm -rf "${TEMP_LOCATION}"/"${target}"
|
rm -rf "${TEMP_LOCATION}"/"${target}"
|
||||||
|
|||||||
Reference in New Issue
Block a user