Skip to content

Commit

Permalink
Merge pull request #38 from nsg/v1.61
Browse files Browse the repository at this point in the history
Bump to 1.61
  • Loading branch information
nsg committed Jun 22, 2023
2 parents 28a5ff6 + 20e7d99 commit 835d670
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 28 deletions.
9 changes: 9 additions & 0 deletions parts/machine-learning/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

build:
./build.sh v1.61.0

install:
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/src/ml
mkdir -p ${SNAPCRAFT_PART_INSTALL}/opt/venv
cp -r immich/machine-learning/app ${SNAPCRAFT_PART_INSTALL}/usr/src/ml
cp -r /opt/venv/ml ${SNAPCRAFT_PART_INSTALL}/opt/venv
30 changes: 30 additions & 0 deletions parts/machine-learning/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

VERSION="$1"
PYTHON_PART_INSTALL_BIN="${PWD}/../../python/install/usr/local/bin"

mkdir -p /opt/venv/

python() {
$PYTHON_PART_INSTALL_BIN/python3 $@
}

pip() {
python $PYTHON_PART_INSTALL_BIN/pip3 $@
}

[ -d immich ] || git clone --branch $VERSION https://github.com/immich-app/immich.git
[ -d "/opt/venv/ml" ] || python -m venv "/opt/venv/ml"
[ -d "/opt/venv/poetry" ] || python -m venv "/opt/venv/poetry"

/opt/venv/poetry/bin/python --version
/opt/venv/poetry/bin/pip install poetry

# Configure Poetry and install dependencies
cd immich/machine-learning

export VIRTUAL_ENV="/opt/venv/ml"
/opt/venv/poetry/bin/poetry config installer.max-workers 10
/opt/venv/poetry/bin/poetry config virtualenvs.create false
/opt/venv/poetry/bin/poetry install --sync --no-interaction --no-ansi --no-root --only main
unset VIRTUAL_ENV
33 changes: 19 additions & 14 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ parts:
fi
python:
source: https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz
source: https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
plugin: make
override-build: |
./configure --enable-optimizations --with-ensurepip=install
Expand All @@ -185,6 +185,9 @@ parts:
- libsqlite3-dev
- xz-utils
- libffi-dev
- libncurses5-dev
- libgdbm-dev
- libnss3-dev
stage-packages:
- libtcl8.6
- libtk8.6
Expand All @@ -198,6 +201,9 @@ parts:
- freeglut3
- libpulse0
- libslang2
stage:
- -usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
- -usr/share/doc
prime:
- -usr/share/doc
- -usr/share/man
Expand All @@ -207,7 +213,7 @@ parts:
plugin: npm
npm-node-version: "18.16.0"
source: https://github.com/immich-app/immich.git
source-tag: v1.60.0
source-tag: v1.61.0
source-subdir: server
override-build: |
snapcraftctl set-version "$(git describe --tags)-dist1"
Expand All @@ -219,22 +225,28 @@ parts:
cp -r node_modules $SNAPCRAFT_PART_INSTALL/usr/src/app
cp -r dist $SNAPCRAFT_PART_INSTALL/usr/src/app
cp -r bin $SNAPCRAFT_PART_INSTALL/usr/src/app
cp package.json $SNAPCRAFT_PART_INSTALL/usr/src/app
cp start-server.sh start-microservices.sh $SNAPCRAFT_PART_INSTALL/usr/src/app
build-packages:
- libraw-dev
- libvips-dev
stage-packages:
- libc-ares2
- libicu66
- libnghttp2-14
- libnode64
- libuv1
- libvips
- imagemagick
- libraw19
after:
- node

web:
plugin: npm
npm-node-version: "18.16.0"
source: https://github.com/immich-app/immich.git
source-tag: v1.60.0
source-tag: v1.61.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 @@ -251,17 +263,10 @@ parts:
- patches

machine-learning:
plugin: nil
source: https://github.com/immich-app/immich.git
source-tag: v1.60.0
source-subdir: machine-learning
override-build: |
../../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
plugin: make
source: parts/machine-learning
build-packages:
- git
stage-packages:
- libgomp1
after:
Expand Down
6 changes: 2 additions & 4 deletions src/bin/immich-machine-learning
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

export PYTHONDONTWRITEBYTECODE=1
export PYTHONUNBUFFERED=1
export PYTHONPATH="$SNAP/opt/piptarget"
export PYTHONPATH="$SNAP/opt/venv/ml/lib/python3.11/site-packages/"
export MACHINE_LEARNING_CACHE_FOLDER="$SNAP_COMMON/cache"

banner

cd $SNAP/usr/src/ml
$SNAP/usr/local/bin/python3 $SNAP/usr/src/ml/src/main.py | grep -v "GET /ping"
$SNAP/usr/local/bin/python3 $SNAP/usr/src/ml/app/main.py | grep -v "GET /ping"
2 changes: 1 addition & 1 deletion src/bin/immich-microservices
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ fi
banner

cd $SNAP/usr/src/app
node dist/apps/microservices/apps/microservices/src/main
node dist/main microservices
8 changes: 1 addition & 7 deletions src/bin/immich-server
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@ fi
banner

cd $SNAP/usr/src/app
node dist/apps/immich/apps/immich/src/main

# #DB_PORT: 5432
# # REDIS_PORT=6379
# # REDIS_DBINDEX=0
# # REDIS_PASSWORD=
# # REDIS_SOCKET=
node dist/main immich
3 changes: 1 addition & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ else
fi

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

0 comments on commit 835d670

Please sign in to comment.