Skip to content

Commit 332f9e4

Browse files
authored
v1.3.0 (#13)
Major updates * Updating to latest Alpine S6 * Adding -u flag to executables and updating code accordingly * Using new _disable executable Minor updates * Improving log output * Trimming whitespace Documentation updates * Adding comments to mariadb/finish
1 parent 3c4492d commit 332f9e4

File tree

16 files changed

+41
-22
lines changed

16 files changed

+41
-22
lines changed

.github/workflows/build-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: docker/setup-buildx-action@v1
2323
-
2424
name: Login to DockerHub
25-
uses: docker/login-action@v1
25+
uses: docker/login-action@v1
2626
with:
2727
username: ${{ secrets.DOCKERHUB_USERNAME }}
2828
password: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/build-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
uses: docker/setup-buildx-action@v1
5757
-
5858
name: Login to DockerHub
59-
uses: docker/login-action@v1
59+
uses: docker/login-action@v1
6060
with:
6161
username: ${{ secrets.DOCKERHUB_USERNAME }}
6262
password: ${{ secrets.DOCKERHUB_TOKEN }}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM bcgdesign/alpine-s6:alpine-3.13-1.2.1
1+
#FROM bcgdesign/alpine-s6:alpine-3.13-1.2.1
2+
FROM bcgdesign/alpine-s6:dev
23

34
LABEL maintainer="Ben Green <ben@bcgdesign.com>" \
45
org.label-schema.name="MariaDB" \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,5 @@ $ docker exec -it mariadb db-export "foo" # 'foo' database dumped to /var/lib/ba
108108
109109
## Copyright
110110

111-
> Copyright (c) 2021 Ben Green <https://bcgdesign.com>
111+
> Copyright (c) 2021 Ben Green <https://bcgdesign.com>
112112
> Unless otherwise stated

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.4
1+
1.3.0

overlay/etc/db/backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ if [ "${BACKUP_KEEP_FOR_DAYS}" -gt 0 ] ; then
6767
MMIN=$((60*24*${BACKUP_KEEP_FOR_DAYS}))
6868
find ${BACKUP_PATH}/* -type d -mmin +${MMIN} | xargs rm -rf
6969
_done
70-
70+
7171
fi

overlay/etc/db/generate-init-file

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
set -eo pipefail
3+
set -euo pipefail
44

55

66
#======================================================================================================================
@@ -51,7 +51,7 @@ _echo " .. delete test database"
5151
echo "DROP DATABASE IF EXISTS test;" >> ${INIT_FILE}
5252

5353
# if database(s) specified, create (each) database and grant user permissions
54-
if [ -n "${MARIADB_DATABASE}" ] ; then
54+
if [ ! -z "${MARIADB_DATABASE-}" ] ; then
5555

5656
_echo " .. add application databases:"
5757
DATABASES=$(echo ${MARIADB_DATABASE} | tr "," "\n")

overlay/etc/db/import

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for FILE in /var/lib/backup/*.sql ; do
1616

1717
# execute file
1818
_echo " .. importing '${DATABASE}'"
19-
mariadb "${DATABASE}" < ${FILE} || _error " .. error"
19+
mariadb "${DATABASE}" < ${FILE} || _notok " .. something went wrong"
2020

2121
done
2222
_done

overlay/etc/services.d/mariadb-upgrade/run

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/with-contenv bash
22

3+
set -euo pipefail
4+
5+
36
#======================================================================================================================
47
# Wait until MariaDB is running before attempting the upgrade
58
#======================================================================================================================
@@ -17,7 +20,8 @@ else
1720

1821
# wait 2s before exiting the service - S6 will keep restarting it until MariaDB comes online
1922
# on first run, the mariadb service will disable this upgrade service itself
20-
_echo "Waiting for MariaDB to come online..."
21-
sleep 2s
23+
SLEEP=2
24+
_echo "Waiting ${SLEEP}s for MariaDB to come online..."
25+
sleep ${SLEEP}
2226

2327
fi

overlay/etc/services.d/mariadb/finish

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
#!/usr/bin/with-contenv bash
2+
3+
set -euo pipefail
4+
5+
6+
#======================================================================================================================
7+
# Use base executable to terminate all services
8+
#======================================================================================================================
9+
210
_terminate

overlay/etc/services.d/mariadb/run

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
set -eo pipefail
3+
set -euo pipefail
44

55

66
#======================================================================================================================
@@ -30,10 +30,10 @@ else
3030
db-upgrade-disable
3131

3232
# check for root password
33-
[[ -z "${MARIADB_ROOT_PASSWORD}" ]] && _error "MARIADB_ROOT_PASSWORD must be set."
33+
[[ -z "${MARIADB_ROOT_PASSWORD-}" ]] && _error "MARIADB_ROOT_PASSWORD must be set."
3434

3535
# check for application user and password
36-
[[ -z "${MARIADB_USERNAME}" || -z "${MARIADB_PASSWORD}" ]] && _error "MARIADB_USERNAME and MARIADB_PASSWORD must be set."
36+
[[ -z "${MARIADB_USERNAME-}" || -z "${MARIADB_PASSWORD-}" ]] && _error "MARIADB_USERNAME and MARIADB_PASSWORD must be set."
3737

3838
# run server installation
3939
_echo "Running mariadb-install-db..."

overlay/usr/local/bin/db-backup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/with-contenv bash
22

3+
set -eo pipefail
4+
5+
36
#======================================================================================================================
47
# Run /etc/db/backup executable
58
#======================================================================================================================

overlay/usr/local/bin/db-export

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ set -euo pipefail
1010
if [ $# -eq 1 ] && [ -n "${1}" ] ; then
1111
s6-setuidgid mysql /etc/db/export "${1}"
1212
else
13-
_error "You must specify a database name."
13+
_error "db-export: You must specify a database name."
1414
fi

overlay/usr/local/bin/db-upgrade

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/with-contenv bash
22

3+
set -euo pipefail
4+
5+
36
#======================================================================================================================
4-
# Run mariadb-upgrade
5-
# -f using -f (--force) to enforce upgrade checks, even if they have already been performed
7+
# Run mariadb-upgrade as root user
68
#======================================================================================================================
79

810
_echo "Running mariadb-upgrade..."
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/with-contenv bash
22

3+
set -euo pipefail
4+
5+
36
#======================================================================================================================
4-
# Disable mariadb-upgrade service
7+
# Use base executable to disable upgrade service
58
#======================================================================================================================
69

7-
_echo "Disabling mariadb-upgrade service..."
8-
s6-svc -d /var/run/s6/services/mariadb-upgrade
9-
_done
10+
_disable "mariadb-upgrade"

overlay/usr/local/bin/healthcheck

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

3-
set -euo pipefail
3+
set -eo pipefail
44

55

66
#======================================================================================================================

0 commit comments

Comments
 (0)