rabbitmq: add option to enable management plugin

wip/nixpkgs-raku
happysalada 3 years ago committed by Raphael Megzari
parent 36cf478468
commit f091420c1d
  1. 27
      nixos/modules/services/amqp/rabbitmq.nix
  2. 6
      nixos/tests/rabbitmq.nix

@ -134,6 +134,28 @@ in
type = types.listOf types.path; type = types.listOf types.path;
description = "The list of directories containing external plugins"; description = "The list of directories containing external plugins";
}; };
managementPlugin = mkOption {
description = "The options to run the management plugin";
type = types.submodule {
options = {
enable = mkOption {
default = false;
type = types.bool;
description = ''
Whether to enable the management plugin
'';
};
port = mkOption {
default = 15672;
type = types.port;
description = ''
On which port to run the management plugin
'';
};
};
};
};
}; };
}; };
@ -158,8 +180,13 @@ in
services.rabbitmq.configItems = { services.rabbitmq.configItems = {
"listeners.tcp.1" = mkDefault "${cfg.listenAddress}:${toString cfg.port}"; "listeners.tcp.1" = mkDefault "${cfg.listenAddress}:${toString cfg.port}";
} // optionalAttrs cfg.managementPlugin.enable {
"management.tcp.port" = toString cfg.managementPlugin.port;
"management.tcp.ip" = cfg.listenAddress;
}; };
services.rabbitmq.plugins = optional cfg.managementPlugin.enable "rabbitmq_management";
systemd.services.rabbitmq = { systemd.services.rabbitmq = {
description = "RabbitMQ Server"; description = "RabbitMQ Server";

@ -7,7 +7,10 @@ import ./make-test-python.nix ({ pkgs, ... }: {
}; };
machine = { machine = {
services.rabbitmq.enable = true; services.rabbitmq = {
enable = true;
managementPlugin.enable = true;
};
# Ensure there is sufficient extra disk space for rabbitmq to be happy # Ensure there is sufficient extra disk space for rabbitmq to be happy
virtualisation.diskSize = 1024; virtualisation.diskSize = 1024;
}; };
@ -19,5 +22,6 @@ import ./make-test-python.nix ({ pkgs, ... }: {
machine.wait_until_succeeds( machine.wait_until_succeeds(
'su -s ${pkgs.runtimeShell} rabbitmq -c "rabbitmqctl status"' 'su -s ${pkgs.runtimeShell} rabbitmq -c "rabbitmqctl status"'
) )
machine.wait_for_open_port("15672")
''; '';
}) })

Loading…
Cancel
Save