File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff 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.
1113RUN 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"
1921COPY ${HEALTHCHECK_SCRIPT} /usr/local/bin/${HEALTHCHECK_SCRIPT}
2022
2123# define the health check
@@ -29,3 +31,4 @@ HEALTHCHECK \
2931ENV CANDIDATES=
3032
3133# EOF
34+
Original file line number Diff line number Diff line change @@ -7,16 +7,22 @@ HEALTHCHECK_PORT="${MYSQL_TCP_PORT:-3306}"
77# the expected response is?
88EXPECTED=" 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} )
1321else
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} )
1723fi
1824
19- # did the mysqladmin command succeed?
25+ # did the ping succeed?
2026if [ $? -eq 0 ] ; then
2127
2228 # yes! is the response as expected?
You can’t perform that action at this time.
0 commit comments