immich: prepare for new version (#5025)

- Remove pgvecto.rs > vchord migration operation
- Check for vchord update - only apply if Immich has update
- Additional operations for vchord 0.3.0 to 0.4.x
- Use UV

- Move libopencl to dependencies
- Use vchord 0.3.0 only if Immich <= 1.134.0
- vchord 0.4.x for 1.134.1+
- Use UV
This commit is contained in:
Chris
2025-06-19 01:55:39 -04:00
committed by GitHub
parent 4190582659
commit 791eca99b9
3 changed files with 62 additions and 79 deletions

View File

@ -13,6 +13,8 @@ setting_up_container
network_check
update_os
setup_uv
msg_info "Configuring apt and installing dependencies"
echo "deb http://deb.debian.org/debian testing main contrib" >/etc/apt/sources.list.d/immich.list
cat <<EOF >/etc/apt/preferences.d/immich
@ -27,7 +29,6 @@ $STD apt-get install --no-install-recommends -y \
redis \
autoconf \
build-essential \
python3-venv \
python3-dev \
cmake \
jq \
@ -63,6 +64,7 @@ $STD apt-get install --no-install-recommends -y \
mesa-utils \
mesa-va-drivers \
mesa-vulkan-drivers \
ocl-icd-libopencl1 \
tini \
zlib1g
$STD apt-get install -y \
@ -88,14 +90,13 @@ read -r -p "Install OpenVINO dependencies for Intel HW-accelerated machine-learn
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Installing OpenVINO dependencies"
touch ~/.openvino
$STD apt-get -y install --no-install-recommends ocl-icd-libopencl1
tmp_dir=$(mktemp -d)
$STD pushd "$tmp_dir"
curl -fsSL https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-core_1.0.17384.11_amd64.deb -O
curl -fsSL https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-opencl_1.0.17384.11_amd64.deb -O
curl -fsSL https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd_24.31.30508.7_amd64.deb -O
curl -fsSL https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/libigdgmm12_22.4.1_amd64.deb -O
$STD dpkg -i ./*.deb
curl -fsSLO https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-core_1.0.17384.11_amd64.deb
curl -fsSLO https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.17384.11/intel-igc-opencl_1.0.17384.11_amd64.deb
curl -fsSLO https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/intel-opencl-icd_24.31.30508.7_amd64.deb
curl -fsSLO https://github.com/intel/compute-runtime/releases/download/24.31.30508.7/libigdgmm12_22.4.1_amd64.deb
$STD apt install -y ./*.deb
$STD popd
rm -rf "$tmp_dir"
dpkg -l | grep "intel-opencl-icd" | awk '{print $3}' >~/.intel_version
@ -113,10 +114,11 @@ NODE_VERSION="22" setup_nodejs
PG_VERSION="16" setup_postgresql
msg_info "Setting up Postgresql Database"
$STD apt-get install postgresql-16-pgvector
curl -fsSL https://github.com/tensorchord/VectorChord/releases/download/0.3.0/postgresql-16-vchord_0.3.0-1_amd64.deb -o vchord.deb
$STD dpkg -i vchord.deb
VCHORD_RELEASE="$(curl -fsSL https://api.github.com/repos/tensorchord/vectorchord/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')"
curl -fsSL "https://github.com/tensorchord/VectorChord/releases/download/${VCHORD_RELEASE}/postgresql-16-vchord_${VCHORD_RELEASE}-1_amd64.deb" -o vchord.deb
$STD apt install -y ./vchord.deb
rm vchord.deb
echo "$VCHORD_RELEASE" >~/.vchord_version
DB_NAME="immich"
DB_USER="immich"
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c18)
@ -273,7 +275,7 @@ msg_ok "Custom Photo-processing Library Compiled"
msg_info "Installing ${APPLICATION} (more patience please)"
tmp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/immich-app/immich/releases?per_page=1 | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=$(curl -fsSL https://api.github.com/repos/immich-app/immich/releases?per_page=1 | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
curl -fsSL "https://github.com/immich-app/immich/archive/refs/tags/v${RELEASE}.zip" -o "$tmp_file"
unzip -q "$tmp_file"
INSTALL_DIR="/opt/${APPLICATION}"
@ -304,23 +306,16 @@ cp LICENSE "$APP_DIR"
msg_ok "Installed Immich Web Components"
cd "$SRC_DIR"/machine-learning
$STD python3 -m venv "$ML_DIR/ml-venv"
export VIRTUAL_ENV="${ML_DIR}/ml-venv"
$STD uv venv "$VIRTUAL_ENV"
if [[ -f ~/.openvino ]]; then
msg_info "Installing HW-accelerated machine-learning"
(
source "$ML_DIR"/ml-venv/bin/activate
$STD pip3 install uv
uv -q sync --extra openvino --no-cache --active
)
patchelf --clear-execstack "$ML_DIR"/ml-venv/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so
uv -q sync --extra openvino --no-cache --active
patchelf --clear-execstack "${VIRTUAL_ENV}/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
msg_ok "Installed HW-accelerated machine-learning"
else
msg_info "Installing machine-learning"
(
source "$ML_DIR"/ml-venv/bin/activate
$STD pip3 install uv
uv -q sync --extra cpu --no-cache --active
)
uv -q sync --extra cpu --no-cache --active
msg_ok "Installed machine-learning"
fi
cd "$SRC_DIR"
@ -351,7 +346,9 @@ URL_LIST=(
https://download.geonames.org/export/dump/cities500.zip
https://raw.githubusercontent.com/nvkelso/natural-earth-vector/v5.1.2/geojson/ne_10m_admin_0_countries.geojson
)
echo "${URL_LIST[@]}" | xargs -n1 -P 8 wget -q
for geo in "${URL_LIST[@]}"; do
curl -fsSLO "$geo"
done
unzip -q cities500.zip
date --iso-8601=seconds | tr -d "\n" >geodata-date.txt
rm cities500.zip
@ -390,13 +387,13 @@ cat <<EOF >"${ML_DIR}"/ml_start.sh
#!/usr/bin/env bash
cd ${ML_DIR}
. ml-venv/bin/activate
. ${VIRTUAL_ENV}/bin/activate
set -a
. ${INSTALL_DIR}/.env
set +a
python -m immich_ml
python3 -m immich_ml
EOF
chmod +x "$ML_DIR"/ml_start.sh
cat <<EOF >/etc/systemd/system/"${APPLICATION}"-web.service