diff --git a/doc/release-notes/rl-2505.section.md b/doc/release-notes/rl-2505.section.md index 697c5456798d..c107f886d792 100644 --- a/doc/release-notes/rl-2505.section.md +++ b/doc/release-notes/rl-2505.section.md @@ -112,6 +112,8 @@ - `pkgs.nextcloud28` has been removed since it's out of support upstream. +- `centrifugo` was updated to v6, which uses a new config format. See [upstream documentation](https://centrifugal.dev/docs/getting-started/migration_v6) for migration. + - `teleport` has been upgraded from major version 16 to major version 17. Refer to [upstream upgrade instructions](https://goteleport.com/docs/upgrading/overview/) and [release notes for v17](https://goteleport.com/docs/changelog/#1701-11152024). diff --git a/nixos/modules/services/networking/centrifugo.nix b/nixos/modules/services/networking/centrifugo.nix index 7b9a05069498..0f2a9f3e5f6a 100644 --- a/nixos/modules/services/networking/centrifugo.nix +++ b/nixos/modules/services/networking/centrifugo.nix @@ -65,6 +65,14 @@ in }; config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = + (lib.versionAtLeast cfg.package.version "6") -> (!(cfg.settings ? name) && !(cfg.settings ? port)); + message = "`services.centrifugo.settings` is v5 config, must be compatible with centrifugo v6 config format"; + } + ]; + systemd.services.centrifugo = { description = "Centrifugo messaging server"; wantedBy = [ "multi-user.target" ]; diff --git a/nixos/tests/centrifugo.nix b/nixos/tests/centrifugo.nix index 8ad44a011663..5867297c3d30 100644 --- a/nixos/tests/centrifugo.nix +++ b/nixos/tests/centrifugo.nix @@ -10,7 +10,10 @@ in { lib, ... }: { name = "centrifugo"; - meta.maintainers = [ lib.maintainers.tie ]; + meta.maintainers = [ + lib.maintainers.tie + lib.maintainers.valodim + ]; nodes = lib.listToAttrs ( lib.imap0 (index: name: { @@ -21,12 +24,15 @@ in services.centrifugo = { enable = true; settings = { - inherit name; - port = centrifugoPort; - # See https://centrifugal.dev/docs/server/engines#redis-sharding - engine = "redis"; - # Connect to local Redis shard via Unix socket. - redis_address = + node = { + inherit name; + }; + http_server.port = centrifugoPort; + http_api.insecure = true; + usage_stats.disabled = true; + + engine.type = "redis"; + engine.redis.address = let toRedisAddresses = map (name: "${name}:${toString redisPort}"); in @@ -35,8 +41,6 @@ in "unix://${config.services.redis.servers.centrifugo.unixSocket}" ] ++ toRedisAddresses (lib.drop (index + 1) nodes); - usage_stats_disable = true; - api_insecure = true; }; extraGroups = [ config.services.redis.servers.centrifugo.user diff --git a/pkgs/by-name/ce/centrifugo/package.nix b/pkgs/by-name/ce/centrifugo/package.nix index e96f82a984b6..9a74648e6efa 100644 --- a/pkgs/by-name/ce/centrifugo/package.nix +++ b/pkgs/by-name/ce/centrifugo/package.nix @@ -16,23 +16,23 @@ let in buildGoModule rec { pname = "centrifugo"; - version = "5.4.9"; + version = "6.1.0"; src = fetchFromGitHub { owner = "centrifugal"; repo = "centrifugo"; rev = "v${version}"; - hash = "sha256-FDtAkoN1bdqVUEP0obbXBfQfVRpZN5YXbU1KT1yXWuI="; + hash = "sha256-7hh9wcM9cMfQ2W2PlDitTdJD9ftZt/KO/B+wV/c588U="; }; - vendorHash = "sha256-WfYN7bhtOPDp2UeB/WqtN3dD3+WO9lIxnXe2iTqn000="; + vendorHash = "sha256-hl1BznajnaOXMrlSqksqPdJih29yRDYW9IsyV9mSN20="; ldflags = [ "-s" "-w" - "-X=github.com/centrifugal/centrifugo/v5/internal/build.Version=${version}" - "-X=github.com/centrifugal/centrifugo/v5/internal/build.UsageStatsEndpoint=${statsEndpoint}" - "-X=github.com/centrifugal/centrifugo/v5/internal/build.UsageStatsToken=${statsToken}" + "-X=github.com/centrifugal/centrifugo/v6/internal/build.Version=${version}" + "-X=github.com/centrifugal/centrifugo/v6/internal/build.UsageStatsEndpoint=${statsEndpoint}" + "-X=github.com/centrifugal/centrifugo/v6/internal/build.UsageStatsToken=${statsToken}" ]; excludedPackages = [ @@ -56,7 +56,10 @@ buildGoModule rec { homepage = "https://centrifugal.dev"; changelog = "https://github.com/centrifugal/centrifugo/releases/tag/v${version}"; license = lib.licenses.asl20; - maintainers = [ lib.maintainers.tie ]; + maintainers = [ + lib.maintainers.tie + lib.maintainers.valodim + ]; mainProgram = "centrifugo"; }; }