reorg
All checks were successful
Container Publish / on-success-skip (push) Has been skipped
Container Publish / build-image (arm64, 10.11) (push) Successful in 23s
Container Publish / build-image (arm64, 10.6) (push) Successful in 21s
Container Publish / build-image (amd64, 10.11) (push) Successful in 1m16s
Container Publish / build-image (arm64, 11.4) (push) Successful in 1m41s
Container Publish / build-image (amd64, 10.6) (push) Successful in 1m16s
Container Publish / build-image (arm64, 11.8) (push) Successful in 1m36s
Container Publish / build-image (amd64, 11.4) (push) Successful in 1m40s
Container Publish / build-image (amd64, 11.8) (push) Successful in 1m31s
Container Publish / update docker manifest (10.11) (push) Successful in 10s
Container Publish / update docker manifest (11.4) (push) Successful in 10s
Container Publish / update docker manifest (10.6) (push) Successful in 10s
Container Publish / update docker manifest (11.8) (push) Successful in 10s
All checks were successful
Container Publish / on-success-skip (push) Has been skipped
Container Publish / build-image (arm64, 10.11) (push) Successful in 23s
Container Publish / build-image (arm64, 10.6) (push) Successful in 21s
Container Publish / build-image (amd64, 10.11) (push) Successful in 1m16s
Container Publish / build-image (arm64, 11.4) (push) Successful in 1m41s
Container Publish / build-image (amd64, 10.6) (push) Successful in 1m16s
Container Publish / build-image (arm64, 11.8) (push) Successful in 1m36s
Container Publish / build-image (amd64, 11.4) (push) Successful in 1m40s
Container Publish / build-image (amd64, 11.8) (push) Successful in 1m31s
Container Publish / update docker manifest (10.11) (push) Successful in 10s
Container Publish / update docker manifest (11.4) (push) Successful in 10s
Container Publish / update docker manifest (10.6) (push) Successful in 10s
Container Publish / update docker manifest (11.8) (push) Successful in 10s
This commit is contained in:
22
rootfs/etc/default/automysqlbackup
Normal file
22
rootfs/etc/default/automysqlbackup
Normal file
@@ -0,0 +1,22 @@
|
||||
USERNAME=root
|
||||
PASSWORD="${MYSQL_ROOT_PASSWORD}"
|
||||
DBHOST=localhost
|
||||
DBNAMES=all
|
||||
BACKUPDIR="/var/lib/automysqlbackup"
|
||||
|
||||
MAILCONTENT="quiet"
|
||||
MAXATTSIZE="4000"
|
||||
MAILADDR="root"
|
||||
|
||||
MDBNAMES="$DBNAMES"
|
||||
DBEXCLUDE="information_schema mysql performance_schema"
|
||||
CREATE_DATABASE=yes
|
||||
SEPDIR=yes
|
||||
DOWEEKLY=6
|
||||
COMP=gzip
|
||||
COMMCOMP=no
|
||||
LATEST=no
|
||||
MAX_ALLOWED_PACKET=
|
||||
SOCKET=
|
||||
ROUTINES=yes
|
||||
|
||||
1
rootfs/etc/mysql/conf.d/maria-include.cnf
Normal file
1
rootfs/etc/mysql/conf.d/maria-include.cnf
Normal file
@@ -0,0 +1 @@
|
||||
!includedir /etc/mysql/mariadb.conf.d/
|
||||
4
rootfs/etc/mysql/mariadb.conf.d/custom.cnf
Normal file
4
rootfs/etc/mysql/mariadb.conf.d/custom.cnf
Normal file
@@ -0,0 +1,4 @@
|
||||
[mysqld]
|
||||
server_id=33
|
||||
replicate-do-db=
|
||||
read-only
|
||||
5
rootfs/etc/mysql/mariadb.conf.d/mysql.cnf
Normal file
5
rootfs/etc/mysql/mariadb.conf.d/mysql.cnf
Normal file
@@ -0,0 +1,5 @@
|
||||
[mysqld]
|
||||
log_bin
|
||||
log-bin = binlog
|
||||
max-binlog-size = 500M
|
||||
log-basename=backup-slave
|
||||
3
rootfs/etc/sudoers.d/mysudoers
Normal file
3
rootfs/etc/sudoers.d/mysudoers
Normal file
@@ -0,0 +1,3 @@
|
||||
mysql ALL = (ALL) NOPASSWD: /usr/sbin/service cron start
|
||||
mysql ALL = (ALL) NOPASSWD: /usr/sbin/cron
|
||||
mysql ALL = (ALL) NOPASSWD: /usr/bin/chown
|
||||
36
rootfs/usr/local/bin/docker-entrypoint-new.sh
Executable file
36
rootfs/usr/local/bin/docker-entrypoint-new.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
source /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
write_custom_config() {
|
||||
SERVER_ID=${SERVER_ID:-33}
|
||||
READONLY=${READONLY:-1}
|
||||
|
||||
cat >/etc/mysql/mariadb.conf.d/custom.cnf <<EOF
|
||||
[mysqld]
|
||||
server_id=${SERVER_ID}
|
||||
replicate-do-db=${REPLICATE_DO_DB}
|
||||
EOF
|
||||
|
||||
if [ "$READONLY" = "1" ] ; then
|
||||
echo "read-only" >> /etc/mysql/mariadb.conf.d/custom.cnf
|
||||
fi
|
||||
}
|
||||
|
||||
start_cron() {
|
||||
sudo cron -f &
|
||||
}
|
||||
|
||||
chown_datadir() {
|
||||
sudo chown -R mysql /var/lib/mysql
|
||||
}
|
||||
|
||||
if ! _is_sourced; then
|
||||
write_custom_config
|
||||
chown_datadir
|
||||
start_cron
|
||||
_main "$@"
|
||||
fi
|
||||
22
rootfs/usr/local/bin/healthcheck.sh
Executable file
22
rootfs/usr/local/bin/healthcheck.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-nopassword}
|
||||
|
||||
# slave not configured
|
||||
SLAVE_STATUS=$(mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" -e 'SHOW SLAVE STATUS\G')
|
||||
if [[ -z "${SLAVE_STATUS}" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# extract slave status
|
||||
SLAVE_IO=$(echo "${SLAVE_STATUS}" | awk -F: '/Slave_IO_Running/ {gsub(/ /, "", $2); print $2}')
|
||||
SLAVE_SQL=$(echo "${SLAVE_STATUS}" | awk -F: '/Slave_SQL_Running/ {gsub(/ /, "", $2); print $2}')
|
||||
|
||||
# slave ok
|
||||
if [[ "${SLAVE_IO}" == "Yes" && "${SLAVE_SQL}" == "Yes" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# slave not ok
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user