conduktor / kafka-stack-docker-compose

docker compose files to create a fully working kafka stack
Apache License 2.0
3.24k stars 1.25k forks source link

Healthcheck support #110

Closed niemyjski closed 5 months ago

niemyjski commented 2 years ago

Would it be possible to add healthcheck support? I'm trying to run the single instance of zookeeper and kafka (zk-single-kafka-single.yml) on github actions. It seems like it's not waiting for the kafka instance to be ready. I've also tried this and a bunch of other things:

    depends_on:
      kafka:
        condition: service_healthy
name: Build
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - name: Start Services
      run: docker compose up -d && docker compose up ready || true
    - name: Verify
      run: docker run --network=host edenhill/kcat:1.7.1 -b localhost:9092 -L -T

The resulting output: https://github.com/FoundatioFx/Foundatio.Kafka/runs/6716787571?check_suite_focus=true

niemyjski commented 2 years ago

I can't seem to get this to run reliably but what I've seen others do is something like this:

    healthcheck:
      test: ["CMD", "kafka-topics", "--bootstrap-server", "kafka1:9092", "--list"]
      start_period: 15s
      interval: 30s
      timeout: 10s
      retries: 3
niemyjski commented 2 years ago

I get that there are built in health checks, I've been struggling to get anything to connect to kafka instance in github actions. I do see that you have test.sh and it's somewhat working (although there are errors in the build step trying to process a message).

AurelieMarcuzzo commented 5 months ago

Hi, in order to do an health check, you can use: