From 9e65718b1cb50c6b742d36dec4f8427efe8e6400 Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:40:46 +0100 Subject: [PATCH 1/6] feat: add Immich Remote ML CT script --- ct/immich-remote-ml.sh | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 ct/immich-remote-ml.sh diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh new file mode 100644 index 0000000000..d4375c8eca --- /dev/null +++ b/ct/immich-remote-ml.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: jwklijnsma (jwklijnsma) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://immich.app | https://github.com/immich-app/immich + +APP="Immich Remote ML" +var_tags="${var_tags:-photos;ai}" +var_cpu="${var_cpu:-6}" +var_ram="${var_ram:-12288}" +var_disk="${var_disk:-50}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-no}" # ROCm and Immich's ROCm ONNX Runtime are amd64-only. +var_unprivileged="${var_unprivileged:-1}" +var_gpu="${var_gpu:-yes}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + local APP_DIR="/opt/immich-remote-ml" + local DATA_DIR="/opt/immich-remote-ml_data" + local ML_SOURCE_DIR="${APP_DIR}/machine-learning" + local VENV_DIR="${DATA_DIR}/venv" + + if [[ ! -d "$ML_SOURCE_DIR" ]]; then + msg_error "No Immich Remote ML installation found!" + exit + fi + + if check_for_gh_release "immich-remote-ml" "immich-app/immich"; then + msg_info "Stopping Immich Remote ML" + systemctl stop immich-remote-ml + msg_ok "Stopped Immich Remote ML" + + set -a + source /etc/default/immich-remote-ml + set +a + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy + + msg_info "Starting Immich Remote ML" + safe_service_restart "immich-remote-ml" + msg_ok "Started Immich Remote ML" + msg_ok "Updated Immich Remote ML successfully!" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}Immich Machine Learning API is available at:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3003${CL}" From ccf5e80e863098c80cd69565e4951bb8f146604a Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:40:48 +0100 Subject: [PATCH 2/6] feat: add native Immich Remote ML installer --- install/immich-remote-ml-install.sh | 113 ++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 install/immich-remote-ml-install.sh diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh new file mode 100644 index 0000000000..55ae7557bb --- /dev/null +++ b/install/immich-remote-ml-install.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: jwklijnsma (jwklijnsma) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://immich.app | https://github.com/immich-app/immich + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +APP="Immich Remote ML" +APP_DIR="/opt/immich-remote-ml" +DATA_DIR="/opt/immich-remote-ml_data" +ML_SOURCE_DIR="${APP_DIR}/machine-learning" +VENV_DIR="${DATA_DIR}/venv" +CACHE_DIR="${DATA_DIR}/cache" +HOME_DIR="${DATA_DIR}/home" + +if [[ "$(get_os_info id)" != "debian" || "$(get_os_info codename)" != "trixie" ]]; then + msg_error "Immich Remote ML currently requires Debian 13 (Trixie)." + exit 1 +fi + +if [[ "$(arch_resolve)" != "amd64" ]]; then + msg_error "Immich Remote ML ROCm acceleration currently requires amd64." + exit 1 +fi + +$STD apt install -y g++ git + +PYTHON_VERSION="3.13" setup_uv +setup_hwaccel + +fetch_and_deploy_gh_release "immich-remote-ml" "immich-app/immich" "tarball" "latest" "$APP_DIR" + +if [[ "${HWACCEL_VENDOR:-none}" == "amd" ]]; then + ML_EXTRA="rocm" + DEVICE="rocm" + $STD apt install -y migraphx miopen-hip + msg_ok "Configured AMD ROCm machine-learning backend" +else + ML_EXTRA="cpu" + DEVICE="cpu" + msg_warn "No AMD ROCm GPU detected; using the CPU machine-learning backend" +fi + +mkdir -p "$DATA_DIR" "$CACHE_DIR/jit/comgr" "$CACHE_DIR/hf-cache" "$HOME_DIR" "$VENV_DIR" + +cat </etc/default/immich-remote-ml +ML_EXTRA=$ML_EXTRA +DEVICE=$DEVICE +EOF + +UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "$ML_EXTRA" --python 3.13 --link-mode copy + +msg_info "Creating Immich Remote ML service" +cat </etc/systemd/system/immich-remote-ml.service +[Unit] +Description=Immich Remote Machine Learning +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=$ML_SOURCE_DIR +EnvironmentFile=-/etc/default/immich-remote-ml +Environment=HOME=$HOME_DIR +Environment=PATH=$VENV_DIR/bin:/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +Environment=IMMICH_HOST=0.0.0.0 +Environment=IMMICH_PORT=3003 +Environment=MACHINE_LEARNING_CACHE_FOLDER=$CACHE_DIR +Environment=MACHINE_LEARNING_MODEL_REVISION=v2 +Environment=HF_HOME=$CACHE_DIR/hf-cache +Environment=AMD_COMGR_CACHE_DIR=$CACHE_DIR/jit/comgr +ExecStart=$VENV_DIR/bin/python -m immich_ml +Restart=on-failure +RestartSec=10 +TimeoutStartSec=300 +TimeoutStopSec=30 +KillMode=control-group +PrivateTmp=true +PrivateDevices=false +ProtectSystem=strict +ProtectHome=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectControlGroups=true +NoNewPrivileges=true +RestrictSUIDSGID=true +LockPersonality=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +ReadWritePaths=$DATA_DIR + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now immich-remote-ml.service +msg_ok "Created Immich Remote ML service" + +if ! systemctl is-active --quiet immich-remote-ml.service; then + journalctl -u immich-remote-ml.service -n 50 --no-pager + msg_error "Immich Remote ML failed to start" + exit 1 +fi + +motd_ssh +customize +cleanup_lxc From f68cd4270762dddc33cd309bcbe2811ce5305d0d Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:40:51 +0100 Subject: [PATCH 3/6] feat: add Immich Remote ML metadata --- json/immich-remote-ml.json | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 json/immich-remote-ml.json diff --git a/json/immich-remote-ml.json b/json/immich-remote-ml.json new file mode 100644 index 0000000000..0a2c9b5d18 --- /dev/null +++ b/json/immich-remote-ml.json @@ -0,0 +1,40 @@ +{ + "name": "Immich Remote ML", + "slug": "immich-remote-ml", + "categories": [20], + "date_created": "2026-11-25", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3003, + "documentation": "https://docs.immich.app/features/ml-hardware-acceleration/", + "website": "https://immich.app/", + "repository": "https://github.com/immich-app/immich", + "architectures": ["amd64"], + "platforms": ["pve"], + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/immich.webp", + "description": "Standalone native Immich machine-learning service for facial recognition and smart search. Uses AMD ROCm when an AMD GPU is passed through to the LXC, with a CPU fallback.", + "install_methods": [ + { + "type": "default", + "script": "ct/immich-remote-ml.sh", + "config_path": "/etc/default/immich-remote-ml", + "resources": { + "cpu": 6, + "ram": 12288, + "hdd": 50, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + "In Immich, set the Machine Learning URL to http://:3003. The API has no authentication; restrict TCP port 3003 to the Immich server and trusted LAN.", + "ROCm requires AMD GPU passthrough and a compatible Proxmox host driver. For unsupported gfx1030 devices, set HSA_OVERRIDE_GFX_VERSION=10.3.0 in /etc/default/immich-remote-ml.", + "ROCm libraries and model caches require substantial disk space; the default LXC disk is 50 GiB. CPU backend is selected when no AMD GPU is detected." + ] +} \ No newline at end of file From 85fff2b78f856aca5828a7510d9445c77d7a5c1d Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:41:09 +0100 Subject: [PATCH 4/6] fix: start Immich Remote ML after update --- ct/immich-remote-ml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/immich-remote-ml.sh b/ct/immich-remote-ml.sh index d4375c8eca..5b9d3f5bab 100644 --- a/ct/immich-remote-ml.sh +++ b/ct/immich-remote-ml.sh @@ -52,7 +52,7 @@ function update_script() { UV_PROJECT_ENVIRONMENT="$VENV_DIR" $STD uv sync --project "$ML_SOURCE_DIR" --locked --no-dev --no-install-project --extra "${ML_EXTRA:-cpu}" --python 3.13 --link-mode copy msg_info "Starting Immich Remote ML" - safe_service_restart "immich-remote-ml" + systemctl start immich-remote-ml msg_ok "Started Immich Remote ML" msg_ok "Updated Immich Remote ML successfully!" fi From 6edc1d5d7de076b0520df80ab29bb128184c69cb Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:41:11 +0100 Subject: [PATCH 5/6] style: remove unused installer variable --- install/immich-remote-ml-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/immich-remote-ml-install.sh b/install/immich-remote-ml-install.sh index 55ae7557bb..4409fd5a31 100644 --- a/install/immich-remote-ml-install.sh +++ b/install/immich-remote-ml-install.sh @@ -13,7 +13,6 @@ setting_up_container network_check update_os -APP="Immich Remote ML" APP_DIR="/opt/immich-remote-ml" DATA_DIR="/opt/immich-remote-ml_data" ML_SOURCE_DIR="${APP_DIR}/machine-learning" From 2e7604dc0a9119b57682ef7109bf42cb851a6c3f Mon Sep 17 00:00:00 2001 From: jwklijnsma Date: Wed, 25 Nov 2026 19:42:12 +0100 Subject: [PATCH 6/6] style: terminate Immich Remote ML metadata with newline --- json/immich-remote-ml.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/immich-remote-ml.json b/json/immich-remote-ml.json index 0a2c9b5d18..ae82a8a3dd 100644 --- a/json/immich-remote-ml.json +++ b/json/immich-remote-ml.json @@ -37,4 +37,4 @@ "ROCm requires AMD GPU passthrough and a compatible Proxmox host driver. For unsupported gfx1030 devices, set HSA_OVERRIDE_GFX_VERSION=10.3.0 in /etc/default/immich-remote-ml.", "ROCm libraries and model caches require substantial disk space; the default LXC disk is 50 GiB. CPU backend is selected when no AMD GPU is detected." ] -} \ No newline at end of file +}