diff --git a/Services/llamacpp/DOCS.md b/Services/llamacpp-swap/DOCS.md similarity index 100% rename from Services/llamacpp/DOCS.md rename to Services/llamacpp-swap/DOCS.md diff --git a/Services/llamacpp/Scripts/startBaseMedium.sh b/Services/llamacpp-swap/Scripts/startBaseMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/startBaseMedium.sh rename to Services/llamacpp-swap/Scripts/startBaseMedium.sh diff --git a/Services/llamacpp/Scripts/startBaseMini.sh b/Services/llamacpp-swap/Scripts/startBaseMini.sh similarity index 100% rename from Services/llamacpp/Scripts/startBaseMini.sh rename to Services/llamacpp-swap/Scripts/startBaseMini.sh diff --git a/Services/llamacpp/Scripts/startBaseTop.sh b/Services/llamacpp-swap/Scripts/startBaseTop.sh similarity index 100% rename from Services/llamacpp/Scripts/startBaseTop.sh rename to Services/llamacpp-swap/Scripts/startBaseTop.sh diff --git a/Services/llamacpp/Scripts/startChat.sh b/Services/llamacpp-swap/Scripts/startChat.sh similarity index 100% rename from Services/llamacpp/Scripts/startChat.sh rename to Services/llamacpp-swap/Scripts/startChat.sh diff --git a/Services/llamacpp/Scripts/startCoder.sh b/Services/llamacpp-swap/Scripts/startCoder.sh similarity index 100% rename from Services/llamacpp/Scripts/startCoder.sh rename to Services/llamacpp-swap/Scripts/startCoder.sh diff --git a/Services/llamacpp/Scripts/startCoderMedium.sh b/Services/llamacpp-swap/Scripts/startCoderMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/startCoderMedium.sh rename to Services/llamacpp-swap/Scripts/startCoderMedium.sh diff --git a/Services/llamacpp/Scripts/startCoderMini.sh b/Services/llamacpp-swap/Scripts/startCoderMini.sh similarity index 100% rename from Services/llamacpp/Scripts/startCoderMini.sh rename to Services/llamacpp-swap/Scripts/startCoderMini.sh diff --git a/Services/llamacpp/Scripts/startCoderTop.sh b/Services/llamacpp-swap/Scripts/startCoderTop.sh similarity index 100% rename from Services/llamacpp/Scripts/startCoderTop.sh rename to Services/llamacpp-swap/Scripts/startCoderTop.sh diff --git a/Services/llamacpp/Scripts/startEmbedding.sh b/Services/llamacpp-swap/Scripts/startEmbedding.sh similarity index 100% rename from Services/llamacpp/Scripts/startEmbedding.sh rename to Services/llamacpp-swap/Scripts/startEmbedding.sh diff --git a/Services/llamacpp/Scripts/startEmbeddingFast.sh b/Services/llamacpp-swap/Scripts/startEmbeddingFast.sh similarity index 100% rename from Services/llamacpp/Scripts/startEmbeddingFast.sh rename to Services/llamacpp-swap/Scripts/startEmbeddingFast.sh diff --git a/Services/llamacpp/Scripts/startEmbeddingMedium.sh b/Services/llamacpp-swap/Scripts/startEmbeddingMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/startEmbeddingMedium.sh rename to Services/llamacpp-swap/Scripts/startEmbeddingMedium.sh diff --git a/Services/llamacpp/Scripts/startEmbeddingMini.sh b/Services/llamacpp-swap/Scripts/startEmbeddingMini.sh similarity index 100% rename from Services/llamacpp/Scripts/startEmbeddingMini.sh rename to Services/llamacpp-swap/Scripts/startEmbeddingMini.sh diff --git a/Services/llamacpp/Scripts/startEmbeddingTop.sh b/Services/llamacpp-swap/Scripts/startEmbeddingTop.sh similarity index 100% rename from Services/llamacpp/Scripts/startEmbeddingTop.sh rename to Services/llamacpp-swap/Scripts/startEmbeddingTop.sh diff --git a/Services/llamacpp/Scripts/startGeneral.sh b/Services/llamacpp-swap/Scripts/startGeneral.sh similarity index 100% rename from Services/llamacpp/Scripts/startGeneral.sh rename to Services/llamacpp-swap/Scripts/startGeneral.sh diff --git a/Services/llamacpp/Scripts/startGeneralFast.sh b/Services/llamacpp-swap/Scripts/startGeneralFast.sh similarity index 100% rename from Services/llamacpp/Scripts/startGeneralFast.sh rename to Services/llamacpp-swap/Scripts/startGeneralFast.sh diff --git a/Services/llamacpp/Scripts/stopBaseMedium.sh b/Services/llamacpp-swap/Scripts/stopBaseMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/stopBaseMedium.sh rename to Services/llamacpp-swap/Scripts/stopBaseMedium.sh diff --git a/Services/llamacpp/Scripts/stopBaseMini.sh b/Services/llamacpp-swap/Scripts/stopBaseMini.sh similarity index 100% rename from Services/llamacpp/Scripts/stopBaseMini.sh rename to Services/llamacpp-swap/Scripts/stopBaseMini.sh diff --git a/Services/llamacpp/Scripts/stopBaseTop.sh b/Services/llamacpp-swap/Scripts/stopBaseTop.sh similarity index 100% rename from Services/llamacpp/Scripts/stopBaseTop.sh rename to Services/llamacpp-swap/Scripts/stopBaseTop.sh diff --git a/Services/llamacpp/Scripts/stopChat.sh b/Services/llamacpp-swap/Scripts/stopChat.sh similarity index 100% rename from Services/llamacpp/Scripts/stopChat.sh rename to Services/llamacpp-swap/Scripts/stopChat.sh diff --git a/Services/llamacpp/Scripts/stopCoder.sh b/Services/llamacpp-swap/Scripts/stopCoder.sh similarity index 100% rename from Services/llamacpp/Scripts/stopCoder.sh rename to Services/llamacpp-swap/Scripts/stopCoder.sh diff --git a/Services/llamacpp/Scripts/stopCoderMedium.sh b/Services/llamacpp-swap/Scripts/stopCoderMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/stopCoderMedium.sh rename to Services/llamacpp-swap/Scripts/stopCoderMedium.sh diff --git a/Services/llamacpp/Scripts/stopCoderMini.sh b/Services/llamacpp-swap/Scripts/stopCoderMini.sh similarity index 100% rename from Services/llamacpp/Scripts/stopCoderMini.sh rename to Services/llamacpp-swap/Scripts/stopCoderMini.sh diff --git a/Services/llamacpp/Scripts/stopCoderTop.sh b/Services/llamacpp-swap/Scripts/stopCoderTop.sh similarity index 100% rename from Services/llamacpp/Scripts/stopCoderTop.sh rename to Services/llamacpp-swap/Scripts/stopCoderTop.sh diff --git a/Services/llamacpp/Scripts/stopEmbedding.sh b/Services/llamacpp-swap/Scripts/stopEmbedding.sh similarity index 100% rename from Services/llamacpp/Scripts/stopEmbedding.sh rename to Services/llamacpp-swap/Scripts/stopEmbedding.sh diff --git a/Services/llamacpp/Scripts/stopEmbeddingFast.sh b/Services/llamacpp-swap/Scripts/stopEmbeddingFast.sh similarity index 100% rename from Services/llamacpp/Scripts/stopEmbeddingFast.sh rename to Services/llamacpp-swap/Scripts/stopEmbeddingFast.sh diff --git a/Services/llamacpp/Scripts/stopEmbeddingMedium.sh b/Services/llamacpp-swap/Scripts/stopEmbeddingMedium.sh similarity index 100% rename from Services/llamacpp/Scripts/stopEmbeddingMedium.sh rename to Services/llamacpp-swap/Scripts/stopEmbeddingMedium.sh diff --git a/Services/llamacpp/Scripts/stopEmbeddingMini.sh b/Services/llamacpp-swap/Scripts/stopEmbeddingMini.sh similarity index 100% rename from Services/llamacpp/Scripts/stopEmbeddingMini.sh rename to Services/llamacpp-swap/Scripts/stopEmbeddingMini.sh diff --git a/Services/llamacpp/Scripts/stopEmbeddingTop.sh b/Services/llamacpp-swap/Scripts/stopEmbeddingTop.sh similarity index 100% rename from Services/llamacpp/Scripts/stopEmbeddingTop.sh rename to Services/llamacpp-swap/Scripts/stopEmbeddingTop.sh diff --git a/Services/llamacpp/Scripts/stopGeneral.sh b/Services/llamacpp-swap/Scripts/stopGeneral.sh similarity index 100% rename from Services/llamacpp/Scripts/stopGeneral.sh rename to Services/llamacpp-swap/Scripts/stopGeneral.sh diff --git a/Services/llamacpp/Scripts/stopGeneralFast.sh b/Services/llamacpp-swap/Scripts/stopGeneralFast.sh similarity index 100% rename from Services/llamacpp/Scripts/stopGeneralFast.sh rename to Services/llamacpp-swap/Scripts/stopGeneralFast.sh diff --git a/Services/llamacpp/config.preset.yaml b/Services/llamacpp-swap/config.preset.yaml similarity index 100% rename from Services/llamacpp/config.preset.yaml rename to Services/llamacpp-swap/config.preset.yaml diff --git a/Services/llamacpp/entrypoint.sh b/Services/llamacpp-swap/entrypoint.sh similarity index 100% rename from Services/llamacpp/entrypoint.sh rename to Services/llamacpp-swap/entrypoint.sh diff --git a/Services/llamacpp/lamacpp-nginx.conf b/Services/llamacpp-swap/lamacpp-swap-nginx.conf similarity index 100% rename from Services/llamacpp/lamacpp-nginx.conf rename to Services/llamacpp-swap/lamacpp-swap-nginx.conf diff --git a/Services/llamacpp/llama-vulkan.Containerfile b/Services/llamacpp-swap/llama-swap-vulkan.Containerfile similarity index 95% rename from Services/llamacpp/llama-vulkan.Containerfile rename to Services/llamacpp-swap/llama-swap-vulkan.Containerfile index 8cefc96..7972f99 100644 --- a/Services/llamacpp/llama-vulkan.Containerfile +++ b/Services/llamacpp-swap/llama-swap-vulkan.Containerfile @@ -1,8 +1,8 @@ ### LLaMACpp Builder Container with Vulkan for GPUs ### Multi-stage: download stage with pre-built binaries, runtime stage with only runtime libraries ### -### BUILD: podman build -t llamacpp:vulkan-amd64 -f llama-vulkan.Containerfile . -### Export: podman save -o /home/duckpage/llamacpp-vulkan-amd64.tar localhost/llamacpp:vulkan-amd64 +### BUILD: podman build -t llamacpp-swap:vulkan-amd64 -f llama-swap-vulkan.Containerfile . +### Export: podman save -o /home/duckpage/llamacpp-swap-vulkan-amd64.tar localhost/llamacpp-swap:vulkan-amd64 ARG UBUNTU_VERSION=24.04 diff --git a/Services/llamacpp/llamacpp.container b/Services/llamacpp-swap/llamacpp-swap.container similarity index 100% rename from Services/llamacpp/llamacpp.container rename to Services/llamacpp-swap/llamacpp-swap.container diff --git a/Services/llamacpp.Containerfile b/Services/llamacpp.Containerfile new file mode 100644 index 0000000..22ac793 --- /dev/null +++ b/Services/llamacpp.Containerfile @@ -0,0 +1,51 @@ +### LLaMACpp Builder Container with Vulkan for GPUs +### Multi-stage: download stage with pre-built binaries, runtime stage with only runtime libraries +### +### BUILD: podman build -t llamacpp:vulkan-amd64 -f llamacpp.Containerfile . +### Export: podman save -o /home/badstorm/llamacpp-vulkan-amd64.tar localhost/llamacpp:vulkan-amd64 + + +FROM ubuntu:24.04 + +USER root +EXPOSE 8090 + +RUN apt-get update \ + && apt-get install -y curl unzip grep sed git ffmpeg nano python3-pip python3 python3-wheel \ + && pip install --break-system-packages --upgrade setuptools \ + && pip install --break-system-packages -U "huggingface_hub[cli]" \ + && if [ -f requirements.txt ]; then pip install --break-system-packages -r requirements.txt; fi \ + && apt autoremove -y \ + && apt clean -y \ + && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /var/lib/apt/lists/* \ + && find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \ + && find /var/cache -type f -delete + +WORKDIR /app + +RUN VERSION=$(curl -s https://api.github.com/repos/ggml-org/llama.cpp/releases/latest | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": "\([^"]*\)".*/\1/') \ + && echo "Last llama.cpp version: $VERSION" \ + && curl -L https://github.com/ggml-org/llama.cpp/releases/download/${VERSION}/llama-${VERSION}-bin-ubuntu-vulkan-x64.zip -o llama.zip \ + && unzip -j llama.zip -d . \ + && rm llama.zip + +RUN chmod +x /app/llama-server + +WORKDIR /app + +ENV PATH=/app:$PATH +ENV LD_LIBRARY_PATH=/app:$LD_LIBRARY_PATH +ENV HF_HUB_ENABLE_HF_TRANSFER=1 +#ENV HF_HOME= +#ENV HUGGING_FACE_HUB_TOKEN= +ENV LLAMA_ARG_HOST=0.0.0.0 +ENV LLAMA_ARG_PORT=8090 +ENV LLAMA_ARG_HF_REPO=unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:Q2_K +#ENV LLAMA_ARG_MMPROJ_URL= +ENV LLAMA_ARG_NO_MMAP=true +ENV LLAMA_ARG_CTX_SIZE=128000 +#ENV LLAMA_API_KEY="" + +ENTRYPOINT ["/app/llama-server"] +CMD ["--no-warmup"] \ No newline at end of file diff --git a/Services/llamacpp.container b/Services/llamacpp.container new file mode 100644 index 0000000..121e51b --- /dev/null +++ b/Services/llamacpp.container @@ -0,0 +1,32 @@ +[Container] +ContainerName=llamacpp +Image=localhost/llamacpp:vulkan-amd64 +#AutoUpdate=registry +Network=internal.network +PublishPort=8090:8090 + +# Production - Lemonade usa Hugging Face Hub per i modelli +Volume=/srv/containers/aitools/models:/root/.cache/llama.cpp + +# ROCm tuning +AddDevice=/dev/dri/renderD128 +PodmanArgs=--group-add=keep-groups --ipc=host +SecurityLabelType=container_runtime_t + +Environment=LLAMA_ARG_HOST=0.0.0.0 +Environment=LLAMA_ARG_PORT=8090 +Environment=LLAMA_ARG_NO_MMAP=true +Environment=LLAMA_ARG_CTX_SIZE=131072 +Environment=LLAMA_ARG_HF_REPO=unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:Q2_K + +# HF +Environment=HF_HOME=/root/.cache/huggingface +Environment=HF_TOKEN=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 + + +[Service] +Restart=on-failure +TimeoutStartSec=15m + +[Install] +WantedBy=multi-user.target default.target diff --git a/Services/postgres.container b/Services/postgres.container new file mode 100644 index 0000000..8b29107 --- /dev/null +++ b/Services/postgres.container @@ -0,0 +1,20 @@ +[Unit] +Name=postgres + +[Container] +ContainerName=postgres +Image=postgres:17 +#AutoUpdate=registry +Network=internal.network +Environment=POSTGRES_USER=postgres +Environment=POSTGRES_PASSWORD=postgres +#PublishPort=5432:5432 + +Volume=/srv/containers/postgres:/var/lib/postgresql/data + +[Service] +TimeoutStartSec=5m +Restart=on-failure + +[Install] +WantedBy=multi-user.target default.target \ No newline at end of file diff --git a/install.sh b/install.sh index 0562dd3..af8f2f7 100644 --- a/install.sh +++ b/install.sh @@ -14,6 +14,9 @@ sudo apt update && sudo apt upgrade -y # 2. Aggiungere utente ai gruppi render e video echo "Aggiungendo utente ai gruppi render e video..." sudo usermod -a -G render,video $LOGNAME +sudo loginctl enable-linger $USER +sudo sh -c "echo 'net.ipv4.ip_unprivileged_port_start=80' >> /etc/sysctl.conf" + # 3. Installare podman echo "Installando podman..."