Skip to content

Commit 8a49223

Browse files
committed
add py-immich example
1 parent 3592749 commit 8a49223

File tree

9 files changed

+514
-0
lines changed

9 files changed

+514
-0
lines changed

testapps/py-immich/.env

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
2+
3+
# The location where your uploaded files are stored
4+
UPLOAD_LOCATION=./library
5+
# The location where your database files are stored
6+
DB_DATA_LOCATION=./postgres
7+
8+
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
9+
# TZ=Etc/UTC
10+
11+
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
12+
IMMICH_VERSION=release
13+
14+
# Connection secret for postgres. You should change it to a random password
15+
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
16+
DB_PASSWORD=postgres
17+
18+
# The values below this line do not need to be changed
19+
###################################################################################
20+
DB_USERNAME=postgres
21+
DB_DATABASE_NAME=immich

testapps/py-immich/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
library/
2+
postgres

testapps/py-immich/docker-compose.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#
2+
# WARNING: Make sure to use the docker-compose.yml of the current release:
3+
#
4+
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
5+
#
6+
# The compose file on main may not be compatible with the latest release.
7+
#
8+
9+
name: immich
10+
11+
services:
12+
immich-server:
13+
container_name: immich_server
14+
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
15+
# extends:
16+
# file: hwaccel.transcoding.yml
17+
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
18+
volumes:
19+
# Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
20+
- ${UPLOAD_LOCATION}:/usr/src/app/upload
21+
- /etc/localtime:/etc/localtime:ro
22+
env_file:
23+
- .env
24+
ports:
25+
- '2283:2283'
26+
depends_on:
27+
- redis
28+
- database
29+
restart: always
30+
healthcheck:
31+
disable: false
32+
33+
immich-machine-learning:
34+
container_name: immich_machine_learning
35+
# For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
36+
# Example tag: ${IMMICH_VERSION:-release}-cuda
37+
# image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
38+
build:
39+
dockerfile: immich_machine_learning.dockerfile
40+
context: .
41+
# extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
42+
# file: hwaccel.ml.yml
43+
# service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
44+
volumes:
45+
- model-cache:/cache
46+
env_file:
47+
- .env
48+
restart: always
49+
healthcheck:
50+
disable: false
51+
52+
redis:
53+
container_name: immich_redis
54+
image: docker.io/redis:6.2-alpine@sha256:2ba50e1ac3a0ea17b736ce9db2b0a9f6f8b85d4c27d5f5accc6a416d8f42c6d5
55+
healthcheck:
56+
test: redis-cli ping || exit 1
57+
restart: always
58+
59+
database:
60+
container_name: immich_postgres
61+
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
62+
environment:
63+
POSTGRES_PASSWORD: ${DB_PASSWORD}
64+
POSTGRES_USER: ${DB_USERNAME}
65+
POSTGRES_DB: ${DB_DATABASE_NAME}
66+
POSTGRES_INITDB_ARGS: '--data-checksums'
67+
volumes:
68+
# Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
69+
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
70+
healthcheck:
71+
test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
72+
interval: 5m
73+
start_interval: 30s
74+
start_period: 5m
75+
command: [ 'postgres', '-c', 'shared_preload_libraries=vectors.so', '-c', 'search_path="$$user", public, vectors', '-c', 'logging_collector=on', '-c', 'max_wal_size=2GB', '-c', 'shared_buffers=512MB', '-c', 'wal_compression=on' ]
76+
restart: always
77+
78+
# add pinpoint-collector-agent
79+
dev-collector:
80+
restart: always
81+
image: ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:0.7
82+
83+
environment:
84+
- PP_COLLECTOR_AGENT_SPAN_IP=dev-pinpoint
85+
- PP_COLLECTOR_AGENT_SPAN_PORT=9993
86+
- PP_COLLECTOR_AGENT_AGENT_IP=dev-pinpoint
87+
- PP_COLLECTOR_AGENT_AGENT_PORT=9991
88+
- PP_COLLECTOR_AGENT_STAT_IP=dev-pinpoint
89+
- PP_COLLECTOR_AGENT_STAT_PORT=9992
90+
- PP_COLLECTOR_AGENT_ISDOCKER=true
91+
- PP_Log_Level=DEBUG
92+
- PP_ADDRESS=0.0.0.0@10000
93+
volumes:
94+
- /etc/hosts:/etc/hosts
95+
96+
volumes:
97+
model-cache:

