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
netdata: facilitate building netdata with cloud support #92782
Conversation
This PR also adds a new file for the custom version of |
"--sysconfdir=/etc" | ||
]; | ||
configureFlags = [ "--localstatedir=/var" "--sysconfdir=/etc" ] | ||
++ optional withCloud "--enable-cloud"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again I will ask how does this affect closure size and if it would not make sense to enable it unconditionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closure size goes from 148743560
to 149251816
, so it's basically irrelevant.
I would be very grateful if you could tell me what the policy about adding new configuration options currently is. I generally just see the many e.g. withCups, withDBengine, withIpmi, withNetfilter, withSsl
configuration options, many of which seem even less relevant than e.g. withCloud
, and assume that adding new options is good practice. But your comments make me think that they might just be there for backwards compatibility and "no options" is preferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think there is a policy. There are few legitimate reasons for having the options overridable (when it makes the closure significantly larger, when it adds an unfree dependency to otherwise free package…) but most of the time it looks to me like a cargo-cult.
I typically ask myself: “Would someone want to disable this feature? If there were an overridable option, would someone bother overriding it? Are the benefits commensurate with the added complexity to the expression?” I would only add an option when I answered “Yes” to all three of the questions.
But in the end, the decision is up to the maintainers of each individual package, since they will bear the complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think withCloud
could be interesting to some users that would like to ensure that none of their system analytics are streamed to servers owned by the Netdata company. There seems to be a way to disable the cloud connection at runtime, but it does seem like disabling cloud support at built time is still the only option to ensure no connection is made.
Personally, I think that's useful enough to keep the withCloud
option, which, in my opinion, also does not add a lot of complexity to the derivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the cloud disabling is now fixed upstream?
Given that, I propose the package just gets built with cloud support.
cp -r "${mosquitto}/lib" externaldeps/mosquitto; | ||
cp -r "${libwebsockets_3_2}/lib" externaldeps/libwebsockets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not someone (some other distro, pull request on the repo) have a patch that would allow using shared library from the system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this is terrible practice by the upstream project, but I chose to simply adapt the build script for the initial PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least some of the developers think that accommodating Linux distributions is generally a good idea, however I am not that confident that we will see actual changes anytime soon. In any case, I have subscribed to the Issue and will of course update the PR if I notice any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to one of the developers, Netdata will soon be using a new implementation of the Agent-Cloud-Link which would only require unpatched and common dependencies (JSON-C and OpenSSL). I would be more than happy to modify this PR when this change lands, or if it could be agreed to merge this PR in its current "hackish" state, open a new PR to then fix these issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leotaku hi, you are right I am pushing for the new implementation of the link as you mentioned. Called ACLK-NG
,
It started originally as a skunkworks project, now it is starting to take shape and we plan to merge it ASAP.
While it works already it will take some time to weatherproof it and catch all possible bugs (It is a huge change and a lot of code written). This is the motive why originally it will be released as a fallback (in case ACLK-Legacy cannot be built e.g. due to missing custom mosquito lib), with the possibility to enforce its use by passing --aclk-ng
to the installer.
The main motivation to do this for me was to enable full-featured Netdata in every distribution package manager (e.g. remove the need for bundling libraries and other "hacky" things). As a side effect, it also seems to perform better (throughput doesn't drop with latency as was the case with Legacy).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing this with Netdata 1.25.0 (basically applying your changes on top of nixos-20.09
), it fails with
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: externaldeps/libwebsockets/libwebsockets.a(unix-plugins.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/nix/store/hiwz81i1g3fn3p0acjs042a4h5fri6dh-binutils-2.31.1/bin/ld: /nix/store/bdf8iipzya03h2amgfncqpclf6bmy3a1-glibc-2.32/lib/libdl.so.2: error adding symbols: DSO missing from command line
However, it works fine when building from this commit netdata/netdata@593e1b6 and not using the bundled libwebsockets
. I think we can wait for the next Netdata release to be able to use this.
Result of 1 package built:
|
''; | ||
|
||
postInstall = '' | ||
cp $out/lib/libmosquitto_static.a $out/lib/libmosquitto.a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use ln here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I am not quite sure what you mean by "use ln" here, could you maybe elaborate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they mean doing something like this:
ln -s $out/lib/libmosquitto_static.a $out/lib/libmosquitto.a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I
and l
look the same to me in my system variable-width font, so I got confused. It does not seem possible to use symbolic links here (build fails) but hard links seem to be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if hard linking is something that is commonly done in Nixpkgs and whether it has any particular advantages or disadvantages. A very naive grep-based investigation shows that copying files is done much more frequently than hardlinking, so I'd probably just keep the cp
.
$ cd nixpkgs
$ rg "cp[ ][^(-r)]" | wc -l
1451
$ rg "ln[ ][^(-s)]" | wc -l
29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp is useful when moving files from source to out but ln should be used when symlinking static libs in out or even mv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have switched the two lines to hardlinking now.
ln should be used when symlinking static libs in out or even mv
You are aware that we are not using symlinking here, right? I am now using hardlinking, which is a different concept which is why I am unsure if I should use it in derivations.
Result of 1 package failed to build:
|
This commit adds a `withCloud` option to the netdata package. When enabled it allows the netdata agent to communicate with the netdata cloud. Other than that, we unconditionally wrap the `netdata-claim.sh` script with a path to openssl and no longer remove the `sbin` output as it is required by the script.
Co-authored-by: Marc Schmitt <marc.schmitt@risson.space>
Co-authored-by: Marc Schmitt <marc.schmitt@risson.space>
de325fb
to
672612c
Compare
This is a semi-automatic executed nixpkgs-review which is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch). Result of 1 package built:
|
This is a semi-automatic executed nixpkgs-review which is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch). Result of 1 package built:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff LGTM
postInstall = '' | ||
ln $out/lib/libmosquitto_static.a $out/lib/libmosquitto.a | ||
ln $out/include/mosquitto.h $out/lib/mosquitto.h | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we want to add a meta section here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for keeping you waiting, I must have missed the notifications for your comments. Honestly, I think it should be fine not having the meta section, especially since I would like to remove this package from Nixpkgs as soon as ACLK-NG is present in the Netdata package provided by Nixpkgs. If you think a meta section is necessary, I will of course add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packages require a meta section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, this package will likely disappear in a few weeks, plus it's only used by netdata.
Hi, ACLK-NG has been merged and is present in current nightlies and will be present in the next Netdata release. Currently is a fallback for when ACLK LEgacy can't be built (e.g. missing dependency) or can be enabled by passing |
This is a semi-automatic executed nixpkgs-review with nixpkgs-review-checks extension. It is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch). Result of 1 package built:
|
The new Netdata release (1.30.0) already has ACLK-NG support. This means that this pull request is no longer relevant. |
This PR adds a
withCloud
option to the netdata package. When enabled it allows the netdata agent to communicate with the netdata cloud.Other than that, we unconditionally wrap the
netdata-claim.sh
script with a path to openssl and no longer remove thesbin
output as it is required by the script.Motivation for this change
The current netdata package does not support connecting to the netdata cloud.
There has been a packaging request for netdata with cloud support in #91549.
#92291 was merged in preparation to this PR.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)