Immich on TrueNAS or Ubuntu Server?

Hey again everyone (and Tom)

Tom, I have seen your awesome utubes on set up of Immich on TrueNAS (and also Techno Tims on Ubuntu)

I have a multi machine homelab set up now. Including both these setups. My faster machine -that I also run localAI (using an RTX3090) is a Ubuntu server. But it all runs on the one ssd. My TrueNAS is a slower CPU with 6 cores and ECC RAM (but without a GPU) and has a Z1 pool with NVMEx4 set up. I use this as my backup server and also to run Jellyfin and store my movie library. I use tailscale and syncthing on both servers and an iphone (with icloud) as my main photo capture.

My question is what is the best and most robust option for Immich and it’s future growth and deployment? Clearly with GPU processing and AI, am I better to run the primary Immich instance on the Ubuntu server? (following TechnoTim’s set up) or running it on TrueNAS (and say setting up a remote machine learning service on the Ubuntu server) and pointing the TrueNAS Immich instance to that?

Obviously photo’s are precious (hence my inclination to run it on TrueNAS) but can TrueNAS be reliably configured to run and use a server with a GPU and AI on the same LAN?

Which approach would you suggest and have there been any vids on configuring TrueNAS to use external AI and GPU’s?

Thanks!

Personally I would leave the photos on the TrueNAS box and run the Immich workload on the Ubuntu server with the GPU, and simply reach the photo library by NFS. When I was running Immich, this is what I did. It ran fine. You don’t need to store the photos where the docker container runs.

1 Like

Ah ok… so that is an interesting approach I hadn’t thought of.. leave all the photos in the one core TrueNAS folder/share and point whatever image capture/processing/display instance or software you want to use at that… interesting approach. What (other) programs are you now using and/or as an alternative to Immich?

Runnin completely on TrueNAS is fine and while Immich can use a GPU it’s really not that big a deal to have it run on the CPU. The first import of around 55 thousand photos only took a few hours to index. A few dozen more from my phone only takes a few minutes. The GPU is only needed for that part and not viewing or lookups.

I have a VM running most all my Docker containers including Immich (no GPU) and I have the storage mounted on TrueNAS as that is my preferred way to manage large data separate from the compute.

1 Like

Cool.. Hey Tom to my second question.. have you used localAI/GPU’s linked into yr TrueNAS server… so that apps running on TrueNAS can benefit from (and call) an external GPU or say an LLM? there is this capacity in TrueNAS correct?..

Here is the docker compose I used. Obviously you will have to adjust for your environment. At the time I used my Synology and not my TrueNAS machine just because that’s where my wife dumps all her photos. Also I use an Nvidia RTX 2000 ada as my GPU. If you use a non-nvidia GPU, you will have to adjust that as well.

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    volumes:
      - /home/louie/immich/upload:/data
      - synology-photos:/mnt/synology-photos
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:release-cuda
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
    volumes:
      - /home/louie/immich/models:/cache
    env_file:
      - stack.env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/valkey/valkey:9@sha256:546304417feac0874c3dd576e0952c6bb8f06bb4093ea0c9ca303c73cf458f63
    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:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - /home/louie/immich/db:/var/lib/postgresql/data
    env_file:
      - stack.env
    shm_size: 128mb
    restart: always
    healthcheck:
      disable: false

volumes:
  synology-photos:
    driver: local
    driver_opts:
      type: nfs
      o: "addr=192.168.3.3,ro,nfsvers=4"
      device: ":/volume1/photo"

And here is the stack.env file I used

IMPORTANT: Change DB_PASSWORD to a secure random password!

Database Configuration

DB_PASSWORD=XXXXXX
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Timezone

TZ=America/New_York

Machine Learning Configuration

MACHINE_LEARNING_WORKERS=1
MACHINE_LEARNING_MODEL_TTL=300

Job Concurrency Settings

JOB_SMART_SEARCH_CONCURRENCY=2
JOB_FACE_DETECTION_CONCURRENCY=2
JOB_FACIAL_RECOGNITION_CONCURRENCY=2
1 Like

Hey cool ! Thanks for that! All good. I use an RTX3090… i bought that second hand specifically for local AI. Having great success with that running Hermes/LMStudio and Gemma 4- 26B

While TrueNAS does have support for GPU passthrough it’s not something I am using since none of my TrueNAS systems have a GPU.

1 Like

Sure. No worries… no I’m like you.. My TrueNAS is a low powered CPU backup server not a Ferrari (either).. Was just curious though, given all the TrueNAS apps now appearing an all - whether you could leverage a GPU (on a separate machine) …even a LLM/AI running on a separate server (on the same LAN) into the apps running on TrueNAS. Not only with Immich, but Frigate also comes or mind. Or AI assisting configuration… but I guess the TrueNAS team is wary of that! No I think you are 100% right in this guidance… going to be interesting how apps play out on TrueNAS (though), if they can’t leverage the use of a dedicated local AI machine running on the same network.. what with the likes of Nvida spark and the new Asus AI machines now available to retail.. Heck even the more powerful M5 Mac Studios etc appearing..Cheers all for the fantastic guidance :grinning_face:

I followed toms TrueNAS Immich vid, all working well, but will be moving to docker with data on TrueNAS, why….. I simply don’t use TrueNAS regularly enough to troubleshoot say months from now if something goes wrong

Docker repair is simpler without having to remember/relearn something, especially when you have docker running in a VM and your VM is backed up daily to PBS say

1 Like

Sure. I pretty much use TrueNAS for what it is designed for. Backups. But I also use it for large media libraries… because I want those on ZFS and I want the storage reliable. On TrueNAS I’ve basically just got Jellyfin, and URbackup as the apps along with Syncthing and a hawser instance into dockhand. I figured Immich goes on the TrueNAS.. again for reliability.. these are my photos. If I go off icloud I don’t want to lose my darn (good) photos! A lot of the ones I take on the iphone are just rubbish anyway.. so I wil upload the ones I want to keep via syncthing.