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"
8
8
#
9
9
# https://discord.com/channels/638610460567928832/638610461109256194/825049573520965703
10
10
# 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.
11
13
RUN for CNF in ${CANDIDATES} ; do [ -f ${CNF} ] && break ; done ; \
12
14
sed -i.bak \
13
15
-e "s/^thread_cache_size/# thread_cache_size/" \
14
16
-e "s/^read_buffer_size/# read_buffer_size/" \
15
17
${CNF}
16
18
17
19
# copy the health-check script into place
18
- ENV HEALTHCHECK_SCRIPT "iotstack_healthcheck.sh"
20
+ ENV HEALTHCHECK_SCRIPT= "iotstack_healthcheck.sh"
19
21
COPY ${HEALTHCHECK_SCRIPT} /usr/local/bin/${HEALTHCHECK_SCRIPT}
20
22
21
23
# define the health check
@@ -29,3 +31,4 @@ HEALTHCHECK \
29
31
ENV CANDIDATES=
30
32
31
33
# EOF
34
+
Original file line number Diff line number Diff line change @@ -7,16 +7,22 @@ HEALTHCHECK_PORT="${MYSQL_TCP_PORT:-3306}"
7
7
# the expected response is?
8
8
EXPECTED=" mysqld is alive"
9
9
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
+
10
18
# 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} )
13
21
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} )
17
23
fi
18
24
19
- # did the mysqladmin command succeed?
25
+ # did the ping succeed?
20
26
if [ $? -eq 0 ] ; then
21
27
22
28
# yes! is the response as expected?
You can’t perform that action at this time.
0 commit comments