@@ -181,116 +181,114 @@ function update_script() {
181181 fi
182182 fi
183183 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) }' )
184- if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
185- msg_info " Stopping ${APP} services"
186- systemctl stop immich-web
187- systemctl stop immich-ml
188- msg_ok " Stopped ${APP} "
189- INSTALL_DIR=" /opt/${APP} "
190- UPLOAD_DIR=" $( sed -n ' /^IMMICH_MEDIA_LOCATION/s/[^=]*=//p' /opt/immich/.env) "
191- SRC_DIR=" ${INSTALL_DIR} /source"
192- APP_DIR=" ${INSTALL_DIR} /app"
193- ML_DIR=" ${APP_DIR} /machine-learning"
194- 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) }' ) "
184+ if [[ -f ~ /.immich && " $RELEASE " == " $( cat ~ /.immich) " ]]; then
185+ msg_ok " No update required. ${APP} is already at v${RELEASE} "
186+ exit
187+ fi
188+ msg_info " Stopping ${APP} services"
189+ systemctl stop immich-web
190+ systemctl stop immich-ml
191+ msg_ok " Stopped ${APP} "
192+ INSTALL_DIR=" /opt/${APP} "
193+ UPLOAD_DIR=" $( sed -n ' /^IMMICH_MEDIA_LOCATION/s/[^=]*=//p' /opt/immich/.env) "
194+ SRC_DIR=" ${INSTALL_DIR} /source"
195+ APP_DIR=" ${INSTALL_DIR} /app"
196+ ML_DIR=" ${APP_DIR} /machine-learning"
197+ GEO_DIR=" ${INSTALL_DIR} /geodata"
198+ VCHORD_RELEASE=" $( curl -fsSL https://api.github.com/repos/tensorchord/vectorchord/releases/latest | grep " tag_name" | awk ' {print substr($2, 2, length($2)-3) }' ) "
196199
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} "
200+ if [[ ! -f ~ /.vchord_version ]] || [[ " $VCHORD_RELEASE " != " $( cat ~ /.vchord_version) " ]]; then
201+ msg_info " Updating VectorChord"
202+ if [[ ! -f ~ /.vchord_version ]] || [[ ! " $( cat ~ /.vchord_version) " > " 0.3.0" ]]; then
203+ $STD sudo -u postgres pg_dumpall --clean --if-exists --username=postgres | gzip > /etc/postgresql/immich-db-vchord0.3.0.sql.gz
204+ chown postgres /etc/postgresql/immich-db-vchord0.3.0.sql.gz
205+ $STD sudo -u postgres gunzip --stdout /etc/postgresql/immich-db-vchord0.3.0.sql.gz |
206+ sed -e " s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \
207+ -e " /vchordrq.prewarm_dim/d" |
208+ sudo -u postgres psql
217209 fi
218-
219- cp " $ML_DIR " /ml_start.sh " $INSTALL_DIR "
220- rm -rf " ${APP_DIR:? } " /*
221- rm -rf " $SRC_DIR "
222- immich_zip=$( mktemp)
223- curl -fsSL " https://github.com/immich-app/immich/archive/refs/tags/v${RELEASE} .zip" -o " $immich_zip "
224- msg_info " Updating ${APP} web and microservices"
225- unzip -q " $immich_zip "
226- mv " $APP -$RELEASE " / " $SRC_DIR "
227- mkdir -p " $ML_DIR "
228- cd " $SRC_DIR " /server
229- if [[ " $RELEASE " == " 1.135.1" ]]; then
230- rm ./src/schema/migrations/1750323941566-UnsetPrewarmDimParameter.ts
210+ curl -fsSL " https://github.com/tensorchord/vectorchord/releases/download/${VCHORD_RELEASE} /postgresql-16-vchord_${VCHORD_RELEASE} -1_amd64.deb" -o vchord.deb
211+ $STD apt install -y ./vchord.deb
212+ $STD sudo -u postgres psql -d immich -c " ALTER EXTENSION vchord UPDATE;"
213+ systemctl restart postgresql
214+ if [[ ! -f ~ /.vchord_version ]] || [[ ! " $( cat ~ /.vchord_version) " > " 0.3.0" ]]; then
215+ $STD sudo -u postgres psql -d immich -c " REINDEX DATABASE;"
231216 fi
232- $STD npm install -g node-gyp node-pre-gyp
233- $STD npm ci
234- $STD npm run build
235- $STD npm prune --omit=dev --omit=optional
236- cd " $SRC_DIR " /open-api/typescript-sdk
237- $STD npm ci
238- $STD npm run build
239- cd " $SRC_DIR " /web
240- $STD npm ci
241- $STD npm run build
242- cd " $SRC_DIR "
243- cp -a server/{node_modules,dist,bin,resources,package.json,package-lock.json,start* .sh} " $APP_DIR " /
244- cp -a web/build " $APP_DIR " /www
245- cp LICENSE " $APP_DIR "
246- msg_ok " Updated ${APP} web and microservices"
217+ echo " $VCHORD_RELEASE " > ~/.vchord_version
218+ rm ./vchord.deb
219+ msg_ok " Updated VectorChord to v${VCHORD_RELEASE} "
220+ fi
247221
248- cd " $SRC_DIR " /machine-learning
249- export VIRTUAL_ENV=" ${ML_DIR} " /ml-venv
250- $STD /usr/local/bin/uv venv " $VIRTUAL_ENV "
251- if [[ -f ~ /.openvino ]]; then
252- msg_info " Updating HW-accelerated machine-learning"
253- /usr/local/bin/uv -q sync --extra openvino --no-cache --active
254- patchelf --clear-execstack " ${VIRTUAL_ENV} /lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
255- msg_ok " Updated HW-accelerated machine-learning"
256- else
257- msg_info " Updating machine-learning"
258- /usr/local/bin/uv -q sync --extra cpu --no-cache --active
259- msg_ok " Updated machine-learning"
260- fi
261- cd " $SRC_DIR "
262- cp -a machine-learning/{ann,immich_ml} " $ML_DIR "
263- mv " $INSTALL_DIR " /ml_start.sh " $ML_DIR "
264- if [[ -f ~ /.openvino ]]; then
265- sed -i " /intra_op/s/int = 0/int = os.cpu_count() or 0/" " $ML_DIR " /immich_ml/config.py
266- fi
267- ln -sf " $APP_DIR " /resources " $INSTALL_DIR "
268- cd " $APP_DIR "
269- grep -Rl /usr/src | xargs -n1 sed -i " s|\/usr/src|$INSTALL_DIR |g"
270- grep -RlE " '/build'" | xargs -n1 sed -i " s|'/build'|'$APP_DIR '|g"
271- sed -i " s@\" /cache\" @\" $INSTALL_DIR /cache\" @g" " $ML_DIR " /immich_ml/config.py
272- ln -s " ${UPLOAD_DIR:-/ opt/ immich/ upload} " " $APP_DIR " /upload
273- ln -s " ${UPLOAD_DIR:-/ opt/ immich/ upload} " " $ML_DIR " /upload
274- ln -s " $GEO_DIR " " $APP_DIR "
222+ cp " $ML_DIR " /ml_start.sh " $INSTALL_DIR "
223+ rm -rf " ${APP_DIR:? } " /*
224+ mkdir -p " $ML_DIR "
225+ rm -rf " $SRC_DIR "
275226
276- msg_info " Updating Immich CLI"
277- $STD npm install --build-from-source sharp
278- rm -rf " $APP_DIR " /node_modules/@img/sharp-{libvips* ,linuxmusl-x64}
279- $STD npm i -g @immich/cli
280- msg_ok " Updated Immich CLI"
227+ fetch_and_deploy_gh_release " immich" " immich-app/immich" " tarball" " latest" " $SRC_DIR "
281228
282- chown -R immich:immich " $INSTALL_DIR "
283- echo " $RELEASE " > /opt/" ${APP} " _version.txt
284- msg_ok " Updated ${APP} to v${RELEASE} "
229+ msg_info " Updating ${APP} web and microservices"
230+ cd " $SRC_DIR " /server
231+ if [[ " $RELEASE " == " 1.135.1" ]]; then
232+ rm ./src/schema/migrations/1750323941566-UnsetPrewarmDimParameter.ts
233+ fi
234+ $STD npm install -g node-gyp node-pre-gyp
235+ $STD npm ci
236+ $STD npm run build
237+ $STD npm prune --omit=dev --omit=optional
238+ cd " $SRC_DIR " /open-api/typescript-sdk
239+ $STD npm ci
240+ $STD npm run build
241+ cd " $SRC_DIR " /web
242+ $STD npm ci
243+ $STD npm run build
244+ cd " $SRC_DIR "
245+ cp -a server/{node_modules,dist,bin,resources,package.json,package-lock.json,start* .sh} " $APP_DIR " /
246+ cp -a web/build " $APP_DIR " /www
247+ cp LICENSE " $APP_DIR "
248+ msg_ok " Updated ${APP} web and microservices"
285249
286- msg_info " Cleaning up"
287- rm -f " $immich_zip "
288- $STD apt-get -y autoremove
289- $STD apt-get -y autoclean
290- msg_ok " Cleaned"
250+ cd " $SRC_DIR " /machine-learning
251+ export VIRTUAL_ENV=" ${ML_DIR} " /ml-venv
252+ $STD /usr/local/bin/uv venv " $VIRTUAL_ENV "
253+ if [[ -f ~ /.openvino ]]; then
254+ msg_info " Updating HW-accelerated machine-learning"
255+ /usr/local/bin/uv -q sync --extra openvino --no-cache --active
256+ patchelf --clear-execstack " ${VIRTUAL_ENV} /lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-311-x86_64-linux-gnu.so"
257+ msg_ok " Updated HW-accelerated machine-learning"
291258 else
292- msg_ok " ${APP} is already at v${RELEASE} "
259+ msg_info " Updating machine-learning"
260+ /usr/local/bin/uv -q sync --extra cpu --no-cache --active
261+ msg_ok " Updated machine-learning"
262+ fi
263+ cd " $SRC_DIR "
264+ cp -a machine-learning/{ann,immich_ml} " $ML_DIR "
265+ mv " $INSTALL_DIR " /ml_start.sh " $ML_DIR "
266+ if [[ -f ~ /.openvino ]]; then
267+ sed -i " /intra_op/s/int = 0/int = os.cpu_count() or 0/" " $ML_DIR " /immich_ml/config.py
293268 fi
269+ ln -sf " $APP_DIR " /resources " $INSTALL_DIR "
270+ cd " $APP_DIR "
271+ grep -Rl /usr/src | xargs -n1 sed -i " s|\/usr/src|$INSTALL_DIR |g"
272+ grep -RlE " '/build'" | xargs -n1 sed -i " s|'/build'|'$APP_DIR '|g"
273+ sed -i " s@\" /cache\" @\" $INSTALL_DIR /cache\" @g" " $ML_DIR " /immich_ml/config.py
274+ ln -s " ${UPLOAD_DIR:-/ opt/ immich/ upload} " " $APP_DIR " /upload
275+ ln -s " ${UPLOAD_DIR:-/ opt/ immich/ upload} " " $ML_DIR " /upload
276+ ln -s " $GEO_DIR " " $APP_DIR "
277+
278+ msg_info " Updating Immich CLI"
279+ $STD npm install --build-from-source sharp
280+ rm -rf " $APP_DIR " /node_modules/@img/sharp-{libvips* ,linuxmusl-x64}
281+ $STD npm i -g @immich/cli
282+ msg_ok " Updated Immich CLI"
283+
284+ chown -R immich:immich " $INSTALL_DIR "
285+ echo " $RELEASE " > /opt/" ${APP} " _version.txt
286+ msg_ok " Updated ${APP} to v${RELEASE} "
287+
288+ msg_info " Cleaning up"
289+ $STD apt-get -y autoremove
290+ $STD apt-get -y autoclean
291+ msg_ok " Cleaned"
294292 systemctl restart immich-ml immich-web
295293 exit
296294}
0 commit comments