Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ services:
RABBITMQ_DEFAULT_USER: infrahub
RABBITMQ_DEFAULT_PASS: infrahub
healthcheck:
test: rabbitmq-diagnostics -q check_port_connectivity
# raw TCP probe instead of rabbitmq-diagnostics: each diagnostics call
# boots a full Erlang VM (~2s CPU), which at a 1s interval pegs two
# cores per broker for the life of the stack
test: ["CMD", "bash", "-c", "</dev/tcp/127.0.0.1/5672"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This healthcheck hard-requires bash in the broker image, but the image is configurable via MESSAGE_QUEUE_DOCKER_IMAGE. If anyone runs the stack against a non-Debian rabbitmq image (e.g. an alpine variant or a custom build) that lacks bash, the exec-form probe fails to find bash, the healthcheck reports unhealthy, and depends_on: service_healthy for message-queue blocks the whole stack from starting. The previous rabbitmq-diagnostics form worked on any rabbitmq image. Note the fragility in the comment or fall back to a form that doesn't depend on bash when /bin/sh is dash.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At python_testcontainers/infrahub_testcontainers/docker-compose-cluster.test.yml, line 40:

<comment>This healthcheck hard-requires bash in the broker image, but the image is configurable via MESSAGE_QUEUE_DOCKER_IMAGE. If anyone runs the stack against a non-Debian rabbitmq image (e.g. an alpine variant or a custom build) that lacks bash, the exec-form probe fails to find bash, the healthcheck reports unhealthy, and depends_on: service_healthy for message-queue blocks the whole stack from starting. The previous rabbitmq-diagnostics form worked on any rabbitmq image. Note the fragility in the comment or fall back to a form that doesn't depend on bash when /bin/sh is dash.</comment>

<file context>
@@ -34,7 +34,10 @@ services:
+      # raw TCP probe instead of rabbitmq-diagnostics: each diagnostics call
+      # boots a full Erlang VM (~2s CPU), which at a 1s interval pegs two
+      # cores per broker for the life of the stack
+      test: ["CMD", "bash", "-c", "</dev/tcp/127.0.0.1/5672"]
       interval: 1s
       timeout: 1s
</file context>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the problem here is rabbitmq-diagnostics -q check_port_connectivity or if it's the interval of 1 second. Looks like we have the same check with a 5 second interval in the regular setup (i.e. under ./development). If this truly is just a tcp handshake it seems like an awful waste to start an Erlang VM for it. 🤯 But we should not only change it for the devcontainers but for all of our rabbitmq health checks.

interval: 1s
timeout: 1s
retries: 50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ services:
RABBITMQ_DEFAULT_USER: infrahub
RABBITMQ_DEFAULT_PASS: infrahub
healthcheck:
test: rabbitmq-diagnostics -q check_port_connectivity
# raw TCP probe instead of rabbitmq-diagnostics: each diagnostics call
# boots a full Erlang VM (~2s CPU), which at a 1s interval pegs two
# cores per broker for the life of the stack
test: ["CMD", "bash", "-c", "</dev/tcp/127.0.0.1/5672"]
interval: 1s
timeout: 1s
retries: 50
Expand Down
Loading