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/elastic-apm-server: init #57995

Closed
wants to merge 3 commits into from

Conversation

betaboon
Copy link
Contributor

@betaboon betaboon commented Mar 20, 2019

Motivation for this change

I wanted to use elastic-apm-server together with a language-dependant agent.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@betaboon betaboon changed the title Elastic apm server nixos/elastic-apm-server: init Mar 20, 2019
@betaboon
Copy link
Contributor Author

shas should be changed when #57992 gets merged.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Will probably review more after feedback

sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture");
};

buildInputs = [ makeWrapper ];
Copy link
Member

Choose a reason for hiding this comment

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

makeWrapper isn't used as far as I can see.

meta = {
description = "Open Source Application Performance Monitoring";
license = if enableUnfree then licenses.elastic else licenses.asl20;
platforms = platforms.unix;
Copy link
Member

Choose a reason for hiding this comment

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

homepage missing

installPhase = ''
mkdir -p $out/{bin,share}
cp apm-server $out/bin
cp -r apm-server.yml fields.yml kibana $out/share
Copy link
Member

Choose a reason for hiding this comment

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

These should be put into $out/share/apm-server instead


src = fetchurl {
url = "https://artifacts.elastic.co/downloads/apm-server/${name}-${plat}-${arch}.tar.gz";
sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture");
Copy link
Member

Choose a reason for hiding this comment

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

The error should also include the package name, something like "apm-server is not available on ${stdenv.hostPlatform.system}"

inherit (builtins) elemAt;
info = splitString "-" stdenv.hostPlatform.system;
arch = elemAt info 0;
plat = elemAt info 1;
Copy link
Member

Choose a reason for hiding this comment

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

Should be about

arch = stdenv.hostPlatform.cpu.name;
plat = stdenv.hostPlatform.kernel.name;


beatslib = import ./lib.nix { inherit lib pkgs; };

mkApmServerConfig = cfg: {
Copy link
Member

Choose a reason for hiding this comment

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

No need to define functions when you only use them for one argument, just define the result directly.

beatConfig = foldl' recursiveUpdate {} [
(mkCommonBeatConfig cfg)
(mkBeatConfig cfg)
cfg.extraConfig
Copy link
Member

Choose a reason for hiding this comment

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

Since you're already doing something like that, I really suggest you do this instead: https://github.com/Infinisil/rfcs/blob/nixos-config/rfcs/0000-nixos-config.md#detailed-design, which will have a bunch of advantages

(ping @aanderse)

Copy link
Member

Choose a reason for hiding this comment

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

Have opened an RFC since then for that: NixOS/rfcs#42


preStart = ''
mkdir -p ${beatConfig.path.data}
mkdir -p ${beatConfig.path.logs}
Copy link
Member

Choose a reason for hiding this comment

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

Use systemd.tmpfiles for this instead


{

mkCommonOptions = { name, defaults }: {
Copy link
Member

Choose a reason for hiding this comment

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

Unless I'm missing something here, you don't need to abstract this with a library file. Just write an option that you can set multiple times wherever you need it. Something like

{
  options.services.beats = mkOption {
    type = types.attrsOf (types.submodule ({ name, ... }: {
      options = {
        enable = true;
        # ...
      };
    }));
  };
}

And then set services.beats.apm-server.enable = true; and such where you need an instance. This way you also won't duplicate all these options.

@stale
Copy link

stale bot commented Jun 2, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 3, 2020
@stale
Copy link

stale bot commented Jun 6, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 6, 2021
@SuperSandro2000
Copy link
Member

Closing due to inactivity from author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants