fix: eliminar bloqueo infinito en espera de Redis al arrancar
- entrypoint.sh: Redis wait tenía loop infinito sin timeout → el contenedor se quedaba colgado para siempre si Redis tardaba, causando 504 Gateway Timeout Ahora tiene MAX_RETRIES=15 (30s) y continúa aunque Redis no esté disponible - entrypoint.sh: removido set -e para que errores no-críticos (permisos, SSL, etc.) no maten el arranque del contenedor - docker-compose.yml: removido depends_on redis con condition:service_healthy Docker bloqueaba el inicio de app hasta que Redis estuviera healthy, lo que podía exceder el timeout de Traefik
This commit is contained in:
@@ -30,9 +30,6 @@ services:
|
|||||||
- WEBHOOK_VERIFY_TOKEN=${WEBHOOK_VERIFY_TOKEN}
|
- WEBHOOK_VERIFY_TOKEN=${WEBHOOK_VERIFY_TOKEN}
|
||||||
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
||||||
- ENABLE_RATE_LIMIT=${ENABLE_RATE_LIMIT:-true}
|
- ENABLE_RATE_LIMIT=${ENABLE_RATE_LIMIT:-true}
|
||||||
depends_on:
|
|
||||||
redis:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
networks:
|
||||||
- whatsapp-network
|
- whatsapp-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
+15
-5
@@ -1,17 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Entrypoint script para el contenedor
|
# Entrypoint script para el contenedor
|
||||||
|
# set -e removido: comandos no críticos (permisos, SSL) no deben matar el arranque
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "🚀 Iniciando WhatsApp Bot Manager..."
|
echo "🚀 Iniciando WhatsApp Bot Manager..."
|
||||||
|
|
||||||
# Esperar a que Redis esté disponible
|
# Esperar a que Redis esté disponible (con timeout para no bloquear el arranque)
|
||||||
|
if [ "${REDIS_HOST:-redis}" != "" ]; then
|
||||||
echo "⏳ Esperando Redis..."
|
echo "⏳ Esperando Redis..."
|
||||||
until redis-cli -h ${REDIS_HOST:-redis} ping 2>/dev/null; do
|
MAX_RETRIES=15
|
||||||
echo " Redis no disponible, esperando..."
|
RETRY=0
|
||||||
|
until redis-cli -h ${REDIS_HOST:-redis} -p ${REDIS_PORT:-6379} ping 2>/dev/null | grep -q PONG; do
|
||||||
|
RETRY=$((RETRY + 1))
|
||||||
|
if [ $RETRY -ge $MAX_RETRIES ]; then
|
||||||
|
echo "⚠️ Redis no disponible después de $MAX_RETRIES intentos, continuando sin Redis..."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo " Redis no disponible, intento $RETRY/$MAX_RETRIES..."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
if [ $RETRY -lt $MAX_RETRIES ]; then
|
||||||
echo "✅ Redis conectado"
|
echo "✅ Redis conectado"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Esperar a que MySQL esté disponible
|
# Esperar a que MySQL esté disponible
|
||||||
if [ "${DB_HOST}" = "mysql" ] || [ "${DB_HOST}" = "db" ]; then
|
if [ "${DB_HOST}" = "mysql" ] || [ "${DB_HOST}" = "db" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user