Skip to content

Commit

Permalink
Merge pull request #135 from minijackson/no-auto-elasticsearch
Browse files Browse the repository at this point in the history
Don't automatically enable elasticsearch
  • Loading branch information
minijackson authored Aug 2, 2024
2 parents af4ae3e + 366ba04 commit eb65a10
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 23 deletions.
7 changes: 6 additions & 1 deletion docs/nixos-services/user-guides/phoebus-alarm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ and Kafka’s ``clusterId``:
services.phoebus-alarm-logger.settings."bootstrap.servers" = kafkaListenSockAddr;
# Single-server Kafka setup
# Phoebus alarm needs Kafka.
# If not already enabled elsewhere in your configuration,
# the code below shows a single-server Kafka setup:
services.apache-kafka = {
enable = true;
# Replace with a randomly generated uuid. You can get one by running:
Expand Down Expand Up @@ -89,6 +91,9 @@ and Kafka’s ``clusterId``:
# Open kafka to the outside world
networking.firewall.allowedTCPPorts = [9092];
# Phoebus alarm needs ElasticSearch.
# If not already enabled elsewhere in your configuration,
# Enable it with the code below:
services.elasticsearch = {
enable = true;
package = pkgs.elasticsearch7;
Expand Down
8 changes: 8 additions & 0 deletions docs/nixos-services/user-guides/phoebus-save-and-restore.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ add this to your configuration:
openFirewall = true;
};
# Phoebus save-and-restore needs ElasticSearch.
# If not already enabled elsewhere in your configuration,
# Enable it with the code below:
services.elasticsearch = {
enable = true;
package = pkgs.elasticsearch7;
};
# Elasticsearch, needed by Phoebus Save-and-restore, is not free software (SSPL | Elastic License).
# To accept the license, add the code below:
nixpkgs.config.allowUnfreePredicate = pkg:
Expand Down
8 changes: 8 additions & 0 deletions docs/release-notes/2405.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Breaking changes

- The :nix:`config.epnix.outputs.mdbook` and :nix:`config.epnix.outputs.manpages` options
from the IOC module options, previously deprecated, are now removed.

- The :ref:`opt-services.phoebus-alarm-server.enable`,
:ref:`opt-services.phoebus-olog.enable`,
and :ref:`opt-services.phoebus-save-and-restore.enable` options
don't enable ElasticSearch automatically anymore.
See :doc:`../nixos-services/user-guides/phoebus-alarm`
and :doc:`../nixos-services/user-guides/phoebus-save-and-restore`
for how to enable it yourself on the same server.
12 changes: 1 addition & 11 deletions nixos/modules/phoebus/olog.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,8 @@ in {
# TODO: systemd hardening. Currently level 8.2 EXPOSED
};
};

services.elasticsearch = {
enable = true;
# Should be kept in sync with the phoebus-alarm-logger and phoebus-save-and-restore services
package = pkgs.elasticsearch7;
};
services.mongodb.enable = true;
};

meta = {
maintainers = with epnixLib.maintainers; [minijackson];
# TODO:
# doc = ./olog.md;
};
meta.maintainers = with epnixLib.maintainers; [minijackson];
}
10 changes: 1 addition & 9 deletions nixos/modules/phoebus/save-and-restore.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
cfg = config.services.phoebus-save-and-restore;
settingsFormat = pkgs.formats.javaProperties {};
configFile = settingsFormat.generate "phoebus-save-and-restore.properties" cfg.settings;

localElasticsearch = cfg.settings."elasticsearch.network.host" == "localhost";
in {
options.services.phoebus-save-and-restore = {
enable = lib.mkEnableOption ''
Expand Down Expand Up @@ -81,7 +79,7 @@ in {
description = "Phoebus Save-and-restore";

wantedBy = ["multi-user.target"];
after = lib.mkIf localElasticsearch ["elasticsearch.service"];
after = ["elasticsearch.service"];

serviceConfig = {
ExecStart = "${lib.getExe pkgs.epnix.phoebus-save-and-restore} --spring.config.location=file://${configFile}";
Expand Down Expand Up @@ -140,12 +138,6 @@ in {
};
};

services.elasticsearch = lib.mkIf localElasticsearch {
enable = true;
# Should be kept in sync with the phoebus-alarm-logger and phoebus-olog services
package = pkgs.elasticsearch7;
};

networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
(lib.toInt cfg.settings."server.port")
];
Expand Down
7 changes: 6 additions & 1 deletion nixos/tests/phoebus/olog.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
meta.maintainers = with epnixLib.maintainers; [minijackson];

nodes = {
server = {
server = {pkgs, ...}: {
services.phoebus-olog = {
enable = true;
settings."demo_auth.enabled" = true;
};

services.elasticsearch = {
enable = true;
package = pkgs.elasticsearch7;
};

nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Elasticsearch can be used as an SSPL-licensed software, which is
Expand Down
7 changes: 6 additions & 1 deletion nixos/tests/phoebus/save-and-restore.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
meta.maintainers = with epnixLib.maintainers; [minijackson];

nodes = {
server = {
server = {pkgs, ...}: {
services.phoebus-save-and-restore = {
enable = true;
openFirewall = true;
};

services.elasticsearch = {
enable = true;
package = pkgs.elasticsearch7;
};

nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Elasticsearch can be used as an SSPL-licensed software, which is
Expand Down

0 comments on commit eb65a10

Please sign in to comment.