MariaDB / mariadb-docker

Docker Official Image packaging for MariaDB
https://mariadb.org
GNU General Public License v2.0
770 stars 438 forks source link

MDEV-25434: mariadb container to have HEALTHCHECK script #408

Closed grooverdan closed 2 years ago

grooverdan commented 2 years ago

Adds a healthcheck script that gives the user few basics options for health checks include:

@PhrozenByte any comments/suggestions?

For all those that require a connection a mysql@localhost IDENTIFIED VIA unix_socket would be beneficial. I'll do a separate PR soon.

grooverdan commented 2 years ago

e.g:

$ podman run --rm --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 --name m102 --health-interval=4s  --health-cmd='healthcheck.sh --connect --innodb_buffer_pool_loaded --mariadbupgrade' m102
..

$ while podman ps ; do sleep 1; done | grep m10
d9a6b4f2d5d6  localhost/m102:latest  mysqld      Less than a second ago  Up Less than a second ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      1 second ago  Up 1 second ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      3 seconds ago  Up 3 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      4 seconds ago  Up 4 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      5 seconds ago  Up 5 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      6 seconds ago  Up 6 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      7 seconds ago  Up 7 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      9 seconds ago  Up 9 seconds ago (starting)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      10 seconds ago  Up 10 seconds ago (healthy)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      11 seconds ago  Up 11 seconds ago (healthy)              m102
d9a6b4f2d5d6  localhost/m102:latest  mysqld      12 seconds ago  Up 12 seconds ago (healthy)              m102
PhrozenByte commented 2 years ago

Great work @grooverdan! :+1: :rocket: