@@ -27,6 +27,9 @@ function update_script() {
2727 msg_error " No ${APP} Installation Found!"
2828 exit
2929 fi
30+
31+ setup_uv
32+
3033 STAGING_DIR=/opt/staging
3134 BASE_DIR=${STAGING_DIR} /base-images
3235 SOURCE_DIR=${STAGING_DIR} /image-source
@@ -40,7 +43,7 @@ function update_script() {
4043 for url in " ${INTEL_URLS[@]} " ; do
4144 curl -fsSLO " $url "
4245 done
43- $STD dpkg -i ./* .deb
46+ $STD apt install -y ./* .deb
4447 rm ./* .deb
4548 msg_ok " Intel iGPU dependencies updated"
4649 fi
@@ -177,54 +180,42 @@ function update_script() {
177180 msg_ok " Image-processing libraries compiled"
178181 fi
179182 fi
180- 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) }' )
183+ 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) }' )
181184 if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
182185 msg_info " Stopping ${APP} services"
183186 systemctl stop immich-web
184187 systemctl stop immich-ml
185188 msg_ok " Stopped ${APP} "
186- if [[ " $( cat /opt/${APP} _version.txt) " < " 1.133.0" ]]; then
187- msg_info " Upgrading to the VectorChord PostgreSQL extension"
188- NUMBER=" $(
189- sed -n ' 2p' <(
190- sudo -u postgres psql -A -d immich << EOF
191- SELECT atttypmod as dimsize
192- FROM pg_attribute f
193- JOIN pg_class c ON c.oid = f.attrelid
194- WHERE c.relkind = 'r'::char
195- AND f.attnum > 0
196- AND c.relname = 'smart_search'::text
197- AND f.attname = 'embedding'::text;
198- EOF
199- )
200- ) "
201- $STD sudo -u postgres psql -d immich << EOF
202- DROP INDEX IF EXISTS clip_index;
203- DROP INDEX IF EXISTS face_index;
204- ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE real[];
205- ALTER TABLE face_search ALTER COLUMN embedding SET DATA TYPE real[];
206- EOF
207- $STD apt-get update
208- $STD apt-get install postgresql-16-pgvector -y
209- curl -fsSL https://github.com/tensorchord/VectorChord/releases/download/0.3.0/postgresql-16-vchord_0.3.0-1_amd64.deb -o vchord.deb
210- $STD dpkg -i vchord.deb
211- rm vchord.deb
212- sed -i " s|vectors.so|vchord.so|" /etc/postgresql/16/main/postgresql.conf
213- systemctl restart postgresql.service
214- $STD sudo -u postgres psql -d immich << EOF
215- CREATE EXTENSION IF NOT EXISTS vchord CASCADE;
216- ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE vector($NUMBER );
217- ALTER TABLE face_search ALTER COLUMN embedding SET DATA TYPE vector(512);
218- EOF
219- $STD apt purge vectors-pg16 -y
220- msg_ok " Database upgrade complete"
221- fi
222189 INSTALL_DIR=" /opt/${APP} "
223190 UPLOAD_DIR=" $( sed -n ' /^IMMICH_MEDIA_LOCATION/s/[^=]*=//p' /opt/immich/.env) "
224191 SRC_DIR=" ${INSTALL_DIR} /source"
225192 APP_DIR=" ${INSTALL_DIR} /app"
226193 ML_DIR=" ${APP_DIR} /machine-learning"
227194 GEO_DIR=" ${INSTALL_DIR} /geodata"
195+ VCHORD_RELEASE=" $( curl -fsSL https://api.github.com/repos/tensorchord/vectorchord/releases/latest | grep " tag_name" | awk ' {print substr($2, 2, length($2)-3) }' ) "
196+
197+ if [[ ! -f ~ /.vchord_version ]] || [[ " $VCHORD_RELEASE " != " $( cat ~ /.vchord_version) " ]]; then
198+ msg_info " Updating VectorChord"
199+ if [[ ! -f ~ /.vchord_version ]] || [[ ! " $( cat ~ /.vchord_version) " > " 0.3.0" ]]; then
200+ $STD sudo -u postgres pg_dumpall --clean --if-exists --username=postgres | gzip > /etc/postgresql/immich-db-vchord0.3.0.sql.gz
201+ chown postgres /etc/postgresql/immich-db-vchord0.3.0.sql.gz
202+ $STD sudo -u postgres gunzip --stdout /etc/postgresql/immich-db-vchord0.3.0.sql.gz |
203+ sed -e " s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
204+ -e " /vchordrq.prewarm_dim/d" |
205+ sudo -u postgres psql
206+ fi
207+ curl -fsSL " https://github.com/tensorchord/vectorchord/releases/download/${VCHORD_RELEASE} /postgresql-16-vchord_${VCHORD_RELEASE} -1_amd64.deb" -o vchord.deb
208+ $STD apt install -y ./vchord.deb
209+ $STD sudo -u postgres psql -d immich -c " ALTER EXTENSION vchord UPDATE;"
210+ systemctl restart postgresql
211+ if [[ ! -f ~ /.vchord-version ]] || [[ ! " $( cat ~ /.vchord_version) " > " 0.3.0" ]]; then
212+ $STD sudo -u postgres psql -d immich -c " REINDEX DATABASE;"
213+ fi
214+ echo " $VCHORD_RELEASE " > ~/.vchord_version
215+ rm ./vchord.deb
216+ msg_ok " Updated VectorChord to v${VCHORD_RELEASE} "
217+ fi
218+
228219 cp " $ML_DIR " /ml_start.sh " $INSTALL_DIR "
229220 rm -rf " ${APP_DIR:? } " /*
230221 rm -rf " $SRC_DIR "
@@ -252,28 +243,21 @@ EOF
252243 msg_ok " Updated ${APP} web and microservices"
253244
254245 cd " $SRC_DIR " /machine-learning
255- $STD python3 -m venv " $ML_DIR " /ml-venv
246+ export VIRTUAL_ENV=" ${ML_DIR} " /ml-venv
247+ $STD /usr/local/bin/uv venv " $VIRTUAL_ENV "
256248 if [[ -f ~ /.openvino ]]; then
257249 msg_info " Updating HW-accelerated machine-learning"
258- (
259- source " $ML_DIR " /ml-venv/bin/activate
260- $STD pip3 install -U uv
261- uv -q sync --extra openvino --no-cache --active
262- )
263- patchelf --clear-execstack " $ML_DIR " /ml-venv/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so
250+ /usr/local/bin/uv -q sync --extra openvino --no-cache --active
251+ patchelf --clear-execstack " ${VIRTUAL_ENV} /lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
264252 msg_ok " Updated HW-accelerated machine-learning"
265253 else
266254 msg_info " Updating machine-learning"
267- (
268- source " $ML_DIR " /ml-venv/bin/activate
269- $STD pip3 install -U uv
270- uv -q sync --extra cpu --no-cache --active
271- )
255+ /usr/local/bin/uv -q sync --extra cpu --no-cache --active
272256 msg_ok " Updated machine-learning"
273257 fi
274258 cd " $SRC_DIR "
275259 cp -a machine-learning/{ann,immich_ml} " $ML_DIR "
276- cp " $INSTALL_DIR " /ml_start.sh " $ML_DIR "
260+ mv " $INSTALL_DIR " /ml_start.sh " $ML_DIR "
277261 if [[ -f ~ /.openvino ]]; then
278262 sed -i " /intra_op/s/int = 0/int = os.cpu_count() or 0/" " $ML_DIR " /immich_ml/config.py
279263 fi
292276 $STD npm i -g @immich/cli
293277 msg_ok " Updated Immich CLI"
294278
295- sed -i " s|pgvecto.rs|vectorchord|" /opt/" ${APP} " /.env
296-
297279 chown -R immich:immich " $INSTALL_DIR "
298280 echo " $RELEASE " > /opt/" ${APP} " _version.txt
299281 msg_ok " Updated ${APP} to v${RELEASE} "
0 commit comments