57
Some checks failed
Builder / Build addons (localai-p2p-master, amd64) (push) Failing after 8s
Builder / Build addons (localai-p2p-worker, amd64) (push) Failing after 8s
Validate / validate (push) Failing after 2s
Builder / Create release (push) Has been skipped

This commit is contained in:
2025-05-30 15:06:39 +02:00
parent 87c48701b4
commit 60a325bb74
5 changed files with 43 additions and 33 deletions

View File

@@ -6,5 +6,8 @@ ENV LOCALAI_P2P="true"
ENV LOCALAI_FEDERATED="true" ENV LOCALAI_FEDERATED="true"
COPY run.sh /build/entrypoint.sh COPY run.sh /build/custom-entrypoint.sh
RUN chmod +x /build/entrypoint.sh RUN chmod +x /build/custom-entrypoint.sh
# Remplacer l'entrypoint par défaut
ENTRYPOINT ["/build/custom-entrypoint.sh"]

View File

@@ -1,9 +1,17 @@
#!/usr/bin/with-contenv bashio #!/bin/bash
CONFIG_PATH=/data/options.json
GPU_LAYERS="$(bashio::config 'gpu_layers')" # Configuration par défaut si bashio n'est pas disponible
TOKEN="$(bashio::config 'master_token')" if command -v bashio >/dev/null 2>&1; then
MODELS_PATH="$(bashio::config 'models_path')" echo "Using Home Assistant configuration"
GPU_LAYERS="$(bashio::config 'gpu_layers')"
TOKEN="$(bashio::config 'master_token')"
MODELS_PATH="$(bashio::config 'models_path')"
else
echo "Using environment variables"
GPU_LAYERS="${GPU_LAYERS:-99}"
TOKEN="${LOCALAI_P2P_TOKEN:-}"
MODELS_PATH="${LOCALAI_MODELS_PATH:-/share/localai/models}"
fi
echo "DEBUG: GPU_LAYERS=$GPU_LAYERS" echo "DEBUG: GPU_LAYERS=$GPU_LAYERS"
echo "DEBUG: TOKEN from config: '$TOKEN'" echo "DEBUG: TOKEN from config: '$TOKEN'"
@@ -13,7 +21,6 @@ echo "DEBUG: MODELS_PATH=$MODELS_PATH"
if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ] && [ "$TOKEN" != "" ]; then if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ] && [ "$TOKEN" != "" ]; then
echo "DEBUG: Setting LOCALAI_P2P_TOKEN to: $TOKEN" echo "DEBUG: Setting LOCALAI_P2P_TOKEN to: $TOKEN"
export LOCALAI_P2P_TOKEN="$TOKEN" export LOCALAI_P2P_TOKEN="$TOKEN"
# Aussi définir la variable pour LocalAI
export P2P_TOKEN="$TOKEN" export P2P_TOKEN="$TOKEN"
else else
echo "DEBUG: No valid token provided in configuration" echo "DEBUG: No valid token provided in configuration"
@@ -27,16 +34,11 @@ mkdir -p "$MODELS_PATH"
# Nettoyer les fichiers de configuration corrompus # Nettoyer les fichiers de configuration corrompus
echo "DEBUG: Cleaning corrupted config files in $MODELS_PATH" echo "DEBUG: Cleaning corrupted config files in $MODELS_PATH"
# Supprimer les fichiers contenant du code shell find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio\|mapping values are not allowed in this context" {} \; | while read file; do
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio" {} \; | while read file; do
echo "DEBUG: Removing corrupted file: $file" echo "DEBUG: Removing corrupted file: $file"
rm -f "$file" rm -f "$file"
done 2>/dev/null || true done 2>/dev/null || true
# Supprimer aussi les fichiers avec des erreurs de mapping YAML # Lancer LocalAI avec nos paramètres
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "mapping values are not allowed in this context" {} \; | while read file; do echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, gpu-layers=$GPU_LAYERS"
echo "DEBUG: Removing YAML mapping error file: $file"
rm -f "$file"
done 2>/dev/null || true
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*" exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"

View File

@@ -6,5 +6,8 @@ ENV LOCALAI_P2P="true"
ENV LOCALAI_FEDERATED="true" ENV LOCALAI_FEDERATED="true"
COPY run.sh /build/entrypoint.sh COPY run.sh /build/custom-entrypoint.sh
RUN chmod +x /build/entrypoint.sh RUN chmod +x /build/custom-entrypoint.sh
# Remplacer l'entrypoint par défaut
ENTRYPOINT ["/build/custom-entrypoint.sh"]

