summaryrefslogtreecommitdiffstats
path: root/meta-oe/dynamic-layers/meta-python
diff options
context:
space:
mode:
authorMartin Schwan <m.schwan@phytec.de>2025-10-23 11:46:36 +0200
committerKhem Raj <raj.khem@gmail.com>2025-10-24 09:06:24 -0700
commitdf95f956b6195fe4b5d1a21a59c764ccd64aa05a (patch)
tree583b059656f9c48f9e8303709bb70227d0404be8 /meta-oe/dynamic-layers/meta-python
parent5005e061ce29ad44c50a6553e5694a056345eb6f (diff)
downloadmeta-openembedded-df95f956b6195fe4b5d1a21a59c764ccd64aa05a.tar.gz
thingsboard-gateway: Update systemd service
Update the systemd service file to reflect the changes of the source repository. Add a user and group "thingsboard_gateway" which the service runs under, instead of root. Store temporary files, like logs, in /var and make use of the newly created user and group. Additionally, the service should start after and wants a network connection to be online, not just be activated. Signed-off-by: Martin Schwan <m.schwan@phytec.de> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/dynamic-layers/meta-python')
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service18
-rw-r--r--meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb24
2 files changed, 32 insertions, 10 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service
index 5dd352a553..0b7601d494 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service
+++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway/thingsboard-gateway.service
@@ -1,13 +1,17 @@
1[Unit] 1[Unit]
2Description = Systemd service for Thingsboard Gateway 2Description=ThingsBoard Gateway
3After = network.target 3After=network-online.target
4Wants=network-online.target
5ConditionPathExists=/etc/thingsboard-gateway/config/tb_gateway.json
4 6
5[Service] 7[Service]
6ExecStart = /usr/bin/python3 /usr/bin/thingsboard-gateway 8Type=simple
7ExecStop = /bin/kill -INT $MAINPID 9User=thingsboard_gateway
8ExecReload = /bin/kill -TERM $MAINPID 10Group=thingsboard_gateway
9Restart = always 11ExecStart=/usr/bin/python3 /usr/bin/thingsboard-gateway
10Type = simple 12ExecStop=/bin/kill -INT $MAINPID
13ExecReload=/bin/kill -TERM $MAINPID
14Restart=on-failure
11 15
12[Install] 16[Install]
13WantedBy=multi-user.target 17WantedBy=multi-user.target
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb
index 8ff06285f9..7a82414937 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb
+++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/thingsboard-gateway/thingsboard-gateway_3.7.4.bb
@@ -43,21 +43,39 @@ RDEPENDS:${PN} += " python3-jsonpath-rw \
43 43
44SRC_URI += "file://thingsboard-gateway.service" 44SRC_URI += "file://thingsboard-gateway.service"
45 45
46 46inherit systemd useradd
47inherit systemd
48 47
49SYSTEMD_PACKAGES = "${PN}" 48SYSTEMD_PACKAGES = "${PN}"
50SYSTEMD_SERVICE:${PN} = "thingsboard-gateway.service" 49SYSTEMD_SERVICE:${PN} = "thingsboard-gateway.service"
51 50
51USERADD_PACKAGES = "${PN}"
52USERADD_PARAM:${PN} = " \
53 --system --no-create-home \
54 --comment 'ThingsBoard-Gateway Service' \
55 --home-dir ${localstatedir}/lib/${BPN} \
56 --shell ${base_sbindir}/nologin \
57 --gid thingsboard_gateway thingsboard_gateway"
58GROUPADD_PARAM:${PN} = "--system thingsboard_gateway"
59
52FILES:${PN} += "/etc \ 60FILES:${PN} += "/etc \
53 /lib \ 61 /lib \
54 /usr \ 62 /usr \
63 ${localstatedir} \
55" 64"
56 65
57do_install:append(){ 66do_install:append(){
58 install -d ${D}${sysconfdir}/${BPN}/config 67 install -d ${D}${sysconfdir}/${BPN}/config
59 install -m 0644 ${S}/thingsboard_gateway/config/*.json ${D}${sysconfdir}/${BPN}/config 68 install -m 0644 ${S}/thingsboard_gateway/config/*.json ${D}${sysconfdir}/${BPN}/config
69 chown -R thingsboard_gateway:thingsboard_gateway ${D}${sysconfdir}/${BPN}
60 70
61 install -d ${D}${systemd_unitdir}/system/ 71 install -d ${D}${systemd_system_unitdir}/
62 install -m 0644 ${UNPACKDIR}/thingsboard-gateway.service ${D}${systemd_system_unitdir}/thingsboard-gateway.service 72 install -m 0644 ${UNPACKDIR}/thingsboard-gateway.service ${D}${systemd_system_unitdir}/thingsboard-gateway.service
73
74 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
75 install -d ${D}${sysconfdir}/tmpfiles.d
76 echo "d ${localstatedir}/log/${BPN} 0755 thingsboard_gateway thingsboard_gateway -" \
77 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
78 echo "d ${localstatedir}/lib/${BPN} 0755 thingsboard_gateway thingsboard_gateway -" \
79 >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
80 fi
63} 81}