-
Notifications
You must be signed in to change notification settings - Fork 0
feat(rabbitmq): enable core plugins, production config, and Erlang VM tuning #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # SPDX-FileCopyrightText: 2025 Blackcat Informatics® Inc. | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Core Data — RabbitMQ Production Configuration | ||
| # | ||
| # This file is mounted read-only into the container at | ||
| # /etc/rabbitmq/rabbitmq.conf. Edit values here directly; | ||
| # RabbitMQ's sysctl-format config does not support environment | ||
| # variable substitution. | ||
| # | ||
| # Reference: https://www.rabbitmq.com/docs/configure | ||
| # Reference: https://www.rabbitmq.com/docs/production-checklist | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Memory & flow control | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # In containerized environments use an absolute limit rather than a | ||
| # relative watermark so the Erlang VM does not mis-detect available | ||
| # memory. Adjust to match your container's mem_limit. | ||
| # 512 MiB is suitable for a lightweight single-node broker. | ||
| vm_memory_high_watermark.absolute = 512MiB | ||
|
|
||
| # Begin paging messages to disk when memory reaches 50 % of the | ||
| # watermark. At 512 MiB this triggers at ~256 MiB. | ||
| vm_memory_high_watermark_paging_ratio = 0.5 | ||
|
|
||
| # Use Erlang allocator stats for memory calculation — more accurate | ||
| # than the default RSS-based strategy inside containers. | ||
| vm_memory_calculation_strategy = allocated | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Disk free space | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # Minimum free disk before the broker blocks publishers. Should | ||
| # roughly match the memory watermark to ensure safe page-out. | ||
| disk_free_limit.absolute = 512MiB | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Networking & connections | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # Heartbeat — detect dead TCP connections. 60 s is a safe default | ||
| # that avoids false positives under transient load. | ||
| heartbeat = 60 | ||
|
|
||
| # Maximum channels per connection. Prevents a single client from | ||
| # exhausting broker resources. | ||
| channel_max = 128 | ||
|
|
||
| # TCP listen backlog — how many pending connections the kernel queues | ||
| # before refusing new ones. | ||
| tcp_listen_options.backlog = 256 | ||
|
|
||
| # Enable TCP keepalives so the OS detects half-open connections. | ||
| tcp_listen_options.keepalive = true | ||
|
|
||
| # Disable Nagle's algorithm for lower message latency. | ||
| tcp_listen_options.nodelay = true | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Queue & message defaults | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # Default queue type for new declarations that do not specify one. | ||
| # Classic queues are the correct choice for a single-node deployment | ||
| # (quorum queues add Raft overhead with no replication benefit). | ||
| default_queue_type = classic | ||
|
|
||
| # Consumer delivery acknowledgement timeout (ms). Consumers that | ||
| # hold messages longer than 30 minutes without ack are disconnected. | ||
| consumer_timeout = 1800000 | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Management & monitoring | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # Increase the statistics emission interval from 5 s to 15 s. | ||
| # Reduces periodic overhead on connections, channels and queues | ||
| # while remaining sufficient for Prometheus scrape intervals. | ||
| collect_statistics_interval = 15000 | ||
|
|
||
| # Disable guest user login from remote hosts (security hardening). | ||
| loopback_users.guest = true | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Streams | ||
| # ────────────────────────────────────────────── | ||
|
|
||
| # Stream protocol listener port. | ||
| stream.listeners.tcp.1 = 5552 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ RABBITMQ_SERVICE_NAME=${RABBITMQ_SERVICE_NAME:-rabbitmq} | |||||||||||||||||||||||||
| RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq} | ||||||||||||||||||||||||||
| RABBITMQ_PORT=${RABBITMQ_PORT:-5672} | ||||||||||||||||||||||||||
| RABBITMQ_MANAGEMENT_PORT=${RABBITMQ_MANAGEMENT_PORT:-15672} | ||||||||||||||||||||||||||
| RABBITMQ_STREAM_PORT=${RABBITMQ_STREAM_PORT:-5552} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| ensure_rabbitmq_service() { | ||||||||||||||||||||||||||
| if ! compose_has_service "${RABBITMQ_SERVICE_NAME}"; then | ||||||||||||||||||||||||||
|
|
@@ -86,6 +87,12 @@ USAGE | |||||||||||||||||||||||||
| echo "[rabbitmq] Definitions written to ${output_path}" >&2 | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| cmd_rabbitmq_plugins() { | ||||||||||||||||||||||||||
| ensure_env | ||||||||||||||||||||||||||
| ensure_rabbitmq_service | ||||||||||||||||||||||||||
| rabbitmq_exec rabbitmq-plugins list "$@" | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation hardcodes the To align with the documented behavior and the test plan (which requires
Suggested change
|
||||||||||||||||||||||||||
| rabbitmq_exec rabbitmq-plugins list "$@" | |
| if [[ $# -eq 0 ]]; then | |
| rabbitmq_exec rabbitmq-plugins list | |
| else | |
| rabbitmq_exec rabbitmq-plugins "$@" | |
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -241,6 +241,7 @@ Cache, messaging, pooling | |
| rabbitmq-ctl [args] Run rabbitmqctl inside the RabbitMQ container. | ||
| rabbitmq-diagnostics [args] Run rabbitmq-diagnostics inside RabbitMQ. | ||
| rabbitmq-export [--output PATH] Export RabbitMQ definitions to host (JSON). | ||
| rabbitmq-plugins [args] List or manage RabbitMQ plugins. | ||
| rabbitmq-overview Show rabbitmq-diagnostics status summary. | ||
| pgbouncer-stats SHOW STATS via PgBouncer admin console. | ||
| pgbouncer-pools SHOW POOLS via PgBouncer admin console. | ||
|
|
@@ -1507,6 +1508,9 @@ rabbitmq-diagnostics) | |
| rabbitmq-export) | ||
| cmd_rabbitmq_export "$@" | ||
| ;; | ||
| rabbitmq-plugins) | ||
| cmd_rabbitmq_plugins "$@" | ||
| ;; | ||
|
Comment on lines
+1511
to
+1513
|
||
| rabbitmq-overview) | ||
| cmd_rabbitmq_overview "$@" | ||
| ;; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compose_exec bash -lc "${cmd[*]}"builds a shell command string from user-controlled values (--since,--output) without robust escaping. This can break when values contain spaces/shell metacharacters and can lead to shell injection inside the container. Prefer executingpgbadgerwithoutbash -lc(if possible), or escape each argument (e.g., viaprintf %q) / pass args viabash -lc '... "$@"'to avoid interpolation.