testapps/py-immich/hwaccel.ml.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Configurations for hardware-accelerated machine learning
2+
3+
# If using Unraid or another platform that doesn't allow multiple Compose files,
4+
# you can inline the config for a backend by copying its contents
5+
# into the immich-machine-learning service in the docker-compose.yml file.
6+
7+
# See https://immich.app/docs/features/ml-hardware-acceleration for info on usage.
8+
9+
services:
10+
armnn:
11+
devices:
12+
- /dev/mali0:/dev/mali0
13+
volumes:
14+
- /lib/firmware/mali_csffw.bin:/lib/firmware/mali_csffw.bin:ro # Mali firmware for your chipset (not always required depending on the driver)
15+
- /usr/lib/libmali.so:/usr/lib/libmali.so:ro # Mali driver for your chipset (always required)
16+
17+
cpu: {}
18+
19+
cuda:
20+
deploy:
21+
resources:
22+
reservations:
23+
devices:
24+
- driver: nvidia
25+
count: 1
26+
capabilities:
27+
- gpu
28+
29+
openvino:
30+
device_cgroup_rules:
31+
- 'c 189:* rmw'
32+
devices:
33+
- /dev/dri:/dev/dri
34+
volumes:
35+
- /dev/bus/usb:/dev/bus/usb
36+
37+
openvino-wsl:
38+
devices:
39+
- /dev/dri:/dev/dri
40+
- /dev/dxg:/dev/dxg
41+
volumes:
42+
- /dev/bus/usb:/dev/bus/usb
43+
- /usr/lib/wsl:/usr/lib/wsl
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Configurations for hardware-accelerated transcoding
2+
3+
# If using Unraid or another platform that doesn't allow multiple Compose files,
4+
# you can inline the config for a backend by copying its contents
5+
# into the immich-microservices service in the docker-compose.yml file.
6+
7+
# See https://immich.app/docs/features/hardware-transcoding for more info on using hardware transcoding.
8+
9+
services:
10+
cpu: {}
11+
12+
nvenc:
13+
deploy:
14+
resources:
15+
reservations:
16+
devices:
17+
- driver: nvidia
18+
count: 1
19+
capabilities:
20+
- gpu
21+
- compute
22+
- video
23+
24+
quicksync:
25+
devices:
26+
- /dev/dri:/dev/dri
27+
28+
rkmpp:
29+
security_opt: # enables full access to /sys and /proc, still far better than privileged: true
30+
- systempaths=unconfined
31+
- apparmor=unconfined
32+
group_add:
33+
- video
34+
devices:
35+
- /dev/rga:/dev/rga
36+
- /dev/dri:/dev/dri
37+
- /dev/dma_heap:/dev/dma_heap
38+
- /dev/mpp_service:/dev/mpp_service
39+
#- /dev/mali0:/dev/mali0 # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
40+
volumes:
41+
#- /etc/OpenCL:/etc/OpenCL:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
42+
#- /usr/lib/aarch64-linux-gnu/libmali.so.1:/usr/lib/aarch64-linux-gnu/libmali.so.1:ro # only required to enable OpenCL-accelerated HDR -> SDR tonemapping
43+
44+
vaapi:
45+
devices:
46+
- /dev/dri:/dev/dri
47+
48+
vaapi-wsl: # use this for VAAPI if you're running Immich in WSL2
49+
devices:
50+
- /dev/dri:/dev/dri
51+
volumes:
52+
- /usr/lib/wsl:/usr/lib/wsl
53+
environment:
54+
- LIBVA_DRIVER_NAME=d3d12

testapps/py-immich/image.png

66.6 KB
Loading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
2+
3+
# RUN apt update && apt install -y gcc g++
4+
# COPY pinpointpy-1.4.0.tar.gz /usr/src/app/pinpointpy-1.4.0.tar.gz
5+
# RUN pip install /usr/src/app/pinpointpy-1.4.0.tar.gz
6+
RUN pip install starlette-context && pip install starlette
7+
RUN pip install -i https://test.pypi.org/simple/ pinpointPy==1.4.0
8+
COPY main.py /usr/src/app/main.py

0 commit comments

Comments
 (0)