DXP4800部署immich服务
编辑
11
2025-10-20
immich终于1.0了,在nas上部署了,没什么大的问题就不动,尽量也不要升级。
目录结构
DXP4800只支持使用compose部署项目,所以需要用到ssh连接终端来部署基本的目录结构。
immich
├── docker-compose.yaml #compose文件
├── .env #配置环境变量
├── geodata #反向地理编码汉化
├── hwaccel.ml.yml #硬件
├── hwaccel.transcoding.yml #硬件
├── i18n-iso-countries #反向地理编码汉化
├── library #相册文件
├── model-cache #机器学习模型文件
└── postgres #数据库
DXP4800部署
配置 .env
基本上没有什么配置的,如有需要改一下数据库密码什么的。
# You can find documentation for all the supported env variables at https://docs.immich.app/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres
# 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
TZ=Asia/Shanghai
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
# 这里可以随机一下密码加强一下安全性,可以用`openssl rand -hex 32`生成
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
N100硬解
下载2个文件
wget https://raw.githubusercontent.com/immich-app/immich/main/docker/hwaccel.transcoding.yml
wget https://raw.githubusercontent.com/immich-app/immich/main/docker/hwaccel.ml.yml
机器学习
大模型比较大,一般都是几个g的,官方的托管中抱脸,默认可以不需要提前下载,前提是你的网络能访问到抱脸。如果不能,可以利用git lfs提前下载。
- 安装git-lfs
apt install git-lfs - 克隆到模型目录
cd ./model-cache/clip #大模型目录,最好是挂载出来。
git clone https://huggingface.co/immich-app/XLM-Roberta-Large-Vit-B-16Plus
我们使用官方提供的 XLM-Roberta-Large-Vit-B-16Plus可以比较好的识别中文,也有其他更好的方案,但是太麻烦了,我自己适用了一下,这个模型就可以基本的识别到了。
反向地理编码汉化
默认的情况下城市都是英文的,有大佬做了修改,感谢大佬。
ZingLix/immich-geodata-cn: 为 Immich 提供中文反向地理编码支持,将照片拍摄地点转换为熟悉的中文名称,并支持通过中文地名搜索照片
- 在releases中下载
geodata.zip和i18n-iso-countries.zip - 分别解压到项目目录下的
geodata和i18n-iso-countries文件夹
docker-compose.yaml 文件
汇总了上面的功能
#
# WARNING: To install Immich, follow our guide: https://docs.immich.app/install/docker-compose
#
# 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:
# 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
- ${UPLOAD_LOCATION}:/data
- /etc/localtime:/etc/localtime:ro
- /volume2/dockerfiles/immich/pictures:/pictures #外部存储挂载卷
- ./geodata:/build/geodata #地理反向编码挂载卷
- ./i18n-iso-countries:/usr/src/app/node_modules/i18n-iso-countries #地理反向编码挂载卷
env_file:
- .env
extends:
file: hwaccel.transcoding.yml
service: quicksync
ports:
- '2283:2283'
depends_on:
- redis
- database
restart: always
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning
# For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
# Example tag: ${IMMICH_VERSION:-release}-cuda
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-openvino
extends: # uncomment this section for hardware acceleration - see https://docs.immich.app/features/ml-hardware-acceleration
file: hwaccel.ml.yml
service: openvino # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
volumes:
- ./model-cache:/cache #大模型挂载卷
env_file:
- .env
restart: always
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/valkey/valkey:8-bookworm@sha256:fea8b3e67b15729d4bb70589eb03367bab9ad1ee89c876f54327fc7c6e618571
healthcheck:
test: redis-cli ping || exit 1
restart: always
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:41eacbe83eca995561fe43814fd4891e16e39632806253848efaf04d3c8a8b84
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: '--data-checksums'
# Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
# DB_STORAGE_TYPE: 'HDD'
volumes:
# 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
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
shm_size: 128mb
restart: always
# volumes:
# model-cache:
Immich 使用
配置机器学习
- 打开web端,点击头像,系统设置
- 修改CLIP模型为
XLM-Roberta-Large-Vit-B-16Plus - 任务,智能搜索-全部

配置外部存储
- 点击头像,系统管理,外部图库
- 创建图库,选择所有者,输入路径

Enjoy
玩的开心~
- 0
- 0
-
分享