Skip to content
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

rabbitmq: fix unit file generation #1251

Merged
merged 1 commit into from
Jan 24, 2025
Merged
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
16 changes: 10 additions & 6 deletions nixos/roles/rabbitmq.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ in
enabledRolesCount = length (lib.attrNames enabledRoles);
enabled = enabledRolesCount > 0;
roleVersion = head (lib.attrNames enabledRoles);
isSingleNode = length (fclib.findServices "rabbitmq-node") == 1;
in
lib.mkMerge [

Expand All @@ -51,6 +52,15 @@ in
flyingcircus.services.rabbitmq.enable = true;
})

# For single-node setups of current RabbitMQ versions, set feature flags
# automatically after platform upgrades. This is the easy and common case.
# Cluster setups require manual intervention for enabling feature flags.
# Note that we simply check the number of rabbitmq instances in the RG to be safe,
# we don't know here if they actually form a cluster.
(lib.mkIf (config.flyingcircus.roles.rabbitmq.enable && isSingleNode) {
systemd.services.rabbitmq.postStart = "rabbitmqctl enable_feature_flag all";
})

(lib.mkIf enabled {
assertions =
[
Expand Down Expand Up @@ -83,11 +93,5 @@ in
}
];
}

{
systemd.services.rabbitmq.postStart = lib.optionalString ((length (fclib.findServices "rabbitmq-node")) == 1) ''
rabbitmqctl enable_feature_flag all
'';
}
];
}
Loading