Skip to content

Commit c2843fc

Browse files
authored
Merge pull request #796 from Paraphraser/20250424-mariadb-master
2025-04-24 mariadb - master branch - PR 1 of 2
2 parents 4dacdf1 + b36ba1e commit c2843fc

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

.templates/mariadb/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ ENV CANDIDATES="/defaults/my.cnf /defaults/custom.cnf"
88
#
99
# https://discord.com/channels/638610460567928832/638610461109256194/825049573520965703
1010
# https://stackoverflow.com/questions/61809270/how-to-discover-why-mariadb-crashes
11+
# as at 2025-04-23, thread_cache_size is ignored (at least for MariaDB versions 10.6.9
12+
# through 11.4.5 where it always has the value 100). It could probably be removed.
1113
RUN for CNF in ${CANDIDATES} ; do [ -f ${CNF} ] && break ; done ; \
1214
sed -i.bak \
1315
-e "s/^thread_cache_size/# thread_cache_size/" \
1416
-e "s/^read_buffer_size/# read_buffer_size/" \
1517
${CNF}
1618

1719
# copy the health-check script into place
18-
ENV HEALTHCHECK_SCRIPT "iotstack_healthcheck.sh"
20+
ENV HEALTHCHECK_SCRIPT="iotstack_healthcheck.sh"
1921
COPY ${HEALTHCHECK_SCRIPT} /usr/local/bin/${HEALTHCHECK_SCRIPT}
2022

2123
# define the health check
@@ -29,3 +31,4 @@ HEALTHCHECK \
2931
ENV CANDIDATES=
3032

3133
# EOF
34+

.templates/mariadb/iotstack_healthcheck.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ HEALTHCHECK_PORT="${MYSQL_TCP_PORT:-3306}"
77
# the expected response is?
88
EXPECTED="mysqld is alive"
99

10+
# handle root password presence/absence
11+
unset ARGUMENT
12+
if [ -n "${MYSQL_ROOT_PASSWORD}" ] ; then
13+
if ! $(mariadb -u root -e 'quit' &> /dev/null) ; then
14+
ARGUMENT="-p${MYSQL_ROOT_PASSWORD}"
15+
fi
16+
fi
17+
1018
# run the check
11-
if [ -z "$MYSQL_ROOT_PASSWORD" ] ; then
12-
RESPONSE=$(mysqladmin ping -h localhost)
19+
if [ -n "$(which mariadb-admin)" ] ; then
20+
RESPONSE=$(mariadb-admin ping ${ARGUMENT})
1321
else
14-
# note - there is NO space between "-p" and the password. This is
15-
# intentional. It is part of the mysql and mysqladmin API.
16-
RESPONSE=$(mysqladmin -p${MYSQL_ROOT_PASSWORD} ping -h localhost)
22+
RESPONSE=$(mysqladmin ping ${ARGUMENT})
1723
fi
1824

19-
# did the mysqladmin command succeed?
25+
# did the ping succeed?
2026
if [ $? -eq 0 ] ; then
2127

2228
# yes! is the response as expected?

0 commit comments

Comments
 (0)