docker compose – rabbitmq spam logs with `connection` `closing AMQP connection` when celery container has healthcheck
I have docker cluster with celery, rabbitmq and other stuff. And I want to be sure that every service is healthy while cluster is starting. So here is the sample of my docker-compose.yaml, which is related to celery:
rabbit:
image: rabbitmq:3.13-management
container_name: rabbit
hostname: rabbit
env_file: .env
healthcheck:
test: rabbitmq-diagnostics check_port_connectivity
interval: 5s
timeout: 10s
retries: 10
volumes:
- rabbitdata:/var/lib/rabbitmq
ports:
- 5672:5672
- 15672:15672
celery:
build:
context: ./backend
dockerfile: ./celeryDockerfile
container_name: celery
env_file: .env
healthcheck:
test: celery -b ${CELERY_BROKER} status || exit 1
interval: 5s
timeout: 5s
retries: 10
depends_on:
backend:
condition: service_healthy
rabbit:
condition: service_healthy
dashboard:
image: mher/flower
container_name: dashboard
env_file: .env
command: celery flower
volumes:
- celery:/app
ports:
- 5555:5555
depends_on:
backend:
condition: service_healthy
rabbit:
condition: service_healthy
celery:
condition: service_healthy
As you can see I have a healthcheck for celery. And if it is on, rabbit spams logs with this:
[info] <0.1422.0> accepting AMQP connection <0.1422.0> (172.18.0.8:56208 -> 172.18.0.3:5672)
[info] <0.1422.0> connection <0.1422.0> (172.18.0.8:56208 -> 172.18.0.3:5672): user 'uid0001' authenticated and granted access to vhost "https://stackoverflow.com/"
[info] <0.1439.0> accepting AMQP connection <0.1439.0> (172.18.0.8:56220 -> 172.18.0.3:5672)
[info] <0.1439.0> connection <0.1439.0> (172.18.0.8:56220 -> 172.18.0.3:5672): user 'uid0001' authenticated and granted access to vhost "https://stackoverflow.com/"
[warning] <0.1422.0> closing AMQP connection <0.1422.0> (172.18.0.8:56208 -> 172.18.0.3:5672, vhost: "https://stackoverflow.com/", user: 'uid0001'):
[warning] <0.1422.0> client unexpectedly closed TCP connection
[warning] <0.1439.0> closing AMQP connection <0.1439.0> (172.18.0.8:56220 -> 172.18.0.3:5672, vhost: "https://stackoverflow.com/", user: 'uid0001'):
[warning] <0.1439.0> client unexpectedly closed TCP connection
As far as I know, healthcheck must do specific number of retries, that you specify with retries: tag. However rabbit continue to spam connect-disconnect info in logs forever, until I stop the cluster. How can I fix that?
Read more here: Source link
