QNAPのNASでimmich立ち上げた

今まで自宅NASとの同期に使っていたAmazon Photo PC版の”sync”機能が完全に使えなくなるそうなので、クラウド依存度を減らそうと代替のimmich導入を検討中。
電気代的にもこれ以上常時起動の機器が増えることは避けたく、パフォーマンス的な懸念はあるものの、QNAP NASの内蔵docker、container stationで立ち上げられないか、調査した。

SSHでCLI叩けばできるようだけど、それの場合、引継ぎとか更新で困りそうだなぁ、とか考えていると、公式githubに下記議論を発見。どうやらportainer経由で建てるのが良いらしい。

>QNap Lessons learned / Semi Guide · immich-app/immich · Discussion #13430 · GitHub
https://github.com/immich-app/immich/discussions/13430

以下、やったこと(ほぼ上記githubの通り)

1) Container Station → アプリケーション → [+作成] で下記yamlを記載 version: '3' services:   portainer:     image: portainer/portainer-ce:latest     container_name: portainer     restart: always     security_opt:       - no-new-privileges:true     ports:      - 9000:9000     volumes:       - /var/run/docker.sock:/var/run/docker.sock:ro       - /share/Container/portainer-ce/data:/data:rw     environment:       TZ: Asia/Tokyo

このとき[詳細設定]で”デフォルトのWebURLポートの設定”を有効化する。 サービス: portainer デフォルトのWeb URLポート: 9000

2) immich用の共有フォルダ作成
そのままだと/share/Containerに全データが入ってしまうが、別ストレージに入れたかったため、”immich”という名称の共有フォルダをFile Stationで作成しておく。(pathは/share/immichになる)

3) portainerからimmichを立ち上げ
http://[nasのipアドレス]:9000/にアクセスし、portainerの初期設定をする。きちんと作成できていれば、[local]というenviromentsがあるはず。(当初YAMLを書かずにcontainer stationのguiだけでやろうとしたところ、/var/run/docker.sockがマウントできずに、これが生成できなかった)

localのenvが見つかれば、あとは公式docの通り進める

Portainer | Immich
https://immich.app/docs/install/portainer/
最終的に作成したstackは下記のとおり。 # # WARNING: To install Immich, follow our guide: https://immich.app/docs/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}:/usr/src/app/upload - ${EXT_LIB_LOCATION}:/mnt/media/extlib:ro - ${EXT_LIB2_LOCATION}:/mnt/media/extlib2:ro - /etc/localtime:/etc/localtime:ro env_file: - stack.env ports: - '2283:2283' depends_on: - redis - database restart: always healthcheck: disable: false cpus: 2.0 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} # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration # file: hwaccel.ml.yml # service: cpu # 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_LOCATION}:/cache env_file: - stack.env restart: always healthcheck: disable: false redis: container_name: immich_redis image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177 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 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 restart: always volumes: model-cache: 環境変数: *******やEXT_LIB周りは環境に合わせること UPLOAD_LOCATION=/share/immich/upload DB_DATA_LOCATION=/share/immich/pgdata IMMICH_VERSION=release DB_PASSWORD=******* DB_USERNAME=postgres DB_DATABASE_NAME=immich MODEL_CACHE_LOCATION=/share/immich/model-cache EXT_LIB_LOCATION=/share/photos EXT_LIB2_LOCATION=/share/amazon_photos 差分としては、「2)で作成したフォルダを指定」「CPUを2個に制限」「外部ライブラリとしてNASのphotoフォルダとAmazon photoフォルダを追加」くらい。
CPU制限は弊環境(TS-453Be/RAM16GB)だと外部ライブラリインポート後のサムネイル作成時にCPUが100%に張り付いてNASにログインができなくなったため入れた。

4) immichログイン&初期設定
http://[nasのipアドレス]:2283/にアクセスして初期設定。
環境依存なことは特にないはずだが、CPUが弱いのでML周りの機能や動画のトランスコードは一通りOFFにした。モバイルアプリも快適に使えている。あとは10万件のサムネイル作成がいつ終わるか…

 

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です