Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.60 #34

Merged
merged 5 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,25 @@ parts:
| tar xJf - -C "$SNAPCRAFT_PART_INSTALL" --no-same-owner --strip-components=1
fi

python:
source: https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz
plugin: make
override-build: |
./configure --enable-optimizations --with-ensurepip=install
snapcraftctl build
build-packages:
- libssl-dev
- zlib1g-dev
- libbz2-dev
- libreadline-dev
- libsqlite3-dev
- xz-utils
- libffi-dev
stage-packages:
- libtcl8.6
- libtk8.6
- libxft2

ffmpeg:
plugin: nil
stage-packages:
Expand All @@ -206,7 +225,7 @@ parts:
plugin: npm
npm-node-version: "18.16.0"
source: https://github.com/immich-app/immich.git
source-tag: v1.57.1
source-tag: v1.60.0
source-subdir: server
override-build: |
snapcraftctl set-version "$(git describe --tags)-dist1"
Expand All @@ -233,7 +252,7 @@ parts:
plugin: npm
npm-node-version: "18.16.0"
source: https://github.com/immich-app/immich.git
source-tag: v1.57.1
source-tag: v1.60.0
source-subdir: web
override-build: |
patch -p0 -i $SNAPCRAFT_PART_SRC/../../patches/src/001-version-announcement-box.patch -d $SNAPCRAFT_PART_BUILD
Expand All @@ -250,28 +269,27 @@ parts:
- patches

machine-learning:
plugin: python
plugin: nil
source: https://github.com/immich-app/immich.git
source-tag: v1.57.1
source-tag: v1.60.0
source-subdir: machine-learning
build-environment:
- SNAPCRAFT_PYTHON_VENV_INTERP_PATH: /root/parts/machine-learning/install/bin/python3
override-build: |
snapcraftctl build
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install transformers tqdm numpy scikit-learn scipy nltk sentencepiece fastapi Pillow uvicorn[standard]
pip install --no-deps sentence-transformers
pip install insightface onnxruntime
../../python/install/usr/local/bin/python3 ../../python/install/usr/local/bin/pip3 install --target $SNAPCRAFT_PART_INSTALL/opt/piptarget torch --index-url https://download.pytorch.org/whl/cpu
../../python/install/usr/local/bin/python3 ../../python/install/usr/local/bin/pip3 install --target $SNAPCRAFT_PART_INSTALL/opt/piptarget transformers tqdm numpy scikit-learn scipy nltk sentencepiece fastapi Pillow uvicorn[standard]
../../python/install/usr/local/bin/python3 ../../python/install/usr/local/bin/pip3 install --target $SNAPCRAFT_PART_INSTALL/opt/piptarget --no-deps sentence-transformers
../../python/install/usr/local/bin/python3 ../../python/install/usr/local/bin/pip3 install --target $SNAPCRAFT_PART_INSTALL/opt/piptarget insightface onnxruntime
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/src/ml
cp -r machine-learning/src $SNAPCRAFT_PART_INSTALL/usr/src/ml
stage-packages:
- libgomp1
after:
- python

cli:
plugin: npm
npm-node-version: "18.16.0"
source: https://github.com/immich-app/CLI.git
source-tag: v0.36.0
source-tag: v0.37.0
override-build: |
npm install
npm run build
Expand Down
4 changes: 2 additions & 2 deletions src/bin/immich-machine-learning
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash

. $SNAP/bin/load-env
. $SNAP/bin/activate

export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1
export PYTHONPATH="$SNAP/opt/piptarget"
export MACHINE_LEARNING_CACHE_FOLDER="$SNAP_COMMON/cache"

banner

cd $SNAP/usr/src/ml
python3 $SNAP/usr/src/ml/src/main.py | grep -v "GET /ping"
$SNAP/usr/local/bin/python3 $SNAP/usr/src/ml/src/main.py | grep -v "GET /ping"
12 changes: 12 additions & 0 deletions src/bin/sync-created-watch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ block_immich_server_ready
watch_created() {
cat - | while read -r changed_path; do
if ! ignore_path "$changed_path"; then

init_file_size="$(stat --printf="%s" "$changed_path")"
while true; do
sleep 1
current_file_size="$(stat --printf="%s" "$changed_path")"
if [ "$init_file_size" -eq "$current_file_size" ]; then
break
else
init_file_size="$current_file_size"
fi
done

file_hash="$(sha1sum "$changed_path")"
file_hash="${file_hash% *}"
user_id="$(extract_user_id_from_path "$changed_path")"
Expand Down
2 changes: 1 addition & 1 deletion src/bin/sync-removed-watch
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ watch_removed() {
continue
fi

if ! immich_api "$KEY" "/asset/assetById/$asset_id" | jq -e .id > /dev/null; then
if ! immich_api "$KEY" "asset/assetById/$asset_id" | jq -e .id > /dev/null; then
echo "Asset $asset_id not found in Immich (user $user_id, path $path)"
continue
fi
Expand Down
1 change: 1 addition & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ else
fi

CHECK_FILES="
server/libs/infra/src/migrations
server/Dockerfile
server/start-server.sh
server/start-microservices.sh
Expand Down