View File

@@ -1,5 +1,5 @@
name: "LocalAI P2P Worker" name: "LocalAI P2P Worker"
version: "1.0.3.6" # Incrémentez aussi la version version: "1.0.3.7" # Incrémentez aussi la version
slug: "localai-p2p-worker" # ⬅️ IMPORTANT : doit correspondre au nom du dossier slug: "localai-p2p-worker" # ⬅️ IMPORTANT : doit correspondre au nom du dossier
description: "LocalAI P2P federation worker node" description: "LocalAI P2P federation worker node"
arch: arch:

View File

@@ -1,9 +1,17 @@
#!/usr/bin/with-contenv bashio #!/bin/bash
CONFIG_PATH=/data/options.json
GPU_LAYERS="$(bashio::config 'gpu_layers')" # Configuration par défaut si bashio n'est pas disponible
TOKEN="$(bashio::config 'master_token')" if command -v bashio >/dev/null 2>&1; then
MODELS_PATH="$(bashio::config 'models_path')" echo "Using Home Assistant configuration"
GPU_LAYERS="$(bashio::config 'gpu_layers')"
TOKEN="$(bashio::config 'master_token')"
MODELS_PATH="$(bashio::config 'models_path')"
else
echo "Using environment variables"
GPU_LAYERS="${GPU_LAYERS:-0}"
TOKEN="${LOCALAI_P2P_TOKEN:-}"
MODELS_PATH="${LOCALAI_MODELS_PATH:-/share/localai/models}"
fi
echo "DEBUG: GPU_LAYERS=$GPU_LAYERS" echo "DEBUG: GPU_LAYERS=$GPU_LAYERS"
echo "DEBUG: TOKEN from config: '$TOKEN'" echo "DEBUG: TOKEN from config: '$TOKEN'"
@@ -13,7 +21,6 @@ echo "DEBUG: MODELS_PATH=$MODELS_PATH"
if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ] && [ "$TOKEN" != "" ]; then if [ -n "$TOKEN" ] && [ "$TOKEN" != "null" ] && [ "$TOKEN" != "" ]; then
echo "DEBUG: Setting LOCALAI_P2P_TOKEN to: $TOKEN" echo "DEBUG: Setting LOCALAI_P2P_TOKEN to: $TOKEN"
export LOCALAI_P2P_TOKEN="$TOKEN" export LOCALAI_P2P_TOKEN="$TOKEN"
# Aussi définir la variable pour LocalAI
export P2P_TOKEN="$TOKEN" export P2P_TOKEN="$TOKEN"
else else
echo "DEBUG: No valid token provided in configuration" echo "DEBUG: No valid token provided in configuration"
@@ -27,16 +34,11 @@ mkdir -p "$MODELS_PATH"
# Nettoyer les fichiers de configuration corrompus # Nettoyer les fichiers de configuration corrompus
echo "DEBUG: Cleaning corrupted config files in $MODELS_PATH" echo "DEBUG: Cleaning corrupted config files in $MODELS_PATH"
# Supprimer les fichiers contenant du code shell find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio\|mapping values are not allowed in this context" {} \; | while read file; do
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "#!/usr/bin/with-contenv bashio" {} \; | while read file; do
echo "DEBUG: Removing corrupted file: $file" echo "DEBUG: Removing corrupted file: $file"
rm -f "$file" rm -f "$file"
done 2>/dev/null || true done 2>/dev/null || true
# Supprimer aussi les fichiers avec des erreurs de mapping YAML # Lancer LocalAI avec nos paramètres
find "$MODELS_PATH" -name "*.yaml" -exec grep -l "mapping values are not allowed in this context" {} \; | while read file; do echo "DEBUG: Starting LocalAI with models-path=$MODELS_PATH, gpu-layers=$GPU_LAYERS"
echo "DEBUG: Removing YAML mapping error file: $file"
rm -f "$file"
done 2>/dev/null || true
exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*" exec /build/local-ai run --models-path="$MODELS_PATH" --gpu-layers="$GPU_LAYERS" --address="0.0.0.0:8080" --cors --cors-allow-origins="*"