immich是一个更新较快的开源软件,因为他包含自己附带了4个容器运行,今天单独讲下他的部署。以群晖为例,其他nas类似。
官网:https://immich.app/
体验网址:https://demo.immich.app/
(体验那里点login as demo user)
因为是4个关联容器,
其中postgres和redis都是数据库相关容器,machine_learning是机器学习容器,server是服务容器,建议用docker-compose部署。
当前版本号:1.107.2
在群晖docker文件夹下新建immich文件夹,后面的文件都放这里
docker-compose.yml文件和环境变量文件.env在根目录
硬件减速的2个文件hwaccel.ml.yml、hwaccel.transcoding.yml也在根目录
cache文件夹里是两个大模型clip文件夹下的XLM-Roberta-Large-Vit-B-16Plus用以文搜图,facial-recognition文件夹下的antelopev2或buffalo_l用于人脸识别(支持的CLIP模型名称列表详见,huggingface国内镜像站:https://hf-mirror.com/immich-app,也可以自己下载需要的模型)
我都打包到了123网盘,docker-compose.yml和.env文件内我都注释了参数用法:
docker-compose.yml也可以直接复制下面的:
#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#
#原版英文注释我没删除,也可以参考
name: immich
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
# extends:
# file: hwaccel.transcoding.yml
# service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
volumes:
#服务网页上上传的图片存储目录映射
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
env_file:
- .env
#服务网页端口号2283,可以自己改
ports:
- 2283:3001
depends_on:
- redis
- database
immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
#需要GPU硬件加速的话,下面的image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}改为image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda,因为我没有独显,没试
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
#这里是机器学习GPU硬件加速的扩展参数设置
# extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
#硬件加速下面file: hwaccel.ml.yml要取消注释,同时immich文件夹要包含这个文件
# file: hwaccel.ml.yml
#需要加速的下面改为service:openvino,不要注释掉
# service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
#机器学习大模型存储目录映射
volumes:
- ${CACHE_LOCATION}:/cache
env_file:
- .env
restart: always
redis:
container_name: immich_redis
image: docker.io/redis:6.2-alpine@sha256:328fe6a5822256d065debb36617a8169dbfbd77b797c525288e465f56c1d392b
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
#数据库密码、用户名、数据库名环境变量设置
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
#数据库存储目录映射
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
healthcheck:
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
interval: 5m
start_period: 5m
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"]
restart: always
.env为
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
#这里UPLOAD_LOCATION是immich上传的图片存储目录
UPLOAD_LOCATION=/volume1/docker/immich/library
# The location where your database files are stored
#DB_DATA_LOCATION是数据库文件存储目录
DB_DATA_LOCATION=/volume1/docker/immich/postgres
#CACHE_LOCATION是大模型文件存储目录
CACHE_LOCATION=/volume1/docker/immich/cache
# 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
TZ=Etc/UTC
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
#immich版本号,不用管
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
#数据库密码,内网不用管,连外网了自己可以改下
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
#数据库用户名,内网不用管,连外网了自己可以改下
DB_USERNAME=postgres
#数据库名,内网不用管,连外网了自己可以改下
DB_DATABASE_NAME=immich
群晖内新建文件夹的结构如下:
在我的电脑里输入ip通过smb协议更方便大批量传输文件,群辉内的smb服务要打开
群晖内container manager内项目内开始部署,启动后4个容器运行都是绿色的话一般问题不大,等几分钟后再ip:2283登录,正常用邮箱作为用户名登录注册登录
登录页面右上角的图标点进去,先把语言设置成中文
在管理-设置-机器学习下把CLIP模型改成支持中文的XLM-Roberta-Large-Vit-B-16Plus(默认的ViT-B-32__openai不支持中文),保存
人脸识别模型也可以自己选刚才的2个中的1个,默认就行
随便上传了几张图片试了下,感觉还好,这种功能就是方便自己找照片时候方便
另外在外部图库里可以添加自己已有的照片文件夹
相册照片归档的模板这个自己需要设置下,我一般是用这种格式,按年月分类。
其他的设置自己探索下吧。
文章评论