From 1e77fd518ed4ba41603bccd79af0a02622487867 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 10:53:51 +0000 Subject: [PATCH 01/11] Initial setup for Leda on Apertis via Qemu/Docker Signed-off-by: GitHub --- resources/apertis/Dockerfile.apertis | 83 +++++++ resources/apertis/README.md | 223 ++++++++++++++++++ resources/apertis/build-docker.sh | 27 +++ .../dockerfiles/leda-apertis-bootstrapper.sh | 31 +++ .../leda-apertis-docker-entrypoint-x86.sh | 150 ++++++++++++ .../dockerfiles/leda-apertis-install-sdv.sh | 115 +++++++++ resources/apertis/run-docker.sh | 28 +++ 7 files changed, 657 insertions(+) create mode 100644 resources/apertis/Dockerfile.apertis create mode 100644 resources/apertis/README.md create mode 100755 resources/apertis/build-docker.sh create mode 100644 resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh create mode 100755 resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh create mode 100644 resources/apertis/dockerfiles/leda-apertis-install-sdv.sh create mode 100755 resources/apertis/run-docker.sh diff --git a/resources/apertis/Dockerfile.apertis b/resources/apertis/Dockerfile.apertis new file mode 100644 index 0000000..e0b2160 --- /dev/null +++ b/resources/apertis/Dockerfile.apertis @@ -0,0 +1,83 @@ +# syntax=docker/dockerfile:1 +# +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# + +FROM debian:bullseye AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=Etc/UTC + +LABEL name="leda-apertis-x86" + +RUN echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/debian-bullseye-backports.list +RUN apt-get update +RUN apt-get install -y --no-install-recommends ca-certificates curl +RUN apt-get install -y -t bullseye-backports qemu-system-x86 + +RUN curl -o apertis.img.gz https://images.apertis.org/release/v2023/v2023.0/amd64/iot/apertis_v2023-iot-amd64-uefi_v2023.0.img.gz +RUN gunzip apertis.img.gz +RUN ls -al +RUN qemu-img convert -f raw -O qcow2 apertis.img apertis.qcow2 + +FROM debian:bullseye AS runtime + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + bind9-utils \ + ca-certificates \ + curl \ + dnsmasq \ + dnsutils \ + iproute2 \ + iptables \ + iputils-ping \ + isc-dhcp-server \ + net-tools \ + ssh \ + sudo \ + uml-utilities \ + xz-utils \ + sshpass + +# Debian Bullseye contains QEMU 5.2 +# RUN apt-get install -y --no-install-recommends qemu-system-x86 + +# Debian Bullseye-Backports contains QEMU 7.2 +RUN echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/debian-bullseye-backports.list +RUN apt-get update +RUN apt-get install -y -t bullseye-backports qemu-system-x86 + +WORKDIR /root + +COPY --from=build apertis.qcow2 /root/apertis.qcow2 +COPY build/tmp/deploy/images/qemux86-64/ovmf.qcow2 /root/ovmf.qcow2 + +# Original runner and a temporary modified one ("...-x86.sh") +RUN mkdir -p /docker +COPY resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh /docker/ +COPY resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh /docker/ +COPY resources/apertis/dockerfiles/leda-apertis-install-sdv.sh /docker/ +RUN chmod a+x /docker/leda-apertis-docker-entrypoint-x86.sh +RUN chmod a+x /docker/leda-apertis-install-sdv.sh +ENTRYPOINT [ "/docker/leda-apertis-docker-entrypoint-x86.sh" ] + +# Expose SSH access +EXPOSE 2222 + +# Expose MQTT broker: Eclipse Mosquitto +EXPOSE 1883 + +# Expose Eclipse Kuksa Databroker +EXPOSE 30555 diff --git a/resources/apertis/README.md b/resources/apertis/README.md new file mode 100644 index 0000000..f7b4c55 --- /dev/null +++ b/resources/apertis/README.md @@ -0,0 +1,223 @@ +# Running Leda Stack on Apertis + + +## Preparation of the image + +1. Download the latest Apertis IoT image + +```shell +wget https://images.apertis.org/release/v2023/v2023.0/amd64/iot/apertis_v2023-iot-amd64-uefi_v2023.0.img.gz +``` + +2. Run the image, e.g. in QEMU: + +```shell +qemu-system-x86_64 \ + -net nic,model=virtio \ + -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::1880-:1880,hostfwd=tcp::1883-:1883,hostfwd=tcp::8888-:8888,hostfwd=tcp::30555-:30555 \ + -object rng-random,filename=/dev/urandom,id=rng0 \ + -device virtio-rng-pci,rng=rng0 \ + -hda apertis_v2023-iot-amd64-uefi_v2023.0.img \ + -serial mon:stdio \ + -serial null \ + -serial mon:vc \ + -boot order=cd \ + -nographic \ + -enable-kvm \ + -object can-bus,id=canbus0 \ + -device kvaser_pci,canbus=canbus0 \ + -cpu IvyBridge \ + -drive if=pflash,format=qcow2,file=ovmf.qcow2 \ + -machine q35 \ + -smp 4 \ + -m 2G +``` + +3. Login as `user` with password `user` + +4. Install the dependencies by following the *Eclipse Kanto - [Getting Started Guide](https://websites.eclipseprojects.io/kanto/docs/getting-started/install/)* + + > Note: Some tools are not available on Apertis out of the box, hence the following steps will describe the differences to the Kanto guide. + +7. Add the `development` Apertis repository and install `containerd` Debian package: + +```shell +sudo $SHELL +echo "deb https://repositories.apertis.org/apertis/ v2023 development" >> /etc/apt/sources.list.d/apertis-development.list +apt update +apt-get install -y curl ca-certificates containerd +``` + +8. Install Kanto + +```shell +# Still in sudo shell +curl -fsSL -o kanto.deb https://github.com/eclipse-kanto/kanto/releases/download/v0.1.0-M2/kanto_0.1.0-M2_linux_x86_64.deb +apt -o Dpkg::Options::="--force-overwrite" install ./kanto.deb +``` + +9. Verify Kanto Container Management is running: + +```shell +systemctl status container-management +sudo kanto-cm list +``` + +10. Edit the network configuration file `/etc/connman/main.conf` + Add `veth` to the following line: + +```shell +echo "NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-,veth" >> /etc/connman/main.conf +systemctl restart connman +``` + +``` +# Before +# NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb- + +# After +NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-,veth +``` + +11. Configure IP Rules to allow network traffic in `/etc/iptables/rules.v4` + > Note: Add these lines before the `REJECT` statements. +``` +-A INPUT -i kanto-cm0 -j ACCEPT +-A FORWARD -i kanto-cm0 -j ACCEPT +-A FORWARD -o kanto-cm0 -j ACCEPT +``` + +12. Add the cgroup for systemd by creating a new file `/usr/lib/systemd/user/cgroup-systemd.service` + +``` +[Unit] +Description=Create cgroup mount for systemd +DefaultDependencies=no +#Before=sysinit.target +#After=local-fs.target + +[Service] +Type=oneshot +ExecStartPre=/usr/bin/mkdir /sys/fs/cgroup/systemd +ExecStart=/usr/bin/mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd + +[Install] +WantedBy=sysinit.target +``` + +13. Install the Eclipse Leda SDV core containers + +> Note: Leda is using a newer version of Kanto Container Management and kanto-auto-deployer to deploy containers using descriptor files. + This feature is not yet available on Apertis v2023, hence the containers will be created manually. + +14. Install Kuksa Databroker + +```shell +sudo kanto-cm create --name databroker \ + --ports=30555:55555/tcp \ + ghcr.io/eclipse/kuksa.val/databroker:0.3.0 + +sudo kanto-cm start --name databroker + +# Verify the container is up and running: +sudo kanto-cm list +``` + +15. Install Vehicle Update Manager from Leda Incubator + +```shell +sudo kanto-cm create --name vum \ + --e=SELF_UPDATE_TIMEOUT=30m \ + --e=SELF_UPDATE_ENABLE_REBOOT=true \ + --e=THINGS_CONN_BROKER=tcp://mosquitto:1883 \ + --e=THINGS_FEATURES=ContainerOrchestrator \ + --mp="/proc:/proc:shared" \ + --hosts="mosquitto:host_ip" \ + ghcr.io/eclipse-leda/leda-contrib-vehicle-update-manager/vehicleupdatemanager:main-1d8dca55a755c4b3c7bc06eabfa06ad49e068a48 + +sudo kanto-cm start --name vum +``` + +16. Install Self Update Agent from Leda Incubator + +```shell +sudo mkdir -p /data/selfupdates + +sudo kanto-cm create --name sua \ + --mp="/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:shared" \ + --mp="/data/selfupdates:/RaucUpdate:rprivate" \ + --mp="/etc/os-release:/etc/os-release:rprivate" \ + --ports=30052:50052/tcp \ + --hosts="mosquitto:host_ip" \ + ghcr.io/eclipse-leda/leda-contrib-self-update-agent/self-update-agent:build-66 + +sudo kanto-cm start --name sua +``` + +17. Install the Cloud Connector from Leda Incubator + +```shell +sudo mkdir -p /data/var/certificates + +# Replace with your device certificates +sudo touch /data/var/certificates/device.crt +sudo touch /data/var/certificates/device.key + +sudo kanto-cm create --name cloudconnector \ + --mp="/data/var/certificates/device.crt:/device.crt" \ + --mp="/data/var/certificates/device.key:/device.key" \ + --e=CERT_FILE=/device.crt \ + --e=KEY_FILE=/device.key \ + --e=LOCAL_ADDRESS=tcp://mosquitto:1883 \ + --e="LOG_FILE=" \ + --e=LOG_LEVEL=INFO \ + --e=CA_CERT_PATH=/app/iothub.crt \ + --e=MESSAGE_MAPPER_CONFIG=/app/message-mapper-config.json \ + --e=ALLOWED_LOCAL_TOPICS_LIST=cloudConnector/# \ + ghcr.io/eclipse-leda/leda-contrib-cloud-connector/cloudconnector:main-47c01227a620a3dbd85b66e177205c06c0f7a52e + +sudo kanto-cm start --name cloudconnector +``` + +18. Install examples: Seat Service + +```shell +sudo kanto-cm create --name seatservice \ + --e=BROKER_ADDR=databroker-host:30555 \ + --e=RUST_LOG=info \ + --e=vehicle_data_broker=info \ + --ports="30051:50051/tcp" \ + --hosts="databroker-host:host_ip" \ + ghcr.io/boschglobal/kuksa.val.services/seat_service:v0.3.0 + +sudo kanto-cm start --name seatservice +``` + +19. Install example: Kuksa DBC Feeder + +```shell +sudo kanto-cm create --name feedercan \ + --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ + --e=VDB_ADDRESS=databroker-host:30555 \ + --e=USECASE=databroker \ + --e=LOG_LEVEL=info \ + --e=databroker=info \ + --e=broker_client=info \ + --e=dbcfeeder=info \ + --hosts="databroker-host:host_ip" \ + ghcr.io/eclipse/kuksa.val.feeders/dbc2val:v0.1.1 + +sudo kanto-cm start --name feedercan +``` + +20. Install example: Kuksa HVAC Example + +```shell +sudo kanto-cm create --name hvac \ + --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ + --e=VDB_ADDRESS=databroker-host:30555 \ + --hosts="databroker-host:host_ip" \ + ghcr.io/eclipse/kuksa.val.services/hvac_service:v0.1.0 + +sudo kanto-cm start --name hvac +``` diff --git a/resources/apertis/build-docker.sh b/resources/apertis/build-docker.sh new file mode 100755 index 0000000..c40d8cf --- /dev/null +++ b/resources/apertis/build-docker.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Build and Run the Leda SDV Core components stack on Apertis IoT (QEMU X86) +# +#set -e + +if ! command -v docker &> /dev/null +then + echo "Error: Docker could not be found, please install Docker." + exit 1 +fi + +# Set the build context to "../.." to allow to access the Yocto build workspace +# for copying the ovmf.qcow2 file +docker build --tag leda-apertis-x86 --file Dockerfile.apertis ../.. diff --git a/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh b/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh new file mode 100644 index 0000000..ac958c5 --- /dev/null +++ b/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Install SDV Components on Apertis +# +#set -e + +# Wait for Apertis to boot and SSH to come up + +mkdir -p ~/.ssh/ +until ssh-keyscan -t ecdsa -p 2222 -H localhost >> ~/.ssh/known_hosts 2> /dev/null +do + echo "Bootstrapper: Apertis not up yet, trying again..." + sleep 1 +done + +ssh-keygen -t rsa -b 2048 -N '' -f /root/.ssh/id_rsa +sshpass -p user ssh-copy-id -i /root/.ssh/id_rsa.pub -o StrictHostKeyChecking=no -p 2222 user@localhost +ssh -o StrictHostKeyChecking=no -o ConnectionAttempts=30 -p 2222 user@localhost "ls -al" +ssh -o StrictHostKeyChecking=no -o ConnectionAttempts=30 -p 2222 user@localhost "sudo -n -s \$SHELL" < /docker/leda-apertis-install-sdv.sh diff --git a/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh new file mode 100755 index 0000000..ca8246a --- /dev/null +++ b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh @@ -0,0 +1,150 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Run qemu with TAP network +# +# set -x + +DISK_IMAGE_FILE="apertis.qcow2" + +echo "Entry: Setup..." + +USERID="-u $(id -u)" +GROUP="-g $(id -g)" +TUNCTL="sudo tunctl" +IFCONFIG="sudo ip" +IPTABLES="sudo iptables" +TAP= + +function setupTap() { + TAP=`$TUNCTL -b $GROUP 2>&1` + n=1 + $IFCONFIG addr add 192.168.7.$n/32 broadcast 192.168.7.255 dev $TAP + $IFCONFIG link set dev $TAP up + dest=2 + $IFCONFIG route add to 192.168.7.$dest dev $TAP + $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.1/32 + $IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.2/32 + sudo bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward" + sudo bash -c "echo 1 > /proc/sys/net/ipv4/conf/$TAP/proxy_arp" + $IPTABLES -P FORWARD ACCEPT + echo "Entry: Set up TAP network interface: $TAP" +} + +function teardownTap() { + echo "Entry: Tearing down TAP network interface: $TAP" + $TUNCTL -d $TAP + $IFCONFIG link del $TAP + $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.1/32 + $IPTABLES -D POSTROUTING -t nat -j MASQUERADE -s 192.168.7.2/32 +} + +startQemuUnprivileged() { + echo "Entry: Starting QEMU in unprivileged mode" + + qemu-system-x86_64 \ + -net nic,model=virtio \ + -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::1880-:1880,hostfwd=tcp::1883-:1883,hostfwd=tcp::8888-:8888,hostfwd=tcp::30555-:30555 \ + -object rng-random,filename=/dev/urandom,id=rng0 \ + -device virtio-rng-pci,rng=rng0 \ + -drive id=hd,file=${DISK_IMAGE_FILE},if=virtio,format=qcow2 \ + -serial mon:stdio \ + -serial null \ + -serial mon:vc \ + -serial tcp::12345,server \ + -nographic \ + -object can-bus,id=canbus0 \ + -device kvaser_pci,canbus=canbus0 \ + -drive if=pflash,format=qcow2,file=ovmf.qcow2 \ + -cpu IvyBridge \ + -machine q35 \ + -smp 4 \ + -m 2G +} + +startQemuPrivileged() { + echo "Entry: Starting QEMU in privileged mode" + + trap teardownTap EXIT + + setupTap + + # Forward network traffic for SSH to the QEMU Guest + iptables -t nat -A PREROUTING -p tcp --dport 2222 -j DNAT --to-destination 192.168.7.2:22 + + # Forward network traffic for SSH to the QEMU Guest + # eth0 -> docker-internal network (172.x.x.x) + iptables -t nat -A PREROUTING -j DNAT -i eth0 -p tcp --to-destination 192.168.7.2 + # eth1 -> leda-network (192.168.8.x) + iptables -t nat -A PREROUTING -j DNAT -i eth1 -p tcp --to-destination 192.168.7.2 + + # Masquerade the IP Address of the sender, so that the packet will go back to the gateway + iptables -t nat -A POSTROUTING -j MASQUERADE + + # Run the DHCP server + mkdir -p /var/lib/dhcp/ + touch /var/lib/dhcp/dhcpd.leases + /usr/sbin/dhcpd + sudo /usr/sbin/dnsmasq + + printf -v macaddr "52:54:%02x:%02x:%02x:%02x" $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) $(( $RANDOM & 0xff)) $(( $RANDOM & 0xff )) + + echo "Entry: Randomized MAC Address: ${macaddr}" + + sudo qemu-system-x86_64 \ + -device virtio-net-pci,netdev=net0,mac=$macaddr \ + -netdev tap,id=net0,ifname=$TAP,script=no,downscript=no \ + -object rng-random,filename=/dev/urandom,id=rng0 \ + -device virtio-rng-pci,rng=rng0 \ + -drive id=hd,file=${DISK_IMAGE_FILE},if=virtio,format=qcow2 \ + -boot order=d,strict=on,menu=on \ + -serial mon:stdio \ + -serial null \ + -serial mon:vc \ + -serial tcp::12345,server + -nographic \ + -object can-bus,id=canbus0 \ + -device kvaser_pci,canbus=canbus0 \ + -drive if=pflash,readonly=on,format=qcow2,file=ovmf.code.qcow2 \ + -drive if=pflash,format=qcow2,file=ovmf.vars.qcow2 \ + -cpu IvyBridge \ + -machine q35 \ + -smp 4 \ + -m 2G +} + +PRIVILEGED=1 + +if [ $(id -u) != 0 ]; then + echo "We're not uid 0, falling back to unprivileged mode." + PRIVILEGED=0 +fi + +if [ ! -w /proc/sys/net/ipv4/ip_forward ]; then + echo "/proc/sys/net/ipv4/ip_forward is not writable for us, falling back to unprivileged mode." + PRIVILEGED=0 +fi + +echo "Entry: Checking QEMU Version..." +qemu-system-x86_64 -version + +echo "Entry: Starting SDV Installer in background..." +/docker/leda-apertis-bootstrapper.sh & + +echo "Entry: Starting Qemu with Leda image..." +if [ "$PRIVILEGED" == 0 ]; then + startQemuUnprivileged +else + startQemuPrivileged +fi \ No newline at end of file diff --git a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh new file mode 100644 index 0000000..641c361 --- /dev/null +++ b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh @@ -0,0 +1,115 @@ +#!/bin/sh +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Install SDV Components on Apertis +# +#set -e + +# Add the `development` Apertis repository and install `containerd` Debian package +echo "deb https://repositories.apertis.org/apertis/ v2023 development" >> /etc/apt/sources.list.d/apertis-development.list +apt update +apt-get install -y curl ca-certificates containerd + +# Install Kanto +curl -fsSL -o kanto.deb https://github.com/eclipse-kanto/kanto/releases/download/v0.1.0-M2/kanto_0.1.0-M2_linux_x86_64.deb +apt -o Dpkg::Options::="--force-overwrite" install ./kanto.deb + +# Blacklist Kanto network interfaces from Connection Manager +# so that virtual ethernet interfaces are not used for default routes +echo "NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-,veth" >> /etc/connman/main.conf +systemctl restart connman + +until systemctl is-active container-management +do + echo "SDV Installer: Kanto Container Management not up yet, trying again..." + sleep 1 +done + +# Kuksa Databroker +kanto-cm create --name databroker \ + --ports=30555:55555/tcp \ + ghcr.io/eclipse/kuksa.val/databroker:0.3.0 +kanto-cm start --name databroker + +# Leda Incubator: Vehicle Update Manager +kanto-cm create --name vum \ + --e=SELF_UPDATE_TIMEOUT=30m \ + --e=SELF_UPDATE_ENABLE_REBOOT=true \ + --e=THINGS_CONN_BROKER=tcp://mosquitto:1883 \ + --e=THINGS_FEATURES=ContainerOrchestrator \ + --mp="/proc:/proc:shared" \ + --hosts="mosquitto:host_ip" \ + ghcr.io/eclipse-leda/leda-contrib-vehicle-update-manager/vehicleupdatemanager:main-1d8dca55a755c4b3c7bc06eabfa06ad49e068a48 +kanto-cm start --name vum + +# Leda Incubator: Self Update Agent +sudo mkdir -p /data/selfupdates +sudo kanto-cm create --name sua \ + --mp="/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:shared" \ + --mp="/data/selfupdates:/RaucUpdate:rprivate" \ + --mp="/etc/os-release:/etc/os-release:rprivate" \ + --ports=30052:50052/tcp \ + --hosts="mosquitto:host_ip" \ + ghcr.io/eclipse-leda/leda-contrib-self-update-agent/self-update-agent:build-66 +sudo kanto-cm start --name sua + +# Leda Incubator: Cloud Connector +mkdir -p /data/var/certificates +# Replace with your device certificates +touch /data/var/certificates/device.crt +touch /data/var/certificates/device.key +kanto-cm create --name cloudconnector \ + --mp="/data/var/certificates/device.crt:/device.crt" \ + --mp="/data/var/certificates/device.key:/device.key" \ + --e=CERT_FILE=/device.crt \ + --e=KEY_FILE=/device.key \ + --e=LOCAL_ADDRESS=tcp://mosquitto:1883 \ + --e="LOG_FILE=" \ + --e=LOG_LEVEL=INFO \ + --e=CA_CERT_PATH=/app/iothub.crt \ + --e=MESSAGE_MAPPER_CONFIG=/app/message-mapper-config.json \ + --e=ALLOWED_LOCAL_TOPICS_LIST=cloudConnector/# \ + ghcr.io/eclipse-leda/leda-contrib-cloud-connector/cloudconnector:main-47c01227a620a3dbd85b66e177205c06c0f7a52e +kanto-cm start --name cloudconnector + +# Examples: Seat Service +kanto-cm create --name seatservice \ + --e=BROKER_ADDR=databroker-host:30555 \ + --e=RUST_LOG=info \ + --e=vehicle_data_broker=info \ + --ports="30051:50051/tcp" \ + --hosts="databroker-host:host_ip" \ + ghcr.io/boschglobal/kuksa.val.services/seat_service:v0.3.0 +kanto-cm start --name seatservice + +# Example: Kuksa DBC Feeder +kanto-cm create --name feedercan \ + --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ + --e=VDB_ADDRESS=databroker-host:30555 \ + --e=USECASE=databroker \ + --e=LOG_LEVEL=info \ + --e=databroker=info \ + --e=broker_client=info \ + --e=dbcfeeder=info \ + --hosts="databroker-host:host_ip" \ + ghcr.io/eclipse/kuksa.val.feeders/dbc2val:v0.1.1 +kanto-cm start --name feedercan + +# Example: Kuksa HVAC Example +kanto-cm create --name hvac \ + --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ + --e=VDB_ADDRESS=databroker-host:30555 \ + --hosts="databroker-host:host_ip" \ + ghcr.io/eclipse/kuksa.val.services/hvac_service:v0.1.0 +kanto-cm start --name hvac diff --git a/resources/apertis/run-docker.sh b/resources/apertis/run-docker.sh new file mode 100755 index 0000000..6b445a1 --- /dev/null +++ b/resources/apertis/run-docker.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Build and Run Leda on X86 and ARM64 in Docker Containers +# +#set -e + +if ! command -v docker &> /dev/null +then + echo "Docker could not be found, please install Docker." + exit +fi + +docker run --name leda-apertis-x86 --tty --interactive leda-apertis-x86 + +# docker run --tty --interactive --entrypoint /bin/bash leda-apertis-x86 +# docker exec --tty --interactive leda-apertis-x86 /bin/bash From 77f944606213edb5d1b1943e031764870312459b Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 10:57:52 +0000 Subject: [PATCH 02/11] Bugfix: missing executable flag Signed-off-by: GitHub --- resources/apertis/Dockerfile.apertis | 1 + .../apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/apertis/Dockerfile.apertis b/resources/apertis/Dockerfile.apertis index e0b2160..d8a38d1 100644 --- a/resources/apertis/Dockerfile.apertis +++ b/resources/apertis/Dockerfile.apertis @@ -70,6 +70,7 @@ COPY resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh /docker COPY resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh /docker/ COPY resources/apertis/dockerfiles/leda-apertis-install-sdv.sh /docker/ RUN chmod a+x /docker/leda-apertis-docker-entrypoint-x86.sh +RUN chmod a+x /docker/leda-apertis-bootstrapper.sh RUN chmod a+x /docker/leda-apertis-install-sdv.sh ENTRYPOINT [ "/docker/leda-apertis-docker-entrypoint-x86.sh" ] diff --git a/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh index ca8246a..cdadb90 100755 --- a/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh +++ b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh @@ -62,7 +62,6 @@ startQemuUnprivileged() { -serial mon:stdio \ -serial null \ -serial mon:vc \ - -serial tcp::12345,server \ -nographic \ -object can-bus,id=canbus0 \ -device kvaser_pci,canbus=canbus0 \ @@ -112,7 +111,6 @@ startQemuPrivileged() { -serial mon:stdio \ -serial null \ -serial mon:vc \ - -serial tcp::12345,server -nographic \ -object can-bus,id=canbus0 \ -device kvaser_pci,canbus=canbus0 \ From 6e0d4932f580c159caedd0ffc04f9e477cd6e8f0 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 11:02:58 +0000 Subject: [PATCH 03/11] More installer output Signed-off-by: GitHub --- .../apertis/dockerfiles/leda-apertis-install-sdv.sh | 12 ++++++++++++ resources/apertis/run-docker.sh | 1 + 2 files changed, 13 insertions(+) diff --git a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh index 641c361..46e6988 100644 --- a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh +++ b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh @@ -37,12 +37,14 @@ do done # Kuksa Databroker +echo "SDV Installer: Kuksa Databroker" kanto-cm create --name databroker \ --ports=30555:55555/tcp \ ghcr.io/eclipse/kuksa.val/databroker:0.3.0 kanto-cm start --name databroker # Leda Incubator: Vehicle Update Manager +echo "SDV Installer: Vehicle Update Manager" kanto-cm create --name vum \ --e=SELF_UPDATE_TIMEOUT=30m \ --e=SELF_UPDATE_ENABLE_REBOOT=true \ @@ -54,6 +56,7 @@ kanto-cm create --name vum \ kanto-cm start --name vum # Leda Incubator: Self Update Agent +echo "SDV Installer: Self Update Agent" sudo mkdir -p /data/selfupdates sudo kanto-cm create --name sua \ --mp="/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:shared" \ @@ -65,6 +68,7 @@ sudo kanto-cm create --name sua \ sudo kanto-cm start --name sua # Leda Incubator: Cloud Connector +echo "SDV Installer: Cloud Connector (unconfigured)" mkdir -p /data/var/certificates # Replace with your device certificates touch /data/var/certificates/device.crt @@ -84,6 +88,7 @@ kanto-cm create --name cloudconnector \ kanto-cm start --name cloudconnector # Examples: Seat Service +echo "SDV Installer: Kuksa.VAL Seat Service Example" kanto-cm create --name seatservice \ --e=BROKER_ADDR=databroker-host:30555 \ --e=RUST_LOG=info \ @@ -94,6 +99,7 @@ kanto-cm create --name seatservice \ kanto-cm start --name seatservice # Example: Kuksa DBC Feeder +echo "SDV Installer: Kuksa.VAL DBC CAN Feeder Example" kanto-cm create --name feedercan \ --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ --e=VDB_ADDRESS=databroker-host:30555 \ @@ -107,9 +113,15 @@ kanto-cm create --name feedercan \ kanto-cm start --name feedercan # Example: Kuksa HVAC Example +echo "SDV Installer: Kuksa.VAL HVAC Example" kanto-cm create --name hvac \ --e=VEHICLEDATABROKER_DAPR_APP_ID=databroker \ --e=VDB_ADDRESS=databroker-host:30555 \ --hosts="databroker-host:host_ip" \ ghcr.io/eclipse/kuksa.val.services/hvac_service:v0.1.0 kanto-cm start --name hvac + +echo "SDV Installer done." +echo "" +echo "You may now login to Apertis as `user` with password `user`" +echo "" diff --git a/resources/apertis/run-docker.sh b/resources/apertis/run-docker.sh index 6b445a1..b4027e4 100755 --- a/resources/apertis/run-docker.sh +++ b/resources/apertis/run-docker.sh @@ -22,6 +22,7 @@ then exit fi +docker rm --force leda-apertis-x86 docker run --name leda-apertis-x86 --tty --interactive leda-apertis-x86 # docker run --tty --interactive --entrypoint /bin/bash leda-apertis-x86 From 66e02db3fbe336540e3119a5a5fc245968051417 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 11:14:59 +0000 Subject: [PATCH 04/11] Scripts more stable Signed-off-by: GitHub --- .../dockerfiles/leda-apertis-bootstrapper.sh | 15 +++++++++++++-- .../leda-apertis-docker-entrypoint-x86.sh | 2 +- .../dockerfiles/leda-apertis-install-sdv.sh | 8 +++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh b/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh index ac958c5..97055b9 100644 --- a/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh +++ b/resources/apertis/dockerfiles/leda-apertis-bootstrapper.sh @@ -21,11 +21,22 @@ mkdir -p ~/.ssh/ until ssh-keyscan -t ecdsa -p 2222 -H localhost >> ~/.ssh/known_hosts 2> /dev/null do - echo "Bootstrapper: Apertis not up yet, trying again..." + echo "Bootstrapper: Apertis not up yet (SSH), trying again..." sleep 1 done +echo "Bootstrapper: SSH Keyscan successfull" + +echo "Bootstrapper: Generating SSH Keys" ssh-keygen -t rsa -b 2048 -N '' -f /root/.ssh/id_rsa + +echo "Bootstrapper: Installing SSH Keys" sshpass -p user ssh-copy-id -i /root/.ssh/id_rsa.pub -o StrictHostKeyChecking=no -p 2222 user@localhost -ssh -o StrictHostKeyChecking=no -o ConnectionAttempts=30 -p 2222 user@localhost "ls -al" + +echo "Bootstrapper: Checking remote Apertis version" +ssh -o StrictHostKeyChecking=no -o ConnectionAttempts=30 -p 2222 user@localhost "cat /etc/os-release" + +echo "Bootstrapper: Executing SDV Installer script (sudo)" ssh -o StrictHostKeyChecking=no -o ConnectionAttempts=30 -p 2222 user@localhost "sudo -n -s \$SHELL" < /docker/leda-apertis-install-sdv.sh + +echo "Bootstrapper: Done, exiting." diff --git a/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh index cdadb90..ba1afc9 100755 --- a/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh +++ b/resources/apertis/dockerfiles/leda-apertis-docker-entrypoint-x86.sh @@ -140,7 +140,7 @@ qemu-system-x86_64 -version echo "Entry: Starting SDV Installer in background..." /docker/leda-apertis-bootstrapper.sh & -echo "Entry: Starting Qemu with Leda image..." +echo "Entry: Starting QEMU with Apertis image..." if [ "$PRIVILEGED" == 0 ]; then startQemuUnprivileged else diff --git a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh index 46e6988..a7d0523 100644 --- a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh +++ b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh @@ -36,6 +36,12 @@ do sleep 1 done +until [ -S /run/container-management/container-management.sock ] +do + echo "SDV Installer: Kanto Container Management not yet listening on unix domain socket, trying again..." + sleep 1 +done + # Kuksa Databroker echo "SDV Installer: Kuksa Databroker" kanto-cm create --name databroker \ @@ -123,5 +129,5 @@ kanto-cm start --name hvac echo "SDV Installer done." echo "" -echo "You may now login to Apertis as `user` with password `user`" +echo "You may now login to Apertis as 'user' with password 'user'" echo "" From b39d614000b4c0d40b6237f1dd226c0c0929e290 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 13:41:14 +0000 Subject: [PATCH 05/11] Skip SDV if already installed Signed-off-by: GitHub --- resources/apertis/build-docker.sh | 2 +- .../dockerfiles/leda-apertis-install-sdv.sh | 5 ++++ resources/apertis/publish-docker.sh | 25 +++++++++++++++++++ resources/apertis/run-docker.sh | 3 ++- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 resources/apertis/publish-docker.sh diff --git a/resources/apertis/build-docker.sh b/resources/apertis/build-docker.sh index c40d8cf..cbcb81a 100755 --- a/resources/apertis/build-docker.sh +++ b/resources/apertis/build-docker.sh @@ -24,4 +24,4 @@ fi # Set the build context to "../.." to allow to access the Yocto build workspace # for copying the ovmf.qcow2 file -docker build --tag leda-apertis-x86 --file Dockerfile.apertis ../.. +docker build --tag ghcr.io/eclipse-leda/leda-distro/leda-apertis-x86 --file Dockerfile.apertis ../.. diff --git a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh index a7d0523..677aa78 100644 --- a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh +++ b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh @@ -16,6 +16,11 @@ # #set -e +if dpkg -l kanto; then + echo "SDV Installer: Kanto already installed, assuming SDV core components have been installed as well. Exiting." + exit 0 +fi + # Add the `development` Apertis repository and install `containerd` Debian package echo "deb https://repositories.apertis.org/apertis/ v2023 development" >> /etc/apt/sources.list.d/apertis-development.list apt update diff --git a/resources/apertis/publish-docker.sh b/resources/apertis/publish-docker.sh new file mode 100755 index 0000000..caf4e50 --- /dev/null +++ b/resources/apertis/publish-docker.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# +# Publish Leda on Apertis on QEMU on Docker container image to container registry on ghcr.io +# +#set -e + +if ! command -v docker &> /dev/null +then + echo "Docker could not be found, please install Docker." + exit +fi + +docker push ghcr.io/eclipse-leda/leda-distro/leda-apertis-x86 diff --git a/resources/apertis/run-docker.sh b/resources/apertis/run-docker.sh index b4027e4..9dec945 100755 --- a/resources/apertis/run-docker.sh +++ b/resources/apertis/run-docker.sh @@ -23,7 +23,8 @@ then fi docker rm --force leda-apertis-x86 -docker run --name leda-apertis-x86 --tty --interactive leda-apertis-x86 +docker run --name leda-apertis-x86 --tty --interactive ghcr.io/eclipse-leda/leda-distro/leda-apertis-x86 # docker run --tty --interactive --entrypoint /bin/bash leda-apertis-x86 # docker exec --tty --interactive leda-apertis-x86 /bin/bash +# docker push ghcr.io/eclipse-leda/leda-distro/leda-apertis-x86 \ No newline at end of file From 0e9b691dd34a0245bcd3967b3562c211aebd3c29 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 13 Mar 2023 15:34:59 +0000 Subject: [PATCH 06/11] SDV Installer for kantui Signed-off-by: GitHub --- .../dockerfiles/leda-apertis-install-sdv.sh | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh index 677aa78..4021200 100644 --- a/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh +++ b/resources/apertis/dockerfiles/leda-apertis-install-sdv.sh @@ -24,7 +24,7 @@ fi # Add the `development` Apertis repository and install `containerd` Debian package echo "deb https://repositories.apertis.org/apertis/ v2023 development" >> /etc/apt/sources.list.d/apertis-development.list apt update -apt-get install -y curl ca-certificates containerd +apt-get install -y curl ca-certificates git mosquitto-clients jq containerd protobuf-compiler # Install Kanto curl -fsSL -o kanto.deb https://github.com/eclipse-kanto/kanto/releases/download/v0.1.0-M2/kanto_0.1.0-M2_linux_x86_64.deb @@ -35,6 +35,24 @@ apt -o Dpkg::Options::="--force-overwrite" install ./kanto.deb echo "NetworkInterfaceBlacklist = vmnet,vboxnet,virbr,ifb,ve-,vb-,veth" >> /etc/connman/main.conf systemctl restart connman +# For building kantui and kanto-auto-deployer, we need Rust +echo "Installing Rust" +curl https://sh.rustup.rs -sSf | sh +source "$HOME/.cargo/env" + +echo "Building kantui" +git clone https://github.com/eclipse-leda/leda-utils.git +pushd leda-utils/src/rust/kanto-tui +sudo apt-get install -y gcc +git submodule update +cargo build --release +strip ./target/release/kantui +mkdir -p /etc/kantui/ +cp ./kantui_conf.toml /etc/kantui/kantui_conf.toml +cp ./target/release/kantui /usr/bin + +popd + until systemctl is-active container-management do echo "SDV Installer: Kanto Container Management not up yet, trying again..." From 2f0558bfe3dfbfaf3e31c38f2fc2f36b518c18a4 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Wed, 22 Mar 2023 17:00:53 +0000 Subject: [PATCH 07/11] WIP: Debian repo generation Signed-off-by: GitHub --- .devcontainer/post-attach.sh | 1 + .gitignore | 3 + resources/debian/Dockerfile | 31 +++++ resources/debian/fix-version.sh | 13 +++ resources/debian/generate-gpg-key.sh | 27 +++++ resources/debian/gpg-unattended.conf | 14 +++ resources/debian/install-local-repo.sh | 10 ++ resources/debian/install-remote-repo.sh | 8 ++ resources/debian/public.key.gpg | Bin 0 -> 6916 bytes resources/debian/public.pgp | 149 ++++++++++++++++++++++++ resources/debian/repo-create.sh | 45 +++++++ 11 files changed, 301 insertions(+) create mode 100644 resources/debian/Dockerfile create mode 100755 resources/debian/fix-version.sh create mode 100644 resources/debian/generate-gpg-key.sh create mode 100644 resources/debian/gpg-unattended.conf create mode 100755 resources/debian/install-local-repo.sh create mode 100755 resources/debian/install-remote-repo.sh create mode 100644 resources/debian/public.key.gpg create mode 100644 resources/debian/public.pgp create mode 100755 resources/debian/repo-create.sh diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh index ae63051..db66bac 100755 --- a/.devcontainer/post-attach.sh +++ b/.devcontainer/post-attach.sh @@ -48,3 +48,4 @@ function azure-mount() { # Second arg: Name of Azure container azure-mount "azure-sstate-cache" "yocto-sstate-cache" azure-mount "azure-downloads-cache" "downloads" +azure-mount "azure-debian" "debian" diff --git a/.gitignore b/.gitignore index 7327afc..3ca20d2 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ poky/ # Remote sstate-cache on Azure Storage azure-sstate-cache/ azure-downloads-cache/ +azure-*/ bitbake/ # BitBake Hash Equivalence Server database @@ -82,3 +83,5 @@ resources/docker-snapshot/dockerfiles/leda-tests/log.html resources/docker-snapshot/dockerfiles/leda-tests/output.xml resources/docker-snapshot/dockerfiles/leda-tests/report.html +resources/debian/repo-root +resources/debian/private.pgp diff --git a/resources/debian/Dockerfile b/resources/debian/Dockerfile new file mode 100644 index 0000000..b0124ed --- /dev/null +++ b/resources/debian/Dockerfile @@ -0,0 +1,31 @@ +# syntax=docker/dockerfile:1 +# +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# + +FROM debian:bullseye AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=Etc/UTC + +LABEL name="leda-debian-x86" + +COPY public.key.gpg /etc/apt/trusted.gpg.d/ + +RUN apt-get update +RUN apt-get install -y ca-certificates +RUN echo "deb https://sdvyocto.blob.core.windows.net/debian dracon main" > /etc/apt/sources.list.d/sdv.list +RUN apt-get update + +RUN apt install -y leda-utils diff --git a/resources/debian/fix-version.sh b/resources/debian/fix-version.sh new file mode 100755 index 0000000..6510cbf --- /dev/null +++ b/resources/debian/fix-version.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +TARGET="$1" + +if ! dpkg-deb --field ${TARGET} Version; then + echo "Trying to fix version number for ${TARGET}" + TMPDIR=$(mktemp --directory --tmpdir) + echo ${TMPDIR} + dpkg-deb -R ${TARGET} ${TMPDIR} + VERSION="0.0.1" + sed -i -e "s,^Version: .*,Version: $VERSION," ${TMPDIR}/DEBIAN/control + dpkg-deb -b ${TMPDIR} ${TARGET} +fi diff --git a/resources/debian/generate-gpg-key.sh b/resources/debian/generate-gpg-key.sh new file mode 100644 index 0000000..7b729ad --- /dev/null +++ b/resources/debian/generate-gpg-key.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ ! -f gpg-unattended.conf ]; then + echo "Creating GPG Key - and forcing GPG to use SHA256" + echo "digest-algo sha256" >> ~/.gnupg/gpg.conf +cat >gpg-unattended.conf < /etc/apt/sources.list.d/sdv.list" +gpg --output public.key.gpg --export leda-dev@eclipse.org +# gpg --output private.pgp --armor --export-secret-key leda-dev@eclipse.org +# gpg --output public.pgp --armor --export leda-dev@eclipse.org +sudo cp public.key.gpg /etc/apt/trusted.gpg.d/ +sudo apt update +apt search leda \ No newline at end of file diff --git a/resources/debian/install-remote-repo.sh b/resources/debian/install-remote-repo.sh new file mode 100755 index 0000000..4b816d6 --- /dev/null +++ b/resources/debian/install-remote-repo.sh @@ -0,0 +1,8 @@ +#!/bin/bash +sudo bash -c "echo \"deb file:${FULL_DIR} dracon main\" > /etc/apt/sources.list.d/sdv.list" +gpg --output public.key.gpg --export leda-dev@eclipse.org +# gpg --output private.pgp --armor --export-secret-key leda-dev@eclipse.org +# gpg --output public.pgp --armor --export leda-dev@eclipse.org +sudo cp public.key.gpg /etc/apt/trusted.gpg.d/ +sudo apt update +apt search leda \ No newline at end of file diff --git a/resources/debian/public.key.gpg b/resources/debian/public.key.gpg new file mode 100644 index 0000000000000000000000000000000000000000..5b6c3662b365e05bf948d92ae35a9c10d78bd911 GIT binary patch literal 6916 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 ${BASE_DIR}/conf/distributions < ${BASE_DIR}/conf/options < ${BASE_DIR}/sdv.list < Date: Wed, 22 Mar 2023 17:12:50 +0000 Subject: [PATCH 08/11] WIP: Whitelist packages Signed-off-by: GitHub --- resources/debian/Dockerfile | 4 ++ resources/debian/install-remote-repo.sh | 2 +- resources/debian/packagelist | 57 +++++++++++++++++++++++++ resources/debian/repo-create.sh | 6 ++- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 resources/debian/packagelist diff --git a/resources/debian/Dockerfile b/resources/debian/Dockerfile index b0124ed..70029d1 100644 --- a/resources/debian/Dockerfile +++ b/resources/debian/Dockerfile @@ -29,3 +29,7 @@ RUN echo "deb https://sdvyocto.blob.core.windows.net/debian dracon main" > /etc/ RUN apt-get update RUN apt install -y leda-utils +RUN apt install -y packagegroup-sdv-core +RUN apt install -y packagegroup-sdv-tools +RUN apt install -y packagegroup-sdv-examples +RUN apt install -y packagegroup-sdv-additions diff --git a/resources/debian/install-remote-repo.sh b/resources/debian/install-remote-repo.sh index 4b816d6..0d88454 100755 --- a/resources/debian/install-remote-repo.sh +++ b/resources/debian/install-remote-repo.sh @@ -1,5 +1,5 @@ #!/bin/bash -sudo bash -c "echo \"deb file:${FULL_DIR} dracon main\" > /etc/apt/sources.list.d/sdv.list" +sudo bash -c "echo \"deb https://sdvyocto.blob.core.windows.net/debian dracon main\" > /etc/apt/sources.list.d/sdv.list" gpg --output public.key.gpg --export leda-dev@eclipse.org # gpg --output private.pgp --armor --export-secret-key leda-dev@eclipse.org # gpg --output public.pgp --armor --export leda-dev@eclipse.org diff --git a/resources/debian/packagelist b/resources/debian/packagelist new file mode 100644 index 0000000..e9b26d6 --- /dev/null +++ b/resources/debian/packagelist @@ -0,0 +1,57 @@ +../../build/tmp/deploy/deb/all/packagegroup-sdv-additions_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-dbg_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-dev_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-lic_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-dbg_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-dev_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-lic_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-core_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-core-dbg_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-core-dev_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-core-lic_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-examples_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-dbg_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-dev_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-lic_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-tools_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-dbg_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-dev_1.0-r0_all.deb +../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-lic_1.0-r0_all.deb +../../build/tmp/deploy/deb/core2-64/container-management_0.1.0-git0+65e00358fa-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/container-management-dbg_0.1.0-git0+65e00358fa-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/container-management-dev_0.1.0-git0+65e00358fa-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/container-management-lic_0.1.0-git0+65e00358fa-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/databroker-cli_0.17.0.0+861b2ec674-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/databroker-cli-dbg_0.17.0.0+861b2ec674-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/databroker-cli-dev_0.17.0.0+861b2ec674-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/databroker-cli-lic_0.17.0.0+861b2ec674-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer-dbg_git.0+15ff12d9a7-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer_git.0+15ff12d9a7-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer-lic_git.0+15ff12d9a7-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kantui-dbg_git.0+5bcbef1054-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kantui_git.0+5bcbef1054-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kantui-lic_git.0+5bcbef1054-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kibi_0.2.2.0+2cc6bead72-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kibi-dbg_0.2.2.0+2cc6bead72-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/kibi-lic_0.2.2.0+2cc6bead72-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-ota-client-dbg_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-ota-client-dev_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-ota-client_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-ota-client-lic_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-utils_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/leda-utils-lic_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-cloudconnector_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-cloudconnector-lic_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-feedercan_0.1-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-feedercan-lic_0.1-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-hvacservice_0.1-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-hvacservice-lic_0.1-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-seatservice_0.3-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-seatservice-lic_0.3-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-selfupdateagent_0.66-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-selfupdateagent-lic_0.66-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-vehicleupdatemanager_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-container-vehicleupdatemanager-lic_git-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-kuksa-val-databroker_0.3-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-kuksa-val-databroker-lic_0.3-r0_amd64.deb diff --git a/resources/debian/repo-create.sh b/resources/debian/repo-create.sh index ab3ac77..4f744e3 100755 --- a/resources/debian/repo-create.sh +++ b/resources/debian/repo-create.sh @@ -38,8 +38,10 @@ deb https://sdvyocto.blob.core.windows.net/debian/ ${OS_RELEASE} main EOF # Now add the packages -find ../../build/tmp/deploy/deb/ -name "*.deb" -type f -print0 | while IFS= read -r -d $'\0' debFile; do +# find ../../build/tmp/deploy/deb/ -name "*.deb" -type f -print0 | while IFS= read -r -d $'\0' debFile; do +while read debFile; do echo "Processing ${debFile}" ./fix-version.sh ${debFile} reprepro --section misc --component main --priority optional -b ${BASE_DIR} includedeb ${OS_RELEASE} ${debFile} -done +done < packagelist + From 542b9165428333cabaca12fddd97c8b293fe45d3 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Fri, 24 Mar 2023 11:56:12 +0000 Subject: [PATCH 09/11] Building and testing Debian packaging Signed-off-by: GitHub --- desiredstate.json | 121 ++++++++++++++++++ kas/common-kirkstone.yaml | 1 + resources/debian/Dockerfile.debian | 65 ++++++++++ resources/debian/README.txt | 31 +++++ .../debian/{Dockerfile => build-docker.sh} | 24 +--- .../debian/dockerfiles/leda-debian-test.sh | 32 +++++ resources/debian/fix-version.sh | 12 ++ resources/debian/generate-gpg-key.sh | 0 resources/debian/install-local-repo.sh | 13 ++ resources/debian/install-remote-repo.sh | 13 ++ resources/debian/packagelist | 40 +----- resources/debian/repo-create.sh | 15 ++- resources/debian/run-docker.sh | 15 +++ resources/debian/test-docker.sh | 45 +++++++ resources/debian/upload-repo.sh | 15 +++ 15 files changed, 380 insertions(+), 62 deletions(-) create mode 100644 desiredstate.json create mode 100644 resources/debian/Dockerfile.debian create mode 100644 resources/debian/README.txt rename resources/debian/{Dockerfile => build-docker.sh} (50%) mode change 100644 => 100755 create mode 100755 resources/debian/dockerfiles/leda-debian-test.sh mode change 100644 => 100755 resources/debian/generate-gpg-key.sh create mode 100755 resources/debian/run-docker.sh create mode 100755 resources/debian/test-docker.sh create mode 100644 resources/debian/upload-repo.sh diff --git a/desiredstate.json b/desiredstate.json new file mode 100644 index 0000000..13ebe3a --- /dev/null +++ b/desiredstate.json @@ -0,0 +1,121 @@ +{ + "name": "mike_test3", + "specification": { + "baselines": [], + "domains": [ + { + "id": "containers", + "components": [ + { + "id": "wiper-app", + "version": "edge", + "config": [ + { + "key": "image", + "value": "ghcr.io/softwaredefinedvehicle/wiperpoc/wiperpoc:latest" + }, + { + "key": "env", + "value": "SDV_MIDDLEWARE_TYPE=native" + }, + { + "key": "env", + "value": "SDV_VEHICLEDATABROKER_ADDRESS=127.0.0.1:55555" + }, + { + "key": "env", + "value": "SDV_MQTT_ADDRESS=mqtt://127.0.0.1:1883" + }, + { + "key": "env", + "value": "SDV_SEATSERVICE_ADDRESS=127.0.0.1:30051" + }, + { + "key": "network", + "value": "host" + } + ] + }, + { + "id": "ota-client", + "version": "v0.0.2", + "config": [ + { + "key": "image", + "value": "ghcr.io/softwaredefinedvehicle/sdv-ota-client/ota-client:v0.0.2" + }, + { + "key": "mount", + "value": "/etc/ota-client:/app/config" + }, + { + "key": "mount", + "value": "/data/var/certificates:/app/config/certs" + }, + { + "key": "mount", + "value": "/etc/ssl/certs:/app/config/ca-certs/" + }, + { + "key": "mount", + "value": "/tmp:/tmp" + }, + { + "key": "host", + "value": "mosquitto:host_ip" + } + ] + }, + { + "id": "vehicledatabroker", + "version": "v0.0.2", + "config": [ + { + "key": "image", + "value": "ghcr.io/boschglobal/kuksa.val/databroker:0.0.2" + }, + { + "key": "port", + "value": "55555:55555" + } + ] + }, + { + "id": "someip-feeder", + "version": "sha-3c4811b", + "config": [ + { + "key": "image", + "value": "ghcr.io/softwaredefinedvehicle/kuksa.val.feeders.fork/someip-feeder:sha-3c4811b" + }, + { + "key": "network", + "value": "host" + }, + { + "key": "env", + "value": "BROKER_ADDR=127.0.0.1:55555" + } + ] + } + ], + "config": [] + }, + { + "id": "safetyApp", + "components": [], + "config": [] + }, + { + "id": "safetyEcu", + "components": [], + "config": [] + }, + { + "id": "selfUpdate", + "components": [], + "config": [] + } + ] + } + } \ No newline at end of file diff --git a/kas/common-kirkstone.yaml b/kas/common-kirkstone.yaml index 095c01f..b6547ac 100644 --- a/kas/common-kirkstone.yaml +++ b/kas/common-kirkstone.yaml @@ -22,6 +22,7 @@ target: sdv-image-all local_conf_header: meta-leda: | INHERIT += "rm_work" + PACKAGE_CLASSES += " package_deb" INHERIT:remove = " archiver" INHERIT:remove = " cve-check" INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/resources/debian/Dockerfile.debian b/resources/debian/Dockerfile.debian new file mode 100644 index 0000000..99033fa --- /dev/null +++ b/resources/debian/Dockerfile.debian @@ -0,0 +1,65 @@ +# syntax=docker/dockerfile:1 +# +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ +# + +ARG BASE_IMAGE=debian:bullseye +FROM ${BASE_IMAGE} AS build + +ARG DEBIAN_FRONTEND=noninteractive +ARG TZ=Etc/UTC + +COPY public.key.gpg /etc/apt/trusted.gpg.d/ + +RUN apt-get update +RUN apt-get install -y wget ca-certificates openssh-server rauc mosquitto mosquitto-clients + +RUN wget https://github.com/eclipse-kanto/kanto/releases/download/v0.1.0-M2/kanto_0.1.0-M2_linux_x86_64.deb && \ + apt-get install -y ./kanto_0.1.0-M2_linux_x86_64.deb +RUN apt show kanto + +RUN wget https://github.com/eclipse-leda/leda-utils/releases/download/v0.0.1/eclipse-leda-kanto-auto-deployer_0.0.1.0.7019_amd64.deb && \ + apt-get install -y ./eclipse-leda-kanto-auto-deployer_0.0.1.0.7019_amd64.deb +RUN apt show eclipse-leda-kanto-auto-deployer + +RUN wget https://github.com/eclipse-leda/leda-utils/releases/download/v0.0.1/eclipse-leda-kantui_0.0.1.0.7019_amd64.deb && \ + apt-get install -y ./eclipse-leda-kantui_0.0.1.0.7019_amd64.deb +RUN apt show eclipse-leda-kantui + +RUN echo "deb https://sdvyocto.blob.core.windows.net/debian dracon main" > /etc/apt/sources.list.d/sdv.list +RUN apt-get update + +RUN apt-get install -y leda-utils +RUN apt-get install -y sdv-container-cloudconnector +RUN apt-get install -y sdv-container-selfupdateagent +RUN apt-get install -y sdv-container-vehicleupdatemanager +RUN apt-get install -y sdv-kuksa-val-databroker +RUN apt-get install -y sdv-core-containers +RUN apt-get install -y sdv-example-containers + +RUN dpkg -L sdv-container-cloudconnector +RUN dpkg -L sdv-core-containers + +RUN wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz +RUN mkdir -p /usr/lib/cni +RUN tar Cxzvf /usr/lib/cni cni-plugins-linux-amd64-v1.1.1.tgz + +# These fail due to libc (and more) dependency conflicts. +# RUN apt-get install -y kantui +# RUN apt-get install -y databroker-cli +# RUN apt-get install -y container-management +# RUN apt-get install -y kanto-auto-deployer + +COPY dockerfiles/leda-debian-test.sh ./ +CMD [ "./leda-debian-test.sh" ] diff --git a/resources/debian/README.txt b/resources/debian/README.txt new file mode 100644 index 0000000..4dfacbd --- /dev/null +++ b/resources/debian/README.txt @@ -0,0 +1,31 @@ +Eclipse Leda - Debian packages + +Building Debian packages using BitBake to make packages installable on vanilla Debian distros (non-Poky based). + +1. Building the packages + + Add to kas configuration: + PACKAGE_CLASSES += " package_deb" + + Run a build + kas build kas/leda-qemux86-64.yaml + +2. Test the local repository + + Run install-local-repo.sh, which will add the ./repo-root/ to the apt sources.list + Use apt search or apt install to install packages. + Note: This will install on your host! + +3. Create an Apt repository + + Setup gpg using generate-gpg-key.sh or reuse existing + Run the repo-create.sh + + Ensure ${PROJET_ROOT}/azure-debian/ is mounted, or adapt upload-repo.sh + Run the script to upload the Apt repository to a remote webserve. + +4. Test with Docker + + Run the build-docker.sh which will build container images with predefined Apt remote repository. + The build will fail if it cannot install any of the SDV Core components. + diff --git a/resources/debian/Dockerfile b/resources/debian/build-docker.sh old mode 100644 new mode 100755 similarity index 50% rename from resources/debian/Dockerfile rename to resources/debian/build-docker.sh index 70029d1..6ec57c3 --- a/resources/debian/Dockerfile +++ b/resources/debian/build-docker.sh @@ -1,5 +1,4 @@ -# syntax=docker/dockerfile:1 -# +#!/bin/bash # /******************************************************************************** # * Copyright (c) 2023 Contributors to the Eclipse Foundation # * @@ -12,24 +11,5 @@ # * # * SPDX-License-Identifier: Apache-2.0 # ********************************************************************************/ -# -FROM debian:bullseye AS build - -ARG DEBIAN_FRONTEND=noninteractive -ARG TZ=Etc/UTC - -LABEL name="leda-debian-x86" - -COPY public.key.gpg /etc/apt/trusted.gpg.d/ - -RUN apt-get update -RUN apt-get install -y ca-certificates -RUN echo "deb https://sdvyocto.blob.core.windows.net/debian dracon main" > /etc/apt/sources.list.d/sdv.list -RUN apt-get update - -RUN apt install -y leda-utils -RUN apt install -y packagegroup-sdv-core -RUN apt install -y packagegroup-sdv-tools -RUN apt install -y packagegroup-sdv-examples -RUN apt install -y packagegroup-sdv-additions +docker build --build-arg BASE_IMAGE=debian:bookworm --tag leda-debian -f Dockerfile.debian . diff --git a/resources/debian/dockerfiles/leda-debian-test.sh b/resources/debian/dockerfiles/leda-debian-test.sh new file mode 100755 index 0000000..11aaec4 --- /dev/null +++ b/resources/debian/dockerfiles/leda-debian-test.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +function check() { + command -v $1 >/dev/null && return 0 + type -P $1 >/dev/null&& return 0 + [ -f /usr/bin/$1 ] && return 0 + echo "ERROR: $1 missing" + exit 1 +} + +echo "Eclipse Leda - Debian Package Installation Tester" + +echo "- Checking packages, binaries and tools" +check containerd +check container-management +check sdv-help +check sdv-health +check sdv-provision +check sdv-kanto-ctl +check sdv-ctr-exec +check kantui +check kanto-auto-deployer + +echo "- Starting containerd and container-management" +containerd & +sleep 1 +container-management --net-type=host --cfg-file=/etc/container-management/config.json & +sleep 1 +kanto-cm sysinfo +kanto-auto-deployer /var/containers/manifests/ || exit 1 + +echo "All checks succeeded." \ No newline at end of file diff --git a/resources/debian/fix-version.sh b/resources/debian/fix-version.sh index 6510cbf..aac4d96 100755 --- a/resources/debian/fix-version.sh +++ b/resources/debian/fix-version.sh @@ -1,4 +1,16 @@ #!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ TARGET="$1" diff --git a/resources/debian/generate-gpg-key.sh b/resources/debian/generate-gpg-key.sh old mode 100644 new mode 100755 diff --git a/resources/debian/install-local-repo.sh b/resources/debian/install-local-repo.sh index f3241b8..3ec1314 100755 --- a/resources/debian/install-local-repo.sh +++ b/resources/debian/install-local-repo.sh @@ -1,4 +1,17 @@ #!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ + FULL_DIR=$(readlink -f ./repo-root) echo ${FULL_DIR} sudo bash -c "echo \"deb file:${FULL_DIR} dracon main\" > /etc/apt/sources.list.d/sdv.list" diff --git a/resources/debian/install-remote-repo.sh b/resources/debian/install-remote-repo.sh index 0d88454..d16c96f 100755 --- a/resources/debian/install-remote-repo.sh +++ b/resources/debian/install-remote-repo.sh @@ -1,4 +1,17 @@ #!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ + sudo bash -c "echo \"deb https://sdvyocto.blob.core.windows.net/debian dracon main\" > /etc/apt/sources.list.d/sdv.list" gpg --output public.key.gpg --export leda-dev@eclipse.org # gpg --output private.pgp --armor --export-secret-key leda-dev@eclipse.org diff --git a/resources/debian/packagelist b/resources/debian/packagelist index e9b26d6..40ab587 100644 --- a/resources/debian/packagelist +++ b/resources/debian/packagelist @@ -1,57 +1,21 @@ ../../build/tmp/deploy/deb/all/packagegroup-sdv-additions_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-dbg_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-dev_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-additions-lic_1.0-r0_all.deb ../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-dbg_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-dev_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-airgap-containers-lic_1.0-r0_all.deb ../../build/tmp/deploy/deb/all/packagegroup-sdv-core_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-core-dbg_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-core-dev_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-core-lic_1.0-r0_all.deb ../../build/tmp/deploy/deb/all/packagegroup-sdv-examples_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-dbg_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-dev_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-examples-lic_1.0-r0_all.deb ../../build/tmp/deploy/deb/all/packagegroup-sdv-tools_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-dbg_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-dev_1.0-r0_all.deb -../../build/tmp/deploy/deb/all/packagegroup-sdv-tools-lic_1.0-r0_all.deb ../../build/tmp/deploy/deb/core2-64/container-management_0.1.0-git0+65e00358fa-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/container-management-dbg_0.1.0-git0+65e00358fa-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/container-management-dev_0.1.0-git0+65e00358fa-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/container-management-lic_0.1.0-git0+65e00358fa-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/databroker-cli_0.17.0.0+861b2ec674-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/databroker-cli-dbg_0.17.0.0+861b2ec674-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/databroker-cli-dev_0.17.0.0+861b2ec674-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/databroker-cli-lic_0.17.0.0+861b2ec674-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer-dbg_git.0+15ff12d9a7-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer_git.0+15ff12d9a7-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kanto-auto-deployer-lic_git.0+15ff12d9a7-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kantui-dbg_git.0+5bcbef1054-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/kantui_git.0+5bcbef1054-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kantui-lic_git.0+5bcbef1054-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/kibi_0.2.2.0+2cc6bead72-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kibi-dbg_0.2.2.0+2cc6bead72-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/kibi-lic_0.2.2.0+2cc6bead72-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/leda-ota-client-dbg_git-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/leda-ota-client-dev_git-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/leda-ota-client_git-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/leda-ota-client-lic_git-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/leda-utils_git-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/leda-utils-lic_git-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-cloudconnector_git-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-cloudconnector-lic_git-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-feedercan_0.1-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-feedercan-lic_0.1-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-hvacservice_0.1-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-hvacservice-lic_0.1-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-seatservice_0.3-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-seatservice-lic_0.3-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-selfupdateagent_0.66-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-selfupdateagent-lic_0.66-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-container-vehicleupdatemanager_git-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-container-vehicleupdatemanager-lic_git-r0_amd64.deb ../../build/tmp/deploy/deb/core2-64/sdv-kuksa-val-databroker_0.3-r0_amd64.deb -../../build/tmp/deploy/deb/core2-64/sdv-kuksa-val-databroker-lic_0.3-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-core-containers_1.0-r0_amd64.deb +../../build/tmp/deploy/deb/core2-64/sdv-example-containers_1.0-r0_amd64.deb diff --git a/resources/debian/repo-create.sh b/resources/debian/repo-create.sh index 4f744e3..eb25934 100755 --- a/resources/debian/repo-create.sh +++ b/resources/debian/repo-create.sh @@ -1,4 +1,16 @@ #!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ # sudo apt install -y reprepro # sudo apt install -y devscripts @@ -12,7 +24,7 @@ KEY_ID=`gpg --list-secret-key --with-subkey-fingerprint | tail -2 | xargs` echo "GPG Key ID is: ${KEY_ID}" # Create folder suppoed to be Apache httpd Document Root -rm -rf ${BASE_DIR} +# rm -rf ${BASE_DIR} mkdir -p ${BASE_DIR}/conf @@ -44,4 +56,3 @@ while read debFile; do ./fix-version.sh ${debFile} reprepro --section misc --component main --priority optional -b ${BASE_DIR} includedeb ${OS_RELEASE} ${debFile} done < packagelist - diff --git a/resources/debian/run-docker.sh b/resources/debian/run-docker.sh new file mode 100755 index 0000000..eef6f01 --- /dev/null +++ b/resources/debian/run-docker.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ + +docker run --privileged -it --rm leda-debian /bin/bash diff --git a/resources/debian/test-docker.sh b/resources/debian/test-docker.sh new file mode 100755 index 0000000..5d4d0d4 --- /dev/null +++ b/resources/debian/test-docker.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ + +function buildAndRun() { + BASE_IMAGE=$1 + echo "Building for ${BASE_IMAGE}" + CONTAINER_IMAGE_HASH=$(docker build --build-arg BASE_IMAGE=${BASE_IMAGE} -q -f Dockerfile.debian .) || exit 1 + echo "Performing test run on ${BASE_IMAGE}" + docker run --rm -it ${CONTAINER_IMAGE_HASH} + RC=$? + if [ $RC -eq 0 ]; then + echo "Success on ${BASE_IMAGE}" + else + echo "Failed on ${BASE_IMAGE}" + exit 1 + fi +} + +buildAndRun "debian:bookworm" + +exit 0 + +buildAndRun "debian:bullseye" +buildAndRun "debian:buster" + +buildAndRun "ubuntu:lunar" +buildAndRun "ubuntu:kinetic" +buildAndRun "ubuntu:jammy" +buildAndRun "ubuntu:focal" + +buildAndRun "archlinux" +buildAndRun "amazonlinux" +buildAndRun "photon" +buildAndRun "rockylinux" diff --git a/resources/debian/upload-repo.sh b/resources/debian/upload-repo.sh new file mode 100644 index 0000000..b705962 --- /dev/null +++ b/resources/debian/upload-repo.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ + +cp -r -f -v repo-root/* ../../azure-debian/ From 2202a97eb854ac4c435f3ee250f9b08dba5c9cf3 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 3 Apr 2023 13:24:15 +0000 Subject: [PATCH 10/11] WIP Installation via Debian packages Signed-off-by: GitHub --- resources/debian/Dockerfile.debian | 11 +++++- resources/debian/README.txt | 7 +++- resources/debian/dockerfiles/dbus-config.conf | 31 ++++++++++++++++ .../debian/dockerfiles/leda-debian-test.sh | 35 +++++++++++++++++-- resources/debian/test-docker.sh | 6 ++-- 5 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 resources/debian/dockerfiles/dbus-config.conf diff --git a/resources/debian/Dockerfile.debian b/resources/debian/Dockerfile.debian index 99033fa..afb297d 100644 --- a/resources/debian/Dockerfile.debian +++ b/resources/debian/Dockerfile.debian @@ -37,11 +37,16 @@ RUN wget https://github.com/eclipse-leda/leda-utils/releases/download/v0.0.1/ecl apt-get install -y ./eclipse-leda-kantui_0.0.1.0.7019_amd64.deb RUN apt show eclipse-leda-kantui -RUN echo "deb https://sdvyocto.blob.core.windows.net/debian dracon main" > /etc/apt/sources.list.d/sdv.list +COPY ./repo-root /repo-root + +RUN echo "deb file:/repo-root dracon main" > /etc/apt/sources.list.d/sdv.list RUN apt-get update RUN apt-get install -y leda-utils RUN apt-get install -y sdv-container-cloudconnector +RUN apt-get install -y sdv-container-feedercan +RUN apt-get install -y sdv-container-hvacservice +RUN apt-get install -y sdv-container-seatservice RUN apt-get install -y sdv-container-selfupdateagent RUN apt-get install -y sdv-container-vehicleupdatemanager RUN apt-get install -y sdv-kuksa-val-databroker @@ -61,5 +66,9 @@ RUN tar Cxzvf /usr/lib/cni cni-plugins-linux-amd64-v1.1.1.tgz # RUN apt-get install -y container-management # RUN apt-get install -y kanto-auto-deployer +# For container: Self Update Agent needs DBUS +COPY dockerfiles/dbus-config.conf ./ +RUN apt-get install -y dbus + COPY dockerfiles/leda-debian-test.sh ./ CMD [ "./leda-debian-test.sh" ] diff --git a/resources/debian/README.txt b/resources/debian/README.txt index 4dfacbd..aba4297 100644 --- a/resources/debian/README.txt +++ b/resources/debian/README.txt @@ -22,10 +22,15 @@ Building Debian packages using BitBake to make packages installable on vanilla D Run the repo-create.sh Ensure ${PROJET_ROOT}/azure-debian/ is mounted, or adapt upload-repo.sh - Run the script to upload the Apt repository to a remote webserve. + Run the script to upload the Apt repository to a remote webserver. 4. Test with Docker Run the build-docker.sh which will build container images with predefined Apt remote repository. The build will fail if it cannot install any of the SDV Core components. + Run the test-docker.sh to build for multiple target OS distros and run a small test script. + The test script runs Mosquitto, DBUS, containerd and container-management and will then create + the SDV core containers. + + No functional testing is being done in this stage. diff --git a/resources/debian/dockerfiles/dbus-config.conf b/resources/debian/dockerfiles/dbus-config.conf new file mode 100644 index 0000000..f8b1c57 --- /dev/null +++ b/resources/debian/dockerfiles/dbus-config.conf @@ -0,0 +1,31 @@ + + + + + + + unix:path=/var/run/dbus/system_bus_socket + + + + + + + + + \ No newline at end of file diff --git a/resources/debian/dockerfiles/leda-debian-test.sh b/resources/debian/dockerfiles/leda-debian-test.sh index 11aaec4..0c62fb8 100755 --- a/resources/debian/dockerfiles/leda-debian-test.sh +++ b/resources/debian/dockerfiles/leda-debian-test.sh @@ -1,4 +1,16 @@ #!/bin/bash +# /******************************************************************************** +# * Copyright (c) 2023 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 +# ********************************************************************************/ function check() { command -v $1 >/dev/null && return 0 @@ -22,11 +34,28 @@ check kantui check kanto-auto-deployer echo "- Starting containerd and container-management" +mosquitto & +sleep 1 +mkdir /var/lib/containerd +mount -t tmpfs none /var/lib/containerd +containerd config default | sed 's/snapshotter = "overlayfs"/snapshotter = "native"/g' | tee /etc/containerd/config.toml containerd & sleep 1 -container-management --net-type=host --cfg-file=/etc/container-management/config.json & +container-management --cfg-file=/etc/container-management/config.json & sleep 1 kanto-cm sysinfo -kanto-auto-deployer /var/containers/manifests/ || exit 1 -echo "All checks succeeded." \ No newline at end of file +# Prepare container: cloud-connector +mkdir -p /data/var/certificates/ +touch /data/var/certificates/device.crt +touch /data/var/certificates/device.key +touch /data/var/certificates/ca.key + +# Prepare container: Fake folders and DBUS +mkdir -p /data/selfupdates +mkdir -p /var/run/dbus/ +dbus-daemon --config-file=dbus-config.conf --print-address & + +kanto-auto-deployer /var/containers/manifests/ || exit 1 +kanto-cm list +echo "All checks succeeded." diff --git a/resources/debian/test-docker.sh b/resources/debian/test-docker.sh index 5d4d0d4..912ea2b 100755 --- a/resources/debian/test-docker.sh +++ b/resources/debian/test-docker.sh @@ -17,7 +17,7 @@ function buildAndRun() { echo "Building for ${BASE_IMAGE}" CONTAINER_IMAGE_HASH=$(docker build --build-arg BASE_IMAGE=${BASE_IMAGE} -q -f Dockerfile.debian .) || exit 1 echo "Performing test run on ${BASE_IMAGE}" - docker run --rm -it ${CONTAINER_IMAGE_HASH} + docker run --privileged --rm -it ${CONTAINER_IMAGE_HASH} RC=$? if [ $RC -eq 0 ]; then echo "Success on ${BASE_IMAGE}" @@ -27,11 +27,11 @@ function buildAndRun() { fi } -buildAndRun "debian:bookworm" +buildAndRun "debian:bullseye" exit 0 -buildAndRun "debian:bullseye" +buildAndRun "debian:bookworm" buildAndRun "debian:buster" buildAndRun "ubuntu:lunar" From 80b85857f5634fcf7d7998faa3598a5421c0baf6 Mon Sep 17 00:00:00 2001 From: Mike Haller Date: Mon, 3 Apr 2023 13:25:51 +0000 Subject: [PATCH 11/11] Update readme Signed-off-by: GitHub --- resources/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/README.md b/resources/README.md index 00bb0b3..de6ac2a 100644 --- a/resources/README.md +++ b/resources/README.md @@ -2,6 +2,8 @@ This folder containers additional resources for building and running Leda quickstart images using QEMU and Docker. +- `apertis`- For Leda develoeprs: Documentation how to install Leda stack onto an Apertis IoT Fixed Function image +- `debian`- For Leda develoeprs: Experiment to install Yocto-built Debian packages of Leda components into plain Debian docker images. - `docker`- For users: Documentation explains how to start the Leda Quickstart Docker container - `docker-compose` - For users: Documentation and docker compose setup, which starts multiple Leda containers including an update bundle webserver - `docker-release` - For Leda developers: Building Leda docker container based on the latest public release of Leda (requires public release)