diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass b/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass new file mode 100644 index 00000000..2fa0fa94 --- /dev/null +++ b/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass @@ -0,0 +1,14 @@ +# /******************************************************************************** +# * Copyright (c) 2022 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# +KANTO_MANIFESTS_DIR ??= "/var/containers/manifests" diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template similarity index 90% rename from meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service rename to meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template index 9e3cedd4..64a6e272 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service +++ b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template @@ -21,4 +21,6 @@ Requires=container-management.service WantedBy=multi-user.target [Service] -ExecStart=/usr/bin/kanto-auto-deployer /var/containers/manifests +Restart=on-failure +RestartSec=5s +ExecStart=@KD_BIN_DD@/kanto-auto-deployer @KD_CFG_DD@ diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc index dbed1d37..36730d6f 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc @@ -16,12 +16,9 @@ PACKAGES = "${PN}" FILES:${PN} += "${bindir}/kanto-auto-deployer" FILES:${PN} += "${systemd_unitdir}/system/kanto-auto-deployer.service" -#containers -FILES:${PN} += "/var/containers/manifests/databroker.json" - do_install:append() { cargo_do_install - install_containers + install_service } cargo_do_install () { @@ -59,13 +56,18 @@ cargo_do_install () { } -install_containers() { - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service ${D}${systemd_unitdir}/system - install -d ${D}/var/containers/manifests - - #containers - install ${THISDIR}/kanto-containers/databroker.json ${D}/var/containers/manifests +KANTO_SERVICE_DIR = "${systemd_unitdir}/system" + +install_service() { + install -d ${D}${KANTO_SERVICE_DIR} + install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service.template ${D}${KANTO_SERVICE_DIR}/kanto-auto-deployer.service + + # fill in the kanto auto deployer service template with the result configurations + sed -e 's,@KD_BIN_DD@,${bindir},g' \ + -e 's,@KD_CFG_DD@,${KANTO_MANIFESTS_DIR},g' \ + -i ${D}${KANTO_SERVICE_DIR}/kanto-auto-deployer.service + + install -d ${D}${KANTO_MANIFESTS_DIR} } diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb index 114d1703..905c21f6 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb @@ -21,10 +21,10 @@ SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','kanto PROVIDES:${PN} += "kanto-auto-deployer" RPROVIDES:${PN} += "kanto-auto-deployer" -inherit cargo +inherit cargo kanto-auto-deployer RDEPENDS_${PN} += " grpc protobuf nativesdk-protobuf" -DEPENDS += " protobuf protobuf-native grpc" +DEPENDS += " protobuf protobuf-native grpc git-native" SRCREV = "1a7ccb4d37c6ca6bbfce2d915c31aa4478623791" PV:append = ".AUTOINC+1a7ccb4d37" diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb b/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb new file mode 100644 index 00000000..0ee4ce1c --- /dev/null +++ b/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb @@ -0,0 +1,28 @@ +# /******************************************************************************** +# * Copyright (c) 2022 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# +inherit kanto-auto-deployer + +DESCRIPTION = "Kanto Default Containers" +SRC_URI += "file://LICENSE" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +do_install:append() { + install -d ${D}${KANTO_MANIFESTS_DIR} + install ${THISDIR}/kanto-containers/databroker.json ${D}${KANTO_MANIFESTS_DIR} +} + +PACKAGES = "${PN}" +FILES:${PN} += "${KANTO_MANIFESTS_DIR}/databroker.json" + diff --git a/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb b/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb index cbb62562..ad4e5d13 100644 --- a/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb +++ b/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb @@ -25,4 +25,5 @@ RDEPENDS:${PN} = "\ system-metrics \ rauc-hawkbit-updater \ kanto-auto-deployer \ - " \ No newline at end of file + sdv-default-containers \ +" \ No newline at end of file