All of lore.kernel.org
 help / color / mirror / Atom feed
* [[meta-webserver]] netdata: Fixed the recipe.
@ 2021-09-20  9:55 jan
  2021-09-20 10:38 ` [OE-core] " Peter Kjellerstedt
  0 siblings, 1 reply; 2+ messages in thread
From: jan @ 2021-09-20  9:55 UTC (permalink / raw)
  To: openembedded-core; +Cc: Jan Vermaete

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.

Tested with meta-raspberrypi on rpi4-32.

Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
---
 .../netdata/netdata/netdata.service           | 13 +++++++-----
 .../recipes-webadmin/netdata/netdata_git.bb   | 21 +++++++++++++------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service b/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service
index b244d1866..7d50a7fdd 100644
--- a/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service
+++ b/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service
@@ -1,13 +1,16 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
 [Unit]
-Description=Netdata, Real-time performance monitoring
+Description=Real time performance monitoring
 RequiresMountsFor=/var
+After=network.target
 
 [Service]
-User=root
+Type=simple
+PIDFile=/var/run/netdata/netdata.pid
 ExecStartPre=/bin/mkdir -p /var/log/netdata
-ExecStartPre=/bin/chown -R nobody.netdata @@datadir/netdata/web
-ExecStartPre=/bin/chown -R nobody.netdata /var/cache/netdata
-ExecStart=/usr/sbin/netdata -nd
+ExecStartPre=/bin/chown -R netdata.netdata /var/log/netdata
+ExecStart=/usr/sbin/netdata -D -u netdata
+
 
 [Install]
 WantedBy=multi-user.target
diff --git a/meta-webserver/recipes-webadmin/netdata/netdata_git.bb b/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
index 7c48b8a37..9a2467202 100644
--- a/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
+++ b/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
@@ -1,17 +1,19 @@
-HOMEPAGE = "https://github.com/firehol/netdata/"
+HOMEPAGE = "https://github.com/netdata/netdata/"
 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"
 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"
 PV = "1.22.1"
 
 # default netdata.conf for netdata configuration
-SRC_URI += "file://netdata.conf"
+SRC_URI:append = " file://netdata.conf"
 
 # file for providing systemd service support
-SRC_URI += "file://netdata.service"
+SRC_URI:append = " file://netdata.service"
 
 S = "${WORKDIR}/git"
 
@@ -31,7 +33,7 @@ SYSTEMD_AUTO_ENABLE:${PN} = "enable"
 
 #User specific
 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() {
     #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,@@libdir,${libexecdir},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
 }
 
-RDEPENDS:${PN} = "bash zlib"
+FILES_${PN} += "${localstatedir}/cache/netdata/ ${localstatedir}/lib/netdata/"
+
+RDEPENDS_${PN} = "bash zlib"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [[meta-webserver]] netdata: Fixed the recipe.
  2021-09-20  9:55 [[meta-webserver]] netdata: Fixed the recipe jan
@ 2021-09-20 10:38 ` Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2021-09-20 10:38 UTC (permalink / raw)
  To: jan, openembedded-core

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of jan
> Sent: den 20 september 2021 11:56
> To: openembedded-core@lists.openembedded.org
> Cc: Jan Vermaete <jan.vermaete@gmail.com>
> Subject: [OE-core] [[meta-webserver]] 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.
> 
> Tested with meta-raspberrypi on rpi4-32.
> 
> Signed-off-by: Jan Vermaete <jan.vermaete@gmail.com>
> ---
>  .../netdata/netdata/netdata.service           | 13 +++++++-----
>  .../recipes-webadmin/netdata/netdata_git.bb   | 21 +++++++++++++------
>  2 files changed, 23 insertions(+), 11 deletions(-)
> 
> diff --git a/meta-webserver/recipes-
> webadmin/netdata/netdata/netdata.service b/meta-webserver/recipes-
> webadmin/netdata/netdata/netdata.service
> index b244d1866..7d50a7fdd 100644
> --- a/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service
> +++ b/meta-webserver/recipes-webadmin/netdata/netdata/netdata.service
> @@ -1,13 +1,16 @@
> +# SPDX-License-Identifier: GPL-3.0-or-later
>  [Unit]
> -Description=Netdata, Real-time performance monitoring
> +Description=Real time performance monitoring
>  RequiresMountsFor=/var
> +After=network.target
> 
>  [Service]
> -User=root
> +Type=simple
> +PIDFile=/var/run/netdata/netdata.pid

Doesn't systemd prefer the pid files in /run rather than /var/run nowadays?

>  ExecStartPre=/bin/mkdir -p /var/log/netdata
> -ExecStartPre=/bin/chown -R nobody.netdata @@datadir/netdata/web
> -ExecStartPre=/bin/chown -R nobody.netdata /var/cache/netdata
> -ExecStart=/usr/sbin/netdata -nd
> +ExecStartPre=/bin/chown -R netdata.netdata /var/log/netdata
> +ExecStart=/usr/sbin/netdata -D -u netdata
> +
> 
>  [Install]
>  WantedBy=multi-user.target
> diff --git a/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
> b/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
> index 7c48b8a37..9a2467202 100644
> --- a/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
> +++ b/meta-webserver/recipes-webadmin/netdata/netdata_git.bb
> @@ -1,17 +1,19 @@
> -HOMEPAGE = "https://github.com/firehol/netdata/"
> +HOMEPAGE = "https://github.com/netdata/netdata/"
>  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"
>  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"
>  PV = "1.22.1"
> 
>  # default netdata.conf for netdata configuration
> -SRC_URI += "file://netdata.conf"
> +SRC_URI:append = " file://netdata.conf"
> 
>  # file for providing systemd service support
> -SRC_URI += "file://netdata.service"
> +SRC_URI:append = " file://netdata.service"

There is no need to use SRC_URI:append for any of the files above. 
The original version of the recipe used the preferred format.

>  S = "${WORKDIR}/git"
> 
> @@ -31,7 +33,7 @@ SYSTEMD_AUTO_ENABLE:${PN} = "enable"
> 
>  #User specific
>  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() {
>      #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,@@libdir,${libexecdir},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
>  }
> 
> -RDEPENDS:${PN} = "bash zlib"
> +FILES_${PN} += "${localstatedir}/cache/netdata/ ${localstatedir}/lib/netdata/"
> +
> +RDEPENDS_${PN} = "bash zlib"

That should remain as RDEPENDS:${PN}.

//Peter

> --
> 2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-20 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20  9:55 [[meta-webserver]] netdata: Fixed the recipe jan
2021-09-20 10:38 ` [OE-core] " Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.