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

nixos/prometheus: remove services.prometheus.environmentFile #144984

Merged

Conversation

basvandijk
Copy link
Member

@basvandijk basvandijk commented Nov 7, 2021

Motivation for this change

The option services.prometheus.environmentFile has been removed since it was causing issues and Prometheus now has native support for secret files.

This fixes #126083 and replaces #128731.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

The option `services.prometheus.environmentFile` has been removed since it was causing [issues](NixOS#126083) and Prometheus now has native support for secret files.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 7, 2021
@basvandijk
Copy link
Member Author

@GrahamcOfBorg test prometheus

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Nov 7, 2021
serviceConfig = {
ExecStart = "${cfg.package}/bin/prometheus" +
optionalString (length cmdlineArgs != 0) (" \\\n " +
concatStringsSep " \\\n " cmdlineArgs);
ExecReload = mkIf cfg.enableReload "+${reload}/bin/reload-prometheus";
User = "prometheus";
Restart = "always";
EnvironmentFile = mkIf (cfg.environmentFile != null && !cfg.enableReload) [ cfg.environmentFile ];
Copy link
Member

@Mic92 Mic92 Nov 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there maybe a deprecation phase with a warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is causing issues (#126083, #127889 (comment)) and since there's now an alternative I think it's better to go without a deprecation cycle. I did now add a mkRemovedOptionModule so that users get a helpful error message when they define services.prometheus.environmentFile.

@@ -76,8 +69,8 @@ let
"--storage.tsdb.path=${workingDir}/data/"
"--config.file=${
if cfg.enableReload
then prometheusYmlOut
else "/run/prometheus/prometheus-substituted.yaml"
then "/etc/prometheus/prometheus.yaml"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also how does the new secrets work? Can we add documentation for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the alternatives to the release notes and to the mkRemovedOptionModule error message.

@basvandijk
Copy link
Member Author

@GrahamcOfBorg test prometheus

@basvandijk basvandijk requested review from srhb and Mic92 November 7, 2021 19:15
Copy link
Contributor

@srhb srhb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy with this. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prometheus regex substitutions have to be escaped
3 participants