Skip to content

Commit ddb56ab

Browse files
szachovyCopilot
andcommitted
Expand keepalived healthcheck to cover all critical components
Create healthcheck.sh that checks mysqlrouter process, mysqladmin ping, Docker daemon, Superset swarm service, and Redis. Update keepalived to use the new script with interval=5, weight=-20, fall=3, rise=2. Copy the script to the named volume during init container setup. Closes #66 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit ddb56ab

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
* CI workflow to build and push service images to GitHub Container Registry on master merge. (#97)
1717
* Pull-first with local build fallback for container images during deployment. (#97)
1818

19+
### Fixed
20+
21+
* Expand keepalived healthcheck to cover MySQL Router, Docker daemon, Superset service, and Redis. (#66)
22+
1923
### Changed
2024

2125
* Completed [ARCHITECTURE.md](./docs/ARCHITECTURE.md) (#93)

services/mysql-mgmt/docker_compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ services:
7676
--execute="DROP USER 'superset'@'$(mysqlsh --python --execute "exec(open('/opt/interfaces.py').read())")';"
7777
ifmetric ${VIRTUAL_NETWORK_INTERFACE} 2
7878
/opt/envsubst-Linux-x86_64 < "/opt/keepalived.conf.tpl" > "/opt/default/keepalived.conf";
79+
cp "/opt/healthcheck.sh" "/opt/default/healthcheck.sh";
80+
chmod 755 "/opt/default/healthcheck.sh";
7981
chown --recursive superset:superset "/opt/default"
8082
cap_add:
8183
- "NET_ADMIN"

services/mysql-mgmt/healthcheck.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
killall -0 mysqlrouter 2>/dev/null || exit 1
5+
mysqladmin --login-path=superset --port=6446 ping 2>/dev/null || exit 1
6+
docker info > /dev/null 2>&1 || exit 1
7+
docker service inspect superset --format '{{.Spec.Name}}' 2>/dev/null | grep -q superset || exit 1
8+
docker exec redis redis-cli ping 2>/dev/null | grep -q PONG || exit 1
9+
10+
exit 0

services/mysql-mgmt/keepalived.conf.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ global_defs {
66
}
77

88
vrrp_script status {
9-
script "/bin/killall -0 mysqlrouter"
10-
interval 1
11-
weight 2
9+
script "/opt/default/healthcheck.sh"
10+
interval 5
11+
weight -20
12+
fall 3
13+
rise 2
1214
}
1315

1416
vrrp_instance virtual_instance {

0 commit comments

Comments
 (0)