mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 13:23:12 +01:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75ded7599c | ||
|
|
5e5986db69 | ||
|
|
1d61f40d0c | ||
|
|
ee8bbb370b | ||
|
|
ae201814fa | ||
|
|
bf8bce0893 | ||
|
|
3e8585394d | ||
|
|
2e0c0d9248 | ||
|
|
c81d8e2713 | ||
|
|
b808b35624 | ||
|
|
e060aeb0e5 | ||
|
|
03c16cc582 | ||
|
|
e45d916b00 | ||
|
|
eb0ee61662 | ||
|
|
8e737eb579 | ||
|
|
5d2043a603 | ||
|
|
89fe251321 | ||
|
|
e9052f1cd6 | ||
|
|
a73528c5b2 | ||
|
|
7d1e112dfc | ||
|
|
e0bb4c313b | ||
|
|
cb5333a59c | ||
|
|
7b59632378 | ||
|
|
353b1af7b4 | ||
|
|
a27b46a43a | ||
|
|
e5b9ee2cc0 | ||
|
|
6ddb749bc6 | ||
|
|
fb299c41dd | ||
|
|
d7d4f1cc19 | ||
|
|
c8c9a80533 | ||
|
|
018234b9bc | ||
|
|
912e60edd8 | ||
|
|
46fddb533c | ||
|
|
e8a1859d1a | ||
|
|
30fe2f181c | ||
|
|
f57ce461e9 | ||
|
|
34aab69cc2 | ||
|
|
1930358775 |
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: If something isn't working right..
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
### Summary
|
||||
|
||||
<!-- Summarize the bug encountered -->
|
||||
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!-- Describe how one can reproduce the issue - this is very important. Please use an ordered list. -->
|
||||
|
||||
|
||||
### What is the expected *correct* behavior?
|
||||
|
||||
<!-- Describe what should be seen instead. -->
|
||||
|
||||
|
||||
### Relevant logs and/or screenshots
|
||||
|
||||
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise. -->
|
||||
|
||||
### Environment
|
||||
<!--Your Configuration (please complete the following information): -->
|
||||
|
||||
- Image version / tag:
|
||||
- Host OS:
|
||||
|
||||
<details>
|
||||
<summary>Any logs | docker-compose.yml</summary>
|
||||
</details>
|
||||
|
||||
<!-- Include anything additional -->
|
||||
|
||||
### Possible fixes
|
||||
<!-- If you can, provide details to the root cause that might be responsible for the problem. -->
|
||||
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea or feature
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Description of the feature**
|
||||
<!-- A clear description of the feature you'd like implemented -->
|
||||
|
||||
**Benftits of feature**
|
||||
<!-- Explain the measurable benefits this feature would achieve. -->
|
||||
|
||||
**Additional context**
|
||||
<!--Add any other context or screenshots about the feature request here. -->
|
||||
110
.github/workflows/main.yml
vendored
Normal file
110
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
### Application Level Image CI
|
||||
### Dave Conroy <dave at tiredofit dot ca>
|
||||
|
||||
name: 'build'
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**'
|
||||
- '!README.md'
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=${GITHUB_REPOSITORY/docker-/}
|
||||
set -x
|
||||
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||
if [[ $GITHUB_REF == refs/heads/*/* ]] ; then
|
||||
BRANCH="${DOCKER_IMAGE}:$(echo $GITHUB_REF | sed "s|refs/heads/||g" | sed "s|/|-|g")"
|
||||
else
|
||||
BRANCH=${GITHUB_REF#refs/heads/}
|
||||
fi
|
||||
|
||||
case ${BRANCH} in
|
||||
"main" | "master" )
|
||||
BRANCHTAG="${DOCKER_IMAGE}:latest"
|
||||
;;
|
||||
"develop" )
|
||||
BRANCHTAG="${DOCKER_IMAGE}:develop"
|
||||
;;
|
||||
* )
|
||||
if [ -n "${{ secrets.LATEST }}" ] ; then
|
||||
if [ "${BRANCHTAG}" = "${{ secrets.LATEST }}" ]; then
|
||||
BRANCHTAG="${DOCKER_IMAGE}:${BRANCH},${DOCKER_IMAGE}:${BRANCH}-latest,${DOCKER_IMAGE}:latest"
|
||||
else
|
||||
BRANCHTAG="${DOCKER_IMAGE}:${BRANCH},${DOCKER_IMAGE}:${BRANCH}-latest"
|
||||
fi
|
||||
else
|
||||
BRANCHTAG="${DOCKER_IMAGE}:${BRANCH},${DOCKER_IMAGE}:${BRANCH}-latest"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
GITTAG="${DOCKER_IMAGE}:$(echo $GITHUB_REF | sed 's|refs/tags/||g')"
|
||||
fi
|
||||
|
||||
if [ -n "${BRANCHTAG}" ] && [ -n "${GITTAG}" ]; then
|
||||
TAGS=${BRANCHTAG},${GITTAG}
|
||||
else
|
||||
TAGS="${BRANCHTAG}${GITTAG}"
|
||||
fi
|
||||
|
||||
echo ::set-output name=tags::${TAGS}
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Label
|
||||
id: Label
|
||||
run: |
|
||||
if [ -f "Dockerfile" ] ; then
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_repository=\"https://github.com/${GITHUB_REPOSITORY}\"" Dockerfile
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_commit=\"${GITHUB_SHA}\"" Dockerfile
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_committed_by=\"${GITHUB_ACTOR}\"" Dockerfile
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.image_build_date=\"$(date +'%Y-%m-%d %H:%M:%S')\"" Dockerfile
|
||||
if [ -f "CHANGELOG.md" ] ; then
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_changelog_version=\"$(head -n1 ./CHANGELOG.md | awk '{print $2}')\"" Dockerfile
|
||||
fi
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_tag=\"${GITHUB_REF#refs/tags/v}\"" Dockerfile
|
||||
fi
|
||||
|
||||
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||
sed -i "/FROM .*/a LABEL tiredofit.image.git_branch=\"${GITHUB_REF#refs/heads/}\"" Dockerfile
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
69
CHANGELOG.md
69
CHANGELOG.md
@@ -1,3 +1,72 @@
|
||||
## 2.9.1 2021-10-15 <sbrunecker@github>
|
||||
|
||||
### 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 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
- Postgresql 14 Support (compiled)
|
||||
- MSSQL 17.8.1.1
|
||||
|
||||
|
||||
## 2.8.2 2021-10-15 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Change to using aws cli from Alpine repositories (fixes #81)
|
||||
|
||||
|
||||
## 2.8.1 2021-09-01 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Modernize image with updated environment varialbes from upstream
|
||||
|
||||
|
||||
## 2.8.0 2021-08-27 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
- Alpine 3.14 Base
|
||||
|
||||
### 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 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
- MongoDB Authentication Database support (DB_AUTH)
|
||||
|
||||
|
||||
## 2.6.1 2021-06-08 <jwillmer@github>
|
||||
|
||||
### Changed
|
||||
- Fix for Issue #14 - SPLIT_DB=TRUE was not working for Postgres DB server
|
||||
|
||||
|
||||
## 2.6.0 2021-02-19 <tpansino@github>
|
||||
|
||||
### Added
|
||||
- SQLite support
|
||||
|
||||
|
||||
## 2.5.1 2021-02-14 <dave at tiredofit dot ca>
|
||||
|
||||
### Changed
|
||||
- Fix xz backups with `PARALLEL_COMPRESION=TRUE`
|
||||
|
||||
|
||||
## 2.5.0 2021-01-25 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
- Multi Platform Build Variants (ARMv7 AMD64 AArch64)
|
||||
|
||||
### 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 <dave at tiredofit dot ca>
|
||||
|
||||
### Added
|
||||
|
||||
148
Dockerfile
148
Dockerfile
@@ -1,57 +1,165 @@
|
||||
FROM tiredofit/alpine:edge
|
||||
FROM docker.io/tiredofit/alpine:3.14
|
||||
|
||||
### Set Environment Variables
|
||||
ENV MSSQL_VERSION=17.5.2.1-1 \
|
||||
ENABLE_CRON=FALSE \
|
||||
ENABLE_SMTP=FALSE \
|
||||
ENABLE_ZABBIX=TRUE \
|
||||
ZABBIX_HOSTNAME=db-backup
|
||||
ENV MSSQL_VERSION=17.8.1.1-1 \
|
||||
CONTAINER_ENABLE_MESSAGING=FALSE \
|
||||
CONTAINER_ENABLE_MONITORING=TRUE
|
||||
|
||||
### Dependencies
|
||||
|
||||
ENV LANG=en_US.utf8 \
|
||||
PG_MAJOR=14 \
|
||||
PG_VERSION=14.0 \
|
||||
PGDATA=/var/lib/postgresql/data
|
||||
|
||||
|
||||
### Create User Accounts
|
||||
RUN set -ex && \
|
||||
echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
addgroup -g 70 postgres && \
|
||||
adduser -S -D -H -h /var/lib/postgresql -s /bin/sh -G postgres -u 70 postgres && \
|
||||
mkdir -p /var/lib/postgresql && \
|
||||
chown -R postgres:postgres /var/lib/postgresql && \
|
||||
\
|
||||
### Install Dependencies
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add \
|
||||
openssl \
|
||||
&& \
|
||||
\
|
||||
apk add --no-cache --virtual .postgres-build-deps \
|
||||
bison \
|
||||
build-base \
|
||||
coreutils \
|
||||
dpkg-dev \
|
||||
dpkg \
|
||||
flex \
|
||||
gcc \
|
||||
icu-dev \
|
||||
libc-dev \
|
||||
libedit-dev \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
make \
|
||||
openssl-dev \
|
||||
perl-utils \
|
||||
perl-ipc-run \
|
||||
util-linux-dev \
|
||||
zlib-dev \
|
||||
&& \
|
||||
\
|
||||
### Build Postgresql
|
||||
mkdir -p /usr/src/postgresql && \
|
||||
curl -sSL "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" | tar xvfj - --strip 1 -C /usr/src/postgresql && \
|
||||
cd /usr/src/postgresql && \
|
||||
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
|
||||
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
|
||||
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new && \
|
||||
grep '/var/run/postgresql' src/include/pg_config_manual.h.new && \
|
||||
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h && \
|
||||
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" && \
|
||||
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
|
||||
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' && \
|
||||
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' && \
|
||||
./configure \
|
||||
--build="$gnuArch" \
|
||||
--enable-integer-datetimes \
|
||||
--enable-thread-safety \
|
||||
--enable-tap-tests \
|
||||
--disable-rpath \
|
||||
--with-uuid=e2fs \
|
||||
--with-gnu-ld \
|
||||
--with-pgport=5432 \
|
||||
--with-system-tzdata=/usr/share/zoneinfo \
|
||||
--prefix=/usr/local \
|
||||
--with-includes=/usr/local/include \
|
||||
--with-libraries=/usr/local/lib \
|
||||
--with-openssl \
|
||||
--with-libxml \
|
||||
--with-libxslt \
|
||||
--with-icu \
|
||||
&& \
|
||||
\
|
||||
make -j "$(nproc)" world && \
|
||||
make install-world && \
|
||||
make -C contrib install && \
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)" && \
|
||||
apk add -t .postgres-additional-deps \
|
||||
$runDeps \
|
||||
&& \
|
||||
\
|
||||
### Cleanup
|
||||
apk del .postgres-build-deps && \
|
||||
cd / && \
|
||||
rm -rf \
|
||||
/usr/src/postgresql \
|
||||
/usr/local/share/doc \
|
||||
/usr/local/share/man && \
|
||||
find /usr/local -name '*.a' -delete && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
\
|
||||
### Dependencies
|
||||
set -ex && \
|
||||
apk update && \
|
||||
apk upgrade && \
|
||||
apk add -t .db-backup-build-deps \
|
||||
build-base \
|
||||
bzip2-dev \
|
||||
git \
|
||||
libarchive-dev \
|
||||
xz-dev \
|
||||
&& \
|
||||
\
|
||||
apk add --no-cache -t .db-backup-run-deps \
|
||||
bzip2 \
|
||||
aws-cli \
|
||||
bzip2 \
|
||||
influxdb \
|
||||
libarchive \
|
||||
mariadb-client \
|
||||
mariadb-connector-c \
|
||||
mongodb-tools \
|
||||
libressl \
|
||||
pigz \
|
||||
postgresql \
|
||||
postgresql-client \
|
||||
#postgresql \ # To reactivate when it appears in official repos with Alpine 3.15
|
||||
#postgresql-client \ # To reactivate when it appears in official repos with Alpine 3.15
|
||||
redis \
|
||||
sqlite \
|
||||
xz \
|
||||
zstd \
|
||||
&& \
|
||||
\
|
||||
apk add --no-cache \
|
||||
pixz@testing \
|
||||
&& \
|
||||
\
|
||||
cd /usr/src && \
|
||||
curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_${MSSQL_VERSION}_amd64.apk && \
|
||||
curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_${MSSQL_VERSION}_amd64.apk && \
|
||||
echo y | apk add --allow-untrusted msodbcsql17_${MSSQL_VERSION}_amd64.apk mssql-tools_${MSSQL_VERSION}_amd64.apk && \
|
||||
\
|
||||
apkArch="$(apk --print-arch)"; \
|
||||
case "$apkArch" in \
|
||||
x86_64) mssql=true ; curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_${MSSQL_VERSION}_amd64.apk ; curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_${MSSQL_VERSION}_amd64.apk ; echo y | apk add --allow-untrusted msodbcsql17_${MSSQL_VERSION}_amd64.apk mssql-tools_${MSSQL_VERSION}_amd64.apk ;; \
|
||||
*) echo >&2 "Detected non x86_64 build variant, skipping MSSQL installation" ;; \
|
||||
esac; \
|
||||
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 && \
|
||||
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 && \
|
||||
\
|
||||
### Cleanup
|
||||
apk del .db-backup-build-deps && \
|
||||
rm -rf /usr/src/* && \
|
||||
rm -rf /tmp/* /var/cache/apk/*
|
||||
rm -rf /root/.cache /tmp/* /var/cache/apk/*
|
||||
|
||||
### S6 Setup
|
||||
ADD install /
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Dave Conroy
|
||||
Copyright (c) 2021 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
|
||||
|
||||
168
README.md
168
README.md
@@ -1,13 +1,16 @@
|
||||
# hub.docker.com/r/tiredofit/db-backup
|
||||
# github.com/tiredofit/docker-db-backup
|
||||
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://microbadger.com/images/tiredofit/db-backup)
|
||||
[](https://github.com/tiredofit/docker-db-backup/releases/latest)
|
||||
[](https://github.com/tiredofit/docker-db-backup/actions?query=workflow%3Abuild)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup/)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup/)
|
||||
[](https://github.com/sponsors/tiredofit)
|
||||
[](https://www.paypal.me/tiredofit)
|
||||
|
||||
## Introduction
|
||||
* * *
|
||||
## About
|
||||
|
||||
This will build a container for backing up multiple type of DB Servers
|
||||
This will build a container for backing up multiple types of DB Servers
|
||||
|
||||
Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
|
||||
|
||||
@@ -22,53 +25,61 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis servers.
|
||||
* 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
|
||||
|
||||
* This Container uses a [customized Alpine Linux base](https://hub.docker.com/r/tiredofit/alpine) which includes [s6 overlay](https://github.com/just-containers/s6-overlay) enabled for PID 1 Init capabilities, [zabbix-agent](https://zabbix.org) for individual container monitoring, Cron also installed along with other tools (bash,curl, less, logrotate, nano, vim) for easier management. It also supports sending to external SMTP servers.
|
||||
|
||||
[Changelog](CHANGELOG.md)
|
||||
|
||||
## Authors
|
||||
## Maintainer
|
||||
|
||||
- [Dave Conroy](https://github.com/tiredofit)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [hub.docker.com/r/tiredofit/db-backup](#hubdockercomrtiredofitdb-backup)
|
||||
- [Introduction](#introduction)
|
||||
- [Authors](#authors)
|
||||
- [Table of Contents](#table-of-contents)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Installation](#installation)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Configuration](#configuration)
|
||||
- [Data-Volumes](#data-volumes)
|
||||
- [Environment Variables](#environment-variables)
|
||||
- [Maintenance](#maintenance)
|
||||
- [Shell Access](#shell-access)
|
||||
- [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)
|
||||
- [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)
|
||||
|
||||
## Prerequisites
|
||||
## Prerequisites and Assumptions
|
||||
|
||||
You must have a working DB server or container available for this to work properly, it does not provide server functionality!
|
||||
|
||||
## Installation
|
||||
|
||||
Automated builds of the image are available on [Docker Hub](https://hub.docker.com/r/tiredofit/db-backup) and is the recommended
|
||||
method of installation.
|
||||
### Build from Source
|
||||
Clone this repository and build the image with `docker build -t (imagename) .`
|
||||
|
||||
### Prebuilt Images
|
||||
Builds of the image are available on [Docker Hub](https://hub.docker.com/r/tiredofit/db-backup) and is the recommended method of installation.
|
||||
|
||||
```bash
|
||||
docker pull tiredofit/db-backup:latest
|
||||
docker pull tiredofit/db-backup:(imagetag)
|
||||
```
|
||||
|
||||
The following image tags are available along with their tagged release based on what's written in the [Changelog](CHANGELOG.md):
|
||||
|
||||
| Container OS | Tag |
|
||||
| ------------ | --------- |
|
||||
| Alpine | `:latest` |
|
||||
|
||||
|
||||
## 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.
|
||||
@@ -77,10 +88,7 @@ docker pull tiredofit/db-backup:latest
|
||||
* Map [persistent storage](#data-volumes) for access to configuration and data files for backup.
|
||||
|
||||
> **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.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Data-Volumes
|
||||
### Persistent Storage
|
||||
|
||||
The following directories are used for configuration and can be mapped for persistent storage.
|
||||
|
||||
@@ -88,18 +96,27 @@ The following directories are used for configuration and can be mapped for persi
|
||||
| ------------------------ | ---------------------------------------------------------------------------------- |
|
||||
| `/backup` | Backups |
|
||||
| `/assets/custom-scripts` | *Optional* Put custom scripts in this directory to execute after backup operations |
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Along with the Environment Variables from the [Base image](https://hub.docker.com/r/tiredofit/alpine), below is the complete list of available options that can be used to customize your installation.
|
||||
#### 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`,`vim`.
|
||||
|
||||
Be sure to view the following repositories to understand all the customizable options:
|
||||
|
||||
| Image | Description |
|
||||
| ------------------------------------------------------ | -------------------------------------- |
|
||||
| [OS Base](https://github.com/tiredofit/docker-alpine/) | Customized Image based on Alpine Linux |
|
||||
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `BACKUP_LOCATION` | Backup to `FILESYSTEM` or `S3` compatible services like S3, Minio, Wasabi - Default `FILESYSTEM` |
|
||||
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, ZSTD `ZSTD` or none `NONE` - Default `GZ` |
|
||||
| `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` - Default `3` |
|
||||
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` |
|
||||
| `DB_HOST` | Server Hostname e.g. `mariadb` |
|
||||
| `DB_AUTH` | (Mongo Only - Optional) Authentication Database |
|
||||
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `sqlite3` |
|
||||
| `DB_HOST` | Server Hostname e.g. `mariadb`. For `sqlite3`, full path to DB file e.g. `/backup/db.sqlite3` |
|
||||
| `DB_NAME` | Schema Name e.g. `database` |
|
||||
| `DB_USER` | username for the database - use `root` to backup all MySQL of them. |
|
||||
| `DB_PASS` | (optional if DB doesn't require it) password for the database |
|
||||
@@ -118,33 +135,36 @@ Along with the Environment Variables from the [Base image](https://hub.docker.co
|
||||
|
||||
When using compression with MongoDB, only `GZ` compression is possible.
|
||||
|
||||
**Backing Up to S3 Compatible Services**
|
||||
#### Backing Up to S3 Compatible Services
|
||||
|
||||
If `BACKUP_LOCATION` = `S3` then the following options are used.
|
||||
|
||||
| Parameter | Description |
|
||||
| --------------- | --------------------------------------------------------------------------------------- |
|
||||
| `S3_BUCKET` | S3 Bucket name e.g. 'mybucket' |
|
||||
| `S3_HOSTNAME` | Hostname of S3 Server e.g "s3.amazonaws.com" - You can also include a port if necessary |
|
||||
| `S3_HOST` | Hostname of S3 Server e.g "s3.amazonaws.com" - You can also include a port if necessary |
|
||||
| `S3_KEY_ID` | S3 Key ID |
|
||||
| `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_URI_STYLE` | Choose either `VIRTUALHOST` or `PATH` style - Default `VIRTUALHOST` |
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
Manual Backups can be performed by entering the container and typing `backup-now`
|
||||
|
||||
### Shell Access
|
||||
|
||||
For debugging and maintenance purposes you may want access the containers shell.
|
||||
|
||||
```bash
|
||||
docker exec -it (whatever your container name is e.g.) db-backup 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`
|
||||
|
||||
#### Custom Scripts
|
||||
|
||||
### Custom Scripts
|
||||
|
||||
If you want to execute a custom script at the end of backup, you can drop bash scripts with the extension of `.sh` in this directory. See the following example to utilize:
|
||||
|
||||
@@ -152,16 +172,16 @@ If you want to execute a custom script at the end of backup, you can drop bash s
|
||||
$ cat post-script.sh
|
||||
##!/bin/bash
|
||||
|
||||
## Example Post Script
|
||||
## $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
|
||||
## $5=DATE (Date of Backup)
|
||||
## $6=TIME (Time of Backup)
|
||||
## $7=BACKUP_FILENAME (Filename of Backup)
|
||||
## $8=FILESIZE (Filesize of backup)
|
||||
## $9=MD5_RESULT (MD5Sum if enabled)
|
||||
# #### Example Post Script
|
||||
# #### $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
|
||||
# #### $5=DATE (Date of Backup)
|
||||
# #### $6=TIME (Time of Backup)
|
||||
# #### $7=BACKUP_FILENAME (Filename of Backup)
|
||||
# #### $8=FILESIZE (Filesize of backup)
|
||||
# #### $9=MD5_RESULT (MD5Sum if enabled)
|
||||
|
||||
echo "${1} ${2} Backup Completed on ${3} for ${4} on ${5} ${6}. Filename: ${7} Size: ${8} bytes MD5: ${9}"
|
||||
````
|
||||
@@ -171,3 +191,23 @@ Outputs the following on the console:
|
||||
`0 mysql Backup Completed on example-db for example on 2020-04-22 05:19:10. Filename: mysql_example_example-db_20200422-051910.sql.bz2 Size: 7795 bytes MD5: 952fbaafa30437494fdf3989a662cd40`
|
||||
|
||||
If you wish to change the size value from bytes to megabytes set environment variable `SIZE_VALUE=megabytes`
|
||||
|
||||
## 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) 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.
|
||||
|
||||
0
examples/docker-compose.yml
Normal file → Executable file
0
examples/docker-compose.yml
Normal file → Executable file
1
install/etc/cont-finish.d/10-db-backup
Normal file → Executable file
1
install/etc/cont-finish.d/10-db-backup
Normal file → Executable file
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
pkill bash
|
||||
|
||||
|
||||
@@ -42,6 +42,11 @@ case "$dbtype" in
|
||||
[[ ( -n "${DB_PASS}" ) || ( -n "${DB_PASS_FILE}" ) ]] && file_env 'DB_PASS'
|
||||
;;
|
||||
"mssql" | "MSSQL" | "microsoftsql" | "MICROSOFTSQL")
|
||||
apkArch="$(apk --print-arch)"; \
|
||||
case "$apkArch" in
|
||||
x86_64) mssql=true ;;
|
||||
*) print_error "MSSQL cannot operate on $apkArch processor!" ; exit 1 ;;
|
||||
esac
|
||||
dbtype=mssql
|
||||
dbport=${DB_PORT:-1433}
|
||||
;;
|
||||
@@ -55,6 +60,9 @@ case "$dbtype" in
|
||||
dbport=${DB_PORT:-6379}
|
||||
[[ ( -n "${DB_PASS}" || ( -n "${DB_PASS_FILE}" ) ) ]] && file_env 'DB_PASS'
|
||||
;;
|
||||
"sqlite" | "sqlite3" | "SQLITE" | "SQLITE3" )
|
||||
dbtype=sqlite3
|
||||
;;
|
||||
esac
|
||||
|
||||
### Set Defaults
|
||||
@@ -110,6 +118,7 @@ case "$dbtype" in
|
||||
[[ ( -n "${DB_USER}" ) ]] && MONGO_USER_STR=" --username ${dbuser}"
|
||||
[[ ( -n "${DB_PASS}" ) ]] && MONGO_PASS_STR=" --password ${dbpass}"
|
||||
[[ ( -n "${DB_NAME}" ) ]] && MONGO_DB_STR=" --db ${dbname}"
|
||||
[[ ( -n "${DB_AUTH}" ) ]] && MONGO_AUTH_STR=" --authenticationDatabase ${DB_AUTH}"
|
||||
;;
|
||||
"mysql" )
|
||||
[[ ( -n "${DB_PASS}" ) ]] && export MYSQL_PWD=${dbpass}
|
||||
@@ -156,7 +165,7 @@ backup_mongo() {
|
||||
target=${dbtype}_${dbname}_${dbhost}_${now}.archivegz
|
||||
mongo_compression="--gzip"
|
||||
fi
|
||||
mongodump --archive=${tmpdir}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_DB_STR} ${EXTRA_OPTS}
|
||||
mongodump --archive=${tmpdir}/${target} ${mongo_compression} --host ${dbhost} --port ${dbport} ${MONGO_USER_STR}${MONGO_PASS_STR}${MONGO_AUTH_STR}${MONGO_DB_STR} ${EXTRA_OPTS}
|
||||
exit_code=$?
|
||||
cd ${tmpdir}
|
||||
generate_md5
|
||||
@@ -195,7 +204,9 @@ backup_mysql() {
|
||||
backup_pgsql() {
|
||||
if var_true $SPLIT_DB ; then
|
||||
export PGPASSWORD=${dbpass}
|
||||
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
||||
authdb=${DB_USER}
|
||||
[ -n "${DB_NAME}" ] && authdb=${DB_NAME}
|
||||
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
||||
for db in $DATABASES; do
|
||||
print_info "Dumping database: $db"
|
||||
target=pgsql_${db}_${dbhost}_${now}.sql
|
||||
@@ -205,13 +216,13 @@ backup_pgsql() {
|
||||
generate_md5
|
||||
move_backup
|
||||
done
|
||||
else
|
||||
export PGPASSWORD=${dbpass}
|
||||
compression
|
||||
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $dumpoutput > ${tmpdir}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
else
|
||||
export PGPASSWORD=${dbpass}
|
||||
compression
|
||||
pg_dump -h ${dbhost} -U ${dbuser} -p ${dbport} ${dbname} ${EXTRA_OPTS} | $dumpoutput > ${tmpdir}/${target}
|
||||
exit_code=$?
|
||||
generate_md5
|
||||
move_backup
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -236,6 +247,22 @@ backup_redis() {
|
||||
move_backup
|
||||
}
|
||||
|
||||
backup_sqlite3() {
|
||||
db=$(basename "$dbhost")
|
||||
db="${db%.*}"
|
||||
target=sqlite3_${db}_${now}.sqlite3
|
||||
compression
|
||||
|
||||
print_info "Dumping sqlite3 database: ${dbhost}"
|
||||
sqlite3 "${dbhost}" ".backup '${tmpdir}/backup.sqlite3'"
|
||||
exit_code=$?
|
||||
|
||||
cat "${tmpdir}/backup.sqlite3" | $dumpoutput > "${tmpdir}/${target}"
|
||||
|
||||
generate_md5
|
||||
move_backup
|
||||
}
|
||||
|
||||
check_availability() {
|
||||
### Set the Database Type
|
||||
case "$dbtype" in
|
||||
@@ -265,8 +292,9 @@ check_availability() {
|
||||
;;
|
||||
"mysql" )
|
||||
COUNTER=0
|
||||
export MYSQL_PWD=${dbpass}
|
||||
while true; do
|
||||
mysqlcmd='mysql -u'${dbuser}' -P '${dbport}' -h '${dbhost}' -p'${dbpass}
|
||||
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
|
||||
@@ -304,6 +332,21 @@ check_availability() {
|
||||
print_warn "Redis Host '${dbhost}' is not accessible, retrying.. ($COUNTER seconds so far)"
|
||||
done
|
||||
;;
|
||||
"sqlite3" )
|
||||
if [[ ! -e "${dbhost}" ]]; then
|
||||
print_error "File '${dbhost}' does not exist."
|
||||
exit_code=2
|
||||
exit $exit_code
|
||||
elif [[ ! -f "${dbhost}" ]]; then
|
||||
print_error "File '${dbhost}' is not a file."
|
||||
exit_code=2
|
||||
exit $exit_code
|
||||
elif [[ ! -r "${dbhost}" ]]; then
|
||||
print_error "File '${dbhost}' is not readable."
|
||||
exit_code=2
|
||||
exit $exit_code
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -372,34 +415,10 @@ move_backup() {
|
||||
mv ${tmpdir}/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
||||
;;
|
||||
"S3" | "s3" | "MINIO" | "minio" )
|
||||
s3_content_type="application/octet-stream"
|
||||
if [ "$S3_URI_STYLE" = "VIRTUALHOST" ] || [ "$S3_URI_STYLE" = "VHOST" ] || [ "$S3_URI_STYLE" = "virtualhost" ] || [ "$S3_URI_STYLE" = "vhost" ] ; then
|
||||
s3_url="${S3_BUCKET}.${S3_HOST}"
|
||||
else
|
||||
s3_url="${S3_HOST}/${S3_BUCKET}"
|
||||
fi
|
||||
|
||||
if var_true "$MD5" ; then
|
||||
s3_date="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")"
|
||||
s3_md5="$(libressl md5 -binary < "${tmpdir}/${target}.md5" | base64)"
|
||||
sig="$(printf "PUT\n$s3_md5\n${s3_content_type}\n$s3_date\n/$S3_BUCKET/$S3_PATH/${target}.md5" | libressl sha1 -binary -hmac "${S3_KEY_SECRET}" | base64)"
|
||||
print_debug "Uploading ${target}.md5 to S3"
|
||||
curl -T "${tmpdir}/${target}.md5" "${S3_PROTOCOL}"://"${s3_url}"/"${S3_PATH}"/"${target}".md5 \
|
||||
-H "Date: $date" \
|
||||
-H "Authorization: AWS ${S3_KEY_ID}:$sig" \
|
||||
-H "Content-Type: ${s3_content_type}" \
|
||||
-H "Content-MD5: ${s3_md5}"
|
||||
fi
|
||||
|
||||
s3_date="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")"
|
||||
s3_md5="$(libressl md5 -binary < "${tmpdir}/${target}" | base64)"
|
||||
sig="$(printf "PUT\n$s3_md5\n${s3_content_type}\n$s3_date\n/$S3_BUCKET/$S3_PATH/${target}" | libressl sha1 -binary -hmac "${S3_KEY_SECRET}" | base64)"
|
||||
print_debug "Uploading ${target} to S3"
|
||||
curl -T ${tmpdir}/"${target}" "${S3_PROTOCOL}"://"${s3_url}"/"${S3_PATH}"/"${target}" \
|
||||
-H "Date: $s3_date" \
|
||||
-H "Authorization: AWS ${S3_KEY_ID}:$sig" \
|
||||
-H "Content-Type: ${s3_content_type}" \
|
||||
-H "Content-MD5: ${s3_md5}"
|
||||
export AWS_ACCESS_KEY_ID=${S3_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${S3_KEY_SECRET}
|
||||
export AWS_DEFAULT_REGION=ap-northeast-2
|
||||
aws s3 cp ${tmpdir}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target}
|
||||
|
||||
rm -rf ${tmpdir}/*.md5
|
||||
rm -rf ${tmpdir}/"${target}"
|
||||
@@ -472,10 +491,14 @@ print_debug "Backup routines Initialized on $(date)"
|
||||
check_availability
|
||||
backup_redis
|
||||
;;
|
||||
"sqlite3" )
|
||||
check_availability
|
||||
backup_sqlite3
|
||||
;;
|
||||
esac
|
||||
|
||||
### Zabbix
|
||||
if var_true "$ENABLE_ZABBIX" ; then
|
||||
if var_true "$CONTAINER_ENABLE_MONITORING}" ; then
|
||||
print_notice "Sending Backup Statistics to Zabbix"
|
||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.size -o "$(stat -c%s "${DB_DUMP_TARGET}"/"${target}")"
|
||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.datetime -o "$(date -r "${DB_DUMP_TARGET}"/"${target}" +'%s')"
|
||||
|
||||
Reference in New Issue
Block a user