Nicolas Massé 6 months ago
parent
commit
d8e232c350
  1. 5
      bootc/Containerfile
  2. 8
      bootc/root/etc/containers/systemd/app-edge-ai.container
  3. 20
      bootc/root/etc/containers/systemd/mosquitto.container
  4. 6
      bootc/root/etc/intelligent-train.env
  5. 7
      bootc/root/etc/mosquitto/mosquitto.conf
  6. 12
      bootc/root/etc/systemd/system/repo-intelligent-train.service

5
bootc/Containerfile

@ -5,7 +5,7 @@ ARG ADMIN_USERNAME=demo \
NVIDIA_KERNEL_VERSION=5.14.0-427.22.1.el9_4 NVIDIA_KERNEL_VERSION=5.14.0-427.22.1.el9_4
RUN set -Eeuo pipefail ; \ RUN set -Eeuo pipefail ; \
if ! grep -qxF 'keepcache=1'; then \ if ! grep -qxF 'keepcache=1' /etc/dnf/dnf.conf; then \
sed -i.bak '/^\[main\]$/a keepcache=1' /etc/dnf/dnf.conf ; \ sed -i.bak '/^\[main\]$/a keepcache=1' /etc/dnf/dnf.conf ; \
fi ; \ fi ; \
echo "Replacing current kernel with a version compatible with the kernel modules shipped by Nvidia" ; \ echo "Replacing current kernel with a version compatible with the kernel modules shipped by Nvidia" ; \
@ -28,5 +28,4 @@ RUN set -Eeuo pipefail ; \
ADD --chown=root:root root / ADD --chown=root:root root /
RUN set -Eeuo pipefail ; \ RUN set -Eeuo pipefail ; \
systemctl enable nvidia-ctk-init.service ; \ systemctl enable nvidia-ctk-init.service
systemctl enable repo-intelligent-train.service

8
bootc/root/etc/containers/systemd/intelligent-train.container → bootc/root/etc/containers/systemd/app-edge-ai.container

@ -1,16 +1,14 @@
[Unit] [Unit]
Description=AI Auto-Pilot Description=AI application deployed at the Edge
After=local-fs.target After=local-fs.target
[Service] [Service]
ExecStartPre=-podman network create --ignore app ExecStartPre=-podman network create --ignore app
[Container] [Container]
ContainerName=intelligent-train ContainerName=app-edge-ai
Image=quay.io/demo-ai-edge-crazy-train/intelligent-train:latest Image=quay.io/nmasse-redhat/app-edge-ai:latest
Network=app Network=app
PublishPort=8080:8080
EnvironmentFile=/etc/intelligent-train.env
# Needed for Nvidia GPU Acceleration # Needed for Nvidia GPU Acceleration
PodmanArgs=--runtime /usr/bin/nvidia-container-runtime PodmanArgs=--runtime /usr/bin/nvidia-container-runtime

20
bootc/root/etc/containers/systemd/mosquitto.container

@ -1,20 +0,0 @@
[Unit]
Description=Mosquitto MQTT Broker
After=local-fs.target
[Service]
ExecStartPre=-podman network create --ignore app
[Container]
ContainerName=mosquitto
Image=docker.io/library/eclipse-mosquitto:latest
Network=app
PublishPort=1883:1883
PublishPort=9001:9001
Volume=/var/lib/mosquitto/data:/mosquitto/data:z
Volume=/var/lib/mosquitto/log:/mosquitto/log:z
Volume=/etc/mosquitto:/mosquitto/config:z
[Install]
# Start by default on boot
WantedBy=multi-user.target default.target

6
bootc/root/etc/intelligent-train.env

@ -1,6 +0,0 @@
MQTT_BROKER=mosquitto
MQTT_PORT=1883
MQTT_TOPIC=train-image
MQTT_PUB_TOPIC=train-model-result
MODEL_PATH=models/model.onnx
MIN_CONF_THRESHOLD=0.7

7
bootc/root/etc/mosquitto/mosquitto.conf

@ -1,7 +0,0 @@
user mosquitto
persistence true
persistence_location /mosquitto/data/
listener 1883 0.0.0.0
protocol mqtt
allow_anonymous true
log_dest file /mosquitto/log/mosquitto.log

12
bootc/root/etc/systemd/system/repo-intelligent-train.service

@ -1,12 +0,0 @@
[Unit]
Description=Sync the intelligent-train git repo
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c 'if [ -d /root/intelligent-train ]; then cd /root/intelligent-train && git pull ; else git clone -b main https://github.com/Demo-AI-Edge-Crazy-Train/intelligent-train.git /root/intelligent-train ; fi'
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save