Add health checks and dependency conditions in docker-compose.yml
Introduced health checks for `netneutrality-db` to ensure proper readiness before dependent services start. Replaced static sleep in `startup.sh` with dynamic database availability checks, improving startup reliability and reducing downtime risks.
This commit is contained in:
1 parent
78d6ade17a
commit
d0ea0535e2
2 files changed
+10
-5
No files matched your search
+10
-2
@@ -13,6 +13,12 @@ services:
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE:-netneutrality}
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
|
||||
- MARIADB_AUTO_UPGRADE=1
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
|
||||
netneutrality-bot:
|
||||
image: gitea.bobert.me/anthorob/netneutrality:${NETNEUTRALITY_TAG:-latest}
|
||||
@@ -22,8 +28,10 @@ services:
|
||||
networks:
|
||||
- netneutrality
|
||||
depends_on:
|
||||
- netneutrality-db
|
||||
- lavalink
|
||||
netneutrality-db:
|
||||
condition: service_healthy
|
||||
lavalink:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
|
||||
@@ -26,9 +26,6 @@ if [ ! -f /usr/bin/nc ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting 10 seconds for database to start.."
|
||||
sleep 10
|
||||
|
||||
echo "Checking if MySQL / MariaDB is started.."
|
||||
if /usr/bin/nc -z $MYSQL_HOST $MYSQL_PORT; then
|
||||
echo "Database OK. Starting bot..";
|
||||
|
||||
Reference in new issue
Block a user