diff --git a/nixos/module-list.nix b/nixos/module-list.nix index af554d46..52cb3bae 100644 --- a/nixos/module-list.nix +++ b/nixos/module-list.nix @@ -3,7 +3,6 @@ ./modules/ca-gateway.nix ./modules/phoebus/alarm-logger.nix ./modules/phoebus/alarm-server.nix - ./modules/phoebus/local-kafka.nix ./modules/phoebus/olog.nix ./modules/phoebus/save-and-restore.nix ] diff --git a/nixos/modules/phoebus/alarm-logger.nix b/nixos/modules/phoebus/alarm-logger.nix index d8e49444..47af9914 100644 --- a/nixos/modules/phoebus/alarm-logger.nix +++ b/nixos/modules/phoebus/alarm-logger.nix @@ -4,13 +4,10 @@ lib, pkgs, ... -} @ moduleAttrs: let +}: let cfg = config.services.phoebus-alarm-logger; settingsFormat = pkgs.formats.javaProperties {}; configFile = settingsFormat.generate "phoebus-alarm-logger.properties" cfg.settings; - - localKafka = lib.hasPrefix "localhost:" cfg.settings."bootstrap.servers"; - localElasticsearch = cfg.settings.es_host == "localhost"; in { options.services.phoebus-alarm-logger = { enable = lib.mkEnableOption '' @@ -90,8 +87,6 @@ in { "bootstrap.servers" = lib.mkOption { description = "Location of the Kafka server"; type = lib.types.str; - default = "localhost:${toString config.services.apache-kafka.port}"; - defaultText = lib.literalExpression ''"localhost:''${toString config.services.apache-kafka.port}"''; }; date_span_units = lib.mkOption { @@ -141,10 +136,6 @@ in { description = "Phoebus Alarm Logger"; wantedBy = ["multi-user.target"]; - after = lib.mkMerge [ - (lib.mkIf localKafka ["apache-kafka.service"]) - (lib.mkIf localElasticsearch ["elasticsearch.service"]) - ]; # Weirdly not "phoebus.user" environment.JAVA_OPTS = "-Djava.util.prefs.userRoot=/var/lib/phoebus-alarm-logger"; @@ -162,29 +153,10 @@ in { }; }; - services.apache-kafka = lib.mkIf localKafka { - enable = true; - localSetup.enable = true; - }; - # Port conflicts by default with phoebus-alarm-logger's port - services.zookeeper.extraConf = lib.mkIf localKafka '' - admin.enableServer=false - ''; - - services.elasticsearch = lib.mkIf localElasticsearch { - enable = true; - # Should be kept in sync with the phoebus-olog and phoebus-save-and-restore services - package = pkgs.elasticsearch7; - }; - networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ (lib.toInt cfg.settings."server.port") ]; }; - meta = { - maintainers = with epnixLib.maintainers; [minijackson]; - # TODO: - # doc = ./alarm-logger.md; - }; + meta.maintainers = with epnixLib.maintainers; [minijackson]; } diff --git a/nixos/modules/phoebus/alarm-server.nix b/nixos/modules/phoebus/alarm-server.nix index 9319af53..d7ed08f4 100644 --- a/nixos/modules/phoebus/alarm-server.nix +++ b/nixos/modules/phoebus/alarm-server.nix @@ -4,12 +4,10 @@ lib, pkgs, ... -} @ moduleAttrs: let +}: let cfg = config.services.phoebus-alarm-server; settingsFormat = pkgs.formats.javaProperties {}; configFile = settingsFormat.generate "phoebus-alarm-server.properties" cfg.settings; - - localKafka = lib.hasPrefix "localhost:" cfg.settings."org.phoebus.applications.alarm/server"; in { options.services.phoebus-alarm-server = { enable = lib.mkEnableOption '' @@ -34,7 +32,6 @@ in { Includes services: - - Apache Kafka (if configured locally) - Phoebus Alarm Logger (if not disabled) Warning: this opens the firewall on all network interfaces. @@ -72,8 +69,6 @@ in { "org.phoebus.applications.alarm/server" = lib.mkOption { description = "Kafka server host:port"; type = lib.types.str; - default = "localhost:${toString config.services.apache-kafka.port}"; - defaultText = lib.literalExpression ''"localhost:''${toString config.services.apache-kafka.port}"''; }; # Waiting for: https://github.com/ControlSystemStudio/phoebus/issues/2843 @@ -168,7 +163,6 @@ in { description = "Phoebus Alarm Server"; wantedBy = ["multi-user.target"]; - after = lib.mkIf localKafka ["apache-kafka.service"]; environment.JAVA_OPTS = "-Dphoebus.user=/var/lib/phoebus-alarm-server"; @@ -191,20 +185,7 @@ in { enable = lib.mkDefault true; openFirewall = lib.mkIf cfg.openFirewall (lib.mkDefault true); }; - - services.apache-kafka = lib.mkIf localKafka { - enable = true; - localSetup.enable = true; - }; - - networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ - config.services.apache-kafka.port - ]; }; - meta = { - maintainers = with epnixLib.maintainers; [minijackson]; - # TODO: - # doc = ./alarm-server.md; - }; + meta.maintainers = with epnixLib.maintainers; [minijackson]; } diff --git a/nixos/modules/phoebus/local-kafka.nix b/nixos/modules/phoebus/local-kafka.nix deleted file mode 100644 index 4c5193df..00000000 --- a/nixos/modules/phoebus/local-kafka.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - ... -}: { - # This is put as a separate file, so that both the phoebus-alarm-server and - # phoebus-alarm-service provide the same configuration, if used separately - options.services.apache-kafka.localSetup.enable = lib.mkEnableOption "Configure a local, non-replicated Kafka instance"; - - config = lib.mkIf config.services.apache-kafka.localSetup.enable { - # TODO: document replication setup - services.apache-kafka = { - logDirs = lib.mkDefault ["/var/lib/apache-kafka"]; - extraProperties = '' - offsets.topic.replication.factor=1 - transaction.state.log.replication.factor=1 - transaction.state.log.min.isr=1 - ''; - }; - - systemd.services.apache-kafka = { - after = ["zookeeper.service"]; - unitConfig.StateDirectory = lib.mkDefault "apache-kafka"; - }; - - services.zookeeper.enable = lib.mkDefault true; - }; -}