mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
64
ct/immich.sh
64
ct/immich.sh
@@ -52,9 +52,7 @@ Package: *
|
||||
Pin:release a=testing
|
||||
Pin-Priority: 450
|
||||
EOF
|
||||
if [[ -f /etc/apt/preferences.d/immich ]]; then
|
||||
rm /etc/apt/preferences.d/immich
|
||||
fi
|
||||
[[ -f /etc/apt/preferences.d/immich ]] && rm /etc/apt/preferences.d/immich
|
||||
$STD apt update
|
||||
msg_ok "Added Debian Testing repo"
|
||||
fi
|
||||
@@ -117,7 +115,7 @@ EOF
|
||||
if [[ $(cat ~/.immich) > "2.5.1" ]]; then
|
||||
msg_info "Enabling Maintenance Mode"
|
||||
cd /opt/immich/app/bin
|
||||
$STD bash ./immich-admin enable-maintenance-mode
|
||||
$STD ./immich-admin enable-maintenance-mode
|
||||
export MAINT_MODE=1
|
||||
$STD cd -
|
||||
msg_ok "Enabled Maintenance Mode"
|
||||
@@ -127,18 +125,14 @@ EOF
|
||||
systemctl stop immich-ml
|
||||
msg_ok "Stopped Services"
|
||||
VCHORD_RELEASE="0.5.3"
|
||||
if [[ ! -f ~/.vchord_version ]] || [[ "$VCHORD_RELEASE" != "$(cat ~/.vchord_version)" ]]; then
|
||||
msg_info "Upgrading VectorChord"
|
||||
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
|
||||
[[ -f ~/.vchord_version ]] && mv ~/.vchord_version ~/.vectorchord
|
||||
if check_for_gh_release "VectorChord" "tensorchord/VectorChord" "${VCHORD_RELEASE}"; then
|
||||
fetch_and_deploy_gh_release "VectorChord" "tensorchord/VectorChord" "binary" "${VCHORD_RELEASE}" "/tmp" "postgresql-16-vchord_*_amd64.deb"
|
||||
systemctl restart postgresql
|
||||
$STD sudo -u postgres psql -d immich -c "ALTER EXTENSION vector UPDATE;"
|
||||
$STD sudo -u postgres psql -d immich -c "ALTER EXTENSION vchord UPDATE;"
|
||||
$STD sudo -u postgres psql -d immich -c "REINDEX INDEX face_index;"
|
||||
$STD sudo -u postgres psql -d immich -c "REINDEX INDEX clip_index;"
|
||||
echo "$VCHORD_RELEASE" >~/.vchord_version
|
||||
rm ./vchord.deb
|
||||
msg_ok "Upgraded VectorChord to v${VCHORD_RELEASE}"
|
||||
fi
|
||||
if ! dpkg -l | grep -q ccache; then
|
||||
$STD apt install -yqq ccache
|
||||
@@ -152,7 +146,7 @@ EOF
|
||||
ML_DIR="${APP_DIR}/machine-learning"
|
||||
GEO_DIR="${INSTALL_DIR}/geodata"
|
||||
|
||||
cp "$ML_DIR"/ml_start.sh "$INSTALL_DIR"
|
||||
[[ -f "$ML_DIR"/ml_start.sh ]] && cp "$ML_DIR"/ml_start.sh "$INSTALL_DIR"
|
||||
if grep -qs "set -a" "$APP_DIR"/bin/start.sh; then
|
||||
cp "$APP_DIR"/bin/start.sh "$INSTALL_DIR"
|
||||
else
|
||||
@@ -188,7 +182,7 @@ EOF
|
||||
export SHARP_FORCE_GLOBAL_LIBVIPS=true
|
||||
$STD pnpm --filter immich --frozen-lockfile --prod --no-optional deploy "$APP_DIR"
|
||||
cp "$APP_DIR"/package.json "$APP_DIR"/bin
|
||||
sed -i 's|^start|./start|' "$APP_DIR"/bin/immich-admin
|
||||
sed -i "s|^start|${APP_DIR}/bin/start|" "$APP_DIR"/bin/immich-admin
|
||||
|
||||
# openapi & web build
|
||||
cd "$SRC_DIR"
|
||||
@@ -204,8 +198,7 @@ EOF
|
||||
$STD pnpm --filter @immich/sdk --filter @immich/cli --frozen-lockfile install
|
||||
$STD pnpm --filter @immich/sdk --filter @immich/cli build
|
||||
$STD pnpm --filter @immich/cli --prod --no-optional deploy "$APP_DIR"/cli
|
||||
cd "$APP_DIR"
|
||||
mv "$INSTALL_DIR"/start.sh "$APP_DIR"/bin
|
||||
[[ -f "$INSTALL_DIR"/start.sh ]] && mv "$INSTALL_DIR"/start.sh "$APP_DIR"/bin
|
||||
|
||||
# plugins
|
||||
cd "$SRC_DIR"
|
||||
@@ -236,10 +229,8 @@ EOF
|
||||
fi
|
||||
cd "$SRC_DIR"
|
||||
cp -a machine-learning/{ann,immich_ml} "$ML_DIR"
|
||||
mv "$INSTALL_DIR"/ml_start.sh "$ML_DIR"
|
||||
if [[ -f ~/.openvino ]]; then
|
||||
sed -i "/intra_op/s/int = 0/int = os.cpu_count() or 0/" "$ML_DIR"/immich_ml/config.py
|
||||
fi
|
||||
[[ -f "$INSTALL_DIR"/ml_start.sh ]] && mv "$INSTALL_DIR"/ml_start.sh "$ML_DIR"
|
||||
[[ -f ~/.openvino ]] && sed -i "/intra_op/s/int = 0/int = os.cpu_count() or 0/" "$ML_DIR"/immich_ml/config.py
|
||||
ln -sf "$APP_DIR"/resources "$INSTALL_DIR"
|
||||
cd "$APP_DIR"
|
||||
grep -rl /usr/src | xargs -n1 sed -i "s|\/usr/src|$INSTALL_DIR|g"
|
||||
@@ -248,18 +239,39 @@ EOF
|
||||
ln -s "${UPLOAD_DIR:-/opt/immich/upload}" "$APP_DIR"/upload
|
||||
ln -s "${UPLOAD_DIR:-/opt/immich/upload}" "$ML_DIR"/upload
|
||||
ln -s "$GEO_DIR" "$APP_DIR"
|
||||
[[ ! -f /usr/bin/immich ]] && ln -sf "$APP_DIR"/cli/bin/immich /usr/bin/immich
|
||||
[[ ! -f /usr/bin/immich-admin ]] && ln -sf "$APP_DIR"/bin/immich-admin /usr/bin/immich-admin
|
||||
|
||||
chown -R immich:immich "$INSTALL_DIR"
|
||||
if [[ "${MAINT_MODE:-0}" == 1 ]]; then
|
||||
msg_info "Disabling Maintenance Mode"
|
||||
cd /opt/immich/app/bin
|
||||
$STD bash ./immich-admin disable-maintenance-mode
|
||||
$STD ./immich-admin disable-maintenance-mode
|
||||
unset MAINT_MODE
|
||||
$STD cd -
|
||||
msg_ok "Disabled Maintenance Mode"
|
||||
fi
|
||||
systemctl restart immich-ml immich-web
|
||||
msg_ok "Updated successfully!"
|
||||
msg_info "Checking health of Immich-web & Immich-ml services"
|
||||
sleep 5
|
||||
web=0
|
||||
until curl -fs localhost:2283/api/server/ping | grep -q "pong" || [[ $web -gt 1 ]]; do
|
||||
msg_warn "Problem detected with Immich-web service, restarting..."
|
||||
systemctl restart immich-web && sleep 5
|
||||
[[ $(curl -fs localhost:2283/api/server/ping | grep "pong") ]] && break
|
||||
((web++))
|
||||
done
|
||||
[[ $web -lt 1 ]] && msg_ok "Immich-web service is reachable!" || msg_error "Please check '/var/log/immich/web.log' for more details"
|
||||
|
||||
ml=0
|
||||
until [[ $(curl -fs localhost:3003/ping) == "pong" ]] || [[ $ml -gt 1 ]]; do
|
||||
msg_warn "Problem detected with Immich-ml service, restarting..."
|
||||
systemctl restart immich-ml && sleep 5
|
||||
[[ $(curl -fs localhost:3003/ping) == "pong" ]] && break
|
||||
((ml++))
|
||||
done
|
||||
[[ $ml -lt 1 ]] && msg_ok "Immich-ml service is reachable!" || msg_error "Please check '/var/log/immich/ml.log' for more details"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
@@ -271,7 +283,7 @@ function compile_libjxl() {
|
||||
: "${LIBJXL_REVISION:=$(jq -cr '.revision' "$BASE_DIR"/server/sources/libjxl.json)}"
|
||||
if [[ "$LIBJXL_REVISION" != "$(grep 'libjxl' ~/.immich_library_revisions | awk '{print $2}')" ]]; then
|
||||
msg_info "Recompiling libjxl"
|
||||
if [[ -d "$SOURCE" ]]; then rm -rf "$SOURCE"; fi
|
||||
[[ -d "$SOURCE" ]] && rm -rf "$SOURCE"
|
||||
$STD git clone https://github.com/libjxl/libjxl.git "$SOURCE"
|
||||
cd "$SOURCE"
|
||||
$STD git reset --hard "$LIBJXL_REVISION"
|
||||
@@ -318,7 +330,7 @@ function compile_libheif() {
|
||||
: "${LIBHEIF_REVISION:=$(jq -cr '.revision' "$BASE_DIR"/server/sources/libheif.json)}"
|
||||
if [[ "${update:-}" ]] || [[ "$LIBHEIF_REVISION" != "$(grep 'libheif' ~/.immich_library_revisions | awk '{print $2}')" ]]; then
|
||||
msg_info "Recompiling libheif"
|
||||
if [[ -d "$SOURCE" ]]; then rm -rf "$SOURCE"; fi
|
||||
[[ -d "$SOURCE" ]] && rm -rf "$SOURCE"
|
||||
$STD git clone https://github.com/strukturag/libheif.git "$SOURCE"
|
||||
cd "$SOURCE"
|
||||
$STD git reset --hard "$LIBHEIF_REVISION"
|
||||
@@ -334,7 +346,7 @@ function compile_libheif() {
|
||||
-DWITH_X265=OFF \
|
||||
-DWITH_EXAMPLES=OFF \
|
||||
..
|
||||
$STD make install -j "$(nproc)"
|
||||
$STD make install -j"$(nproc)"
|
||||
ldconfig /usr/local/lib
|
||||
$STD make clean
|
||||
cd "$STAGING_DIR"
|
||||
@@ -349,7 +361,7 @@ function compile_libraw() {
|
||||
: "${LIBRAW_REVISION:=$(jq -cr '.revision' "$BASE_DIR"/server/sources/libraw.json)}"
|
||||
if [[ "$LIBRAW_REVISION" != "$(grep 'libraw' ~/.immich_library_revisions | awk '{print $2}')" ]]; then
|
||||
msg_info "Recompiling libraw"
|
||||
if [[ -d "$SOURCE" ]]; then rm -rf "$SOURCE"; fi
|
||||
[[ -d "$SOURCE" ]] && rm -rf "$SOURCE"
|
||||
$STD git clone https://github.com/libraw/libraw.git "$SOURCE"
|
||||
cd "$SOURCE"
|
||||
$STD git reset --hard "$LIBRAW_REVISION"
|
||||
@@ -371,7 +383,7 @@ function compile_imagemagick() {
|
||||
if [[ "$IMAGEMAGICK_REVISION" != "$(grep 'imagemagick' ~/.immich_library_revisions | awk '{print $2}')" ]] ||
|
||||
! grep -q 'DMAGICK_LIBRAW' /usr/local/lib/ImageMagick-7*/config-Q16HDRI/configure.xml; then
|
||||
msg_info "Recompiling ImageMagick"
|
||||
if [[ -d "$SOURCE" ]]; then rm -rf "$SOURCE"; fi
|
||||
[[ -d "$SOURCE" ]] && rm -rf "$SOURCE"
|
||||
$STD git clone https://github.com/ImageMagick/ImageMagick.git "$SOURCE"
|
||||
cd "$SOURCE"
|
||||
$STD git reset --hard "$IMAGEMAGICK_REVISION"
|
||||
@@ -391,7 +403,7 @@ function compile_libvips() {
|
||||
: "${LIBVIPS_REVISION:=$(jq -cr '.revision' "$BASE_DIR"/server/sources/libvips.json)}"
|
||||
if [[ "$LIBVIPS_REVISION" != "$(grep 'libvips' ~/.immich_library_revisions | awk '{print $2}')" ]]; then
|
||||
msg_info "Recompiling libvips"
|
||||
if [[ -d "$SOURCE" ]]; then rm -rf "$SOURCE"; fi
|
||||
[[ -d "$SOURCE" ]] && rm -rf "$SOURCE"
|
||||
$STD git clone https://github.com/libvips/libvips.git "$SOURCE"
|
||||
cd "$SOURCE"
|
||||
$STD git reset --hard "$LIBVIPS_REVISION"
|
||||
|
||||
Reference in New Issue
Block a user