kestra_queue_soak.sh 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. set -eu
  3. compose_file=${COMPOSE_FILE:-deploy/docker/docker-compose.yml}
  4. duration=${KESTRA_SOAK_SECONDS:-120}
  5. interval=${KESTRA_SOAK_INTERVAL_SECONDS:-5}
  6. deadline=$(( $(date +%s) + duration ))
  7. kestra_container=$(docker compose -f "$compose_file" ps -q kestra)
  8. initial_restarts=$(docker inspect -f '{{.RestartCount}}' "$kestra_container")
  9. checks=0
  10. while [ "$(date +%s)" -lt "$deadline" ]; do
  11. docker compose -f "$compose_file" exec -T kestra \
  12. curl -fsS http://127.0.0.1:8081/health >/dev/null
  13. current_restarts=$(docker inspect -f '{{.RestartCount}}' "$kestra_container")
  14. if [ "$current_restarts" != "$initial_restarts" ]; then
  15. echo "Kestra restarted during soak: ${initial_restarts} -> ${current_restarts}" >&2
  16. exit 1
  17. fi
  18. checks=$((checks + 1))
  19. sleep "$interval"
  20. done
  21. if docker compose -f "$compose_file" logs --since "${duration}s" kestra |
  22. grep -Eiq 'broken pipe|connection is closed|connection reset|hikaripool.*failed|outofmemory|fatal'; then
  23. echo "Kestra emitted a fatal database/queue signature during soak" >&2
  24. exit 1
  25. fi
  26. echo "Kestra soak passed: ${checks} health checks, restart count ${initial_restarts}"