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 service: init #20183
netdata service: init #20183
Conversation
@womfoo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @joachifm and @offlinehacker to be potential reviewers. |
}; | ||
|
||
configText = mkOption { | ||
type = types.nullOr types.str; |
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.
This could be made type = types.line;
with ""
as default. Removing nullOr
save the need for if isNull cfg.configText then "" else "
later, and types.lines
will provide better value merging in case the option is defined multiple times.
92f2254
to
5bae511
Compare
Thanks @ericsagnes! It just got back to me that netdata works with empty configs. Rebased changes with your feedback. |
5bae511
to
7ef98a8
Compare
Rebased changes to address conflict in ids.nix |
@@ -278,6 +278,7 @@ | |||
postgrey = 258; | |||
hound = 259; | |||
leaps = 260; | |||
netdata = 261; |
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 to me like the data generated by this service is highly machine specific and that ownership will be eventually consistent, given the preStart
script. Please consider dynamic uid allocation.
7ef98a8
to
4579535
Compare
@joachifm thanks for reviewing this. I've updated the commit to use dynamic uids. |
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.
LGTM, added a couple of minor points for you to consider.
wantedBy = [ "multi-user.target" ]; | ||
preStart = concatStringsSep "\n" (map (dir: '' | ||
test -d ${dir} || { | ||
echo "creating directory for netdata in ${dir}" |
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.
Alternatively, you could do mkdir -vp
which will print a message iff the directory is created.
"/var/log/netdata" | ||
"/var/lib/netdata" ]); | ||
serviceConfig = { | ||
Type = "simple"; |
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.
Type = "simple"
is the default.
in { | ||
options = { | ||
services.netdata = { | ||
enable = mkEnableOption "netdata"; |
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 believe mkEnableOption
has fallen out of favour so probably shouldn't be used for new code.
728720e
to
6ac08e5
Compare
Rebased and tested OK |
preStart = concatStringsSep "\n" (map (dir: '' | ||
test -d ${dir} || { | ||
echo "creating directory for netdata in ${dir}" | ||
mkdir -vp ${dir} |
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 believe you now should be able to remove the echo and enclosing conditional; mkdir -vp
should achieve the same effect.
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.
Rebased. Thanks!
6ac08e5
to
2fcba40
Compare
after = [ "network.target" ]; | ||
wantedBy = [ "multi-user.target" ]; | ||
preStart = concatStringsSep "\n" (map (dir: '' | ||
test -d ${dir} || mkdir -vp ${dir} |
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.
You could even remove the test
because mkdir -p
doesn't fail if the directory already exists.
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.
Done. Thanks @fpletz
2fcba40
to
2715222
Compare
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 was looking for this, thought it was merged it.
Motivation for this change
make netdata easier to enable
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)