netdata: Fixed the recipe.

The netdata website was not accessable due to some (changed) permissions.
The systemd service file will start netdata deamon with the netdata user.
The netdata group as existing, but the netdata user was missing.

I moved some directory creations from systemd to the bitbake recipe.

The project website address changed too.

Removed the creation of the pid file in the service of systemd.
Netdata itself has an option to create the pid file.  Because it's an
options, it's probably also not needed in systemd.

Tested with meta-raspberrypi on rpi4-32.

Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
jan 2021-09-22 19:54:32 +02:00 committed by Khem Raj
parent f8fb68218b
commit 371adeaade
2 changed files with 21 additions and 10 deletions

View File

@ -1,13 +1,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later
[Unit] [Unit]
Description=Netdata, Real-time performance monitoring Description=Real time performance monitoring
RequiresMountsFor=/var RequiresMountsFor=/var
After=network.target
[Service] [Service]
User=root Type=simple
ExecStartPre=/bin/mkdir -p /var/log/netdata ExecStartPre=/bin/mkdir -p /var/log/netdata
ExecStartPre=/bin/chown -R nobody.netdata @@datadir/netdata/web ExecStartPre=/bin/chown -R netdata.netdata /var/log/netdata
ExecStartPre=/bin/chown -R nobody.netdata /var/cache/netdata ExecStart=/usr/sbin/netdata -D -u netdata
ExecStart=/usr/sbin/netdata -nd
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -1,17 +1,19 @@
HOMEPAGE = "https://github.com/firehol/netdata/" HOMEPAGE = "https://github.com/netdata/netdata/"
SUMMARY = "Real-time performance monitoring" SUMMARY = "Real-time performance monitoring"
DESCRIPTION = "Netdata is high-fidelity infrastructure monitoring and troubleshooting. \
Open-source, free, preconfigured, opinionated, and always real-time."
LICENSE = "GPLv3" LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://LICENSE;md5=fc9b848046ef54b5eaee6071947abd24" LIC_FILES_CHKSUM = "file://LICENSE;md5=fc9b848046ef54b5eaee6071947abd24"
SRC_URI = "git://github.com/firehol/netdata.git;protocol=https" SRC_URI:append = " git://github.com/firehol/netdata.git;protocol=https"
SRCREV = "1be9200ba8e11dc81a2101d85a2725137d43f766" SRCREV = "1be9200ba8e11dc81a2101d85a2725137d43f766"
PV = "1.22.1" PV = "1.22.1"
# default netdata.conf for netdata configuration # default netdata.conf for netdata configuration
SRC_URI += "file://netdata.conf" SRC_URI += " file://netdata.conf"
# file for providing systemd service support # file for providing systemd service support
SRC_URI += "file://netdata.service" SRC_URI += " file://netdata.service"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
@ -31,7 +33,7 @@ SYSTEMD_AUTO_ENABLE:${PN} = "enable"
#User specific #User specific
USERADD_PACKAGES = "${PN}" USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM:${PN} = "--system netdata" USERADD_PARAM:${PN} = "--system --no-create-home --home-dir ${localstatedir}/run/netdata --user-group netdata"
do_install:append() { do_install:append() {
#set S UID for plugins #set S UID for plugins
@ -50,6 +52,13 @@ do_install:append() {
sed -i -e 's,@@sysconfdir,${sysconfdir},g' ${D}${sysconfdir}/netdata/netdata.conf sed -i -e 's,@@sysconfdir,${sysconfdir},g' ${D}${sysconfdir}/netdata/netdata.conf
sed -i -e 's,@@libdir,${libexecdir},g' ${D}${sysconfdir}/netdata/netdata.conf sed -i -e 's,@@libdir,${libexecdir},g' ${D}${sysconfdir}/netdata/netdata.conf
sed -i -e 's,@@datadir,${datadir},g' ${D}${sysconfdir}/netdata/netdata.conf sed -i -e 's,@@datadir,${datadir},g' ${D}${sysconfdir}/netdata/netdata.conf
install --group netdata --owner netdata --directory ${D}${localstatedir}/cache/netdata
install --group netdata --owner netdata --directory ${D}${localstatedir}/lib/netdata
chown -R netdata:netdata ${D}${datadir}/netdata/web
} }
FILES_${PN} += "${localstatedir}/cache/netdata/ ${localstatedir}/lib/netdata/"
RDEPENDS:${PN} = "bash zlib" RDEPENDS:${PN} = "bash zlib"