services:

  immich-server:
    image: ghcr.io/immich-app/immich-server:${PIXDEN_IMMICH_VERSION:-release}
    restart: unless-stopped
    environment:
      - DB_HOSTNAME=${PIXDEN_DB_HOSTNAME}
      - DB_DATABASE_NAME=${PIXDEN_DB_DATABASE_NAME}
      - DB_USERNAME=${PIXDEN_DB_USERNAME}
      - DB_PASSWORD=${PIXDEN_DB_PASSWORD}
      - TRUSTED_PROXIES=10.10.0.20
    volumes:
      - ${PIXDEN_UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    healthcheck:
      disable: false
    deploy:
      resources:
        limits:
          memory: 1.5G
    networks:
      tan-network:
        ipv4_address: 10.10.0.70
    labels:
      - traefik.enable=true
      - traefik.http.routers.immich.rule=Host(`immich.luckyden.org`)
      - traefik.http.routers.immich.entrypoints=websecure
      - traefik.http.routers.immich.tls.certresolver=cloudflare
      - traefik.http.services.immich.loadbalancer.server.port=2283

  immich-machine-learning:
    image: ghcr.io/immich-app/immich-machine-learning:${PIXDEN_IMMICH_VERSION:-release}
    restart: unless-stopped
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    healthcheck:
      disable: false
    deploy:
      resources:
        limits:
          memory: 2G
    networks:
      tan-network:
        ipv4_address: 10.10.0.71

  redis:
    image: docker.io/valkey/valkey:8-bookworm@sha256:fec42f399876eb6faf9e008570597741c87ff7662a54185593e74b09ce83d177
    restart: unless-stopped
    healthcheck:
      test: redis-cli ping || exit 1
    networks:
      tan-network:
        ipv4_address: 10.10.0.72

  database:
    image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=${PIXDEN_DB_PASSWORD}
      - POSTGRES_USER=${PIXDEN_DB_USERNAME}
      - POSTGRES_DB=${PIXDEN_DB_DATABASE_NAME}
      - POSTGRES_INITDB_ARGS=--data-checksums
    volumes:
      - ${PIXDEN_DB_DATA_LOCATION}:/var/lib/postgresql/data
    networks:
      tan-network:
        ipv4_address: 10.10.0.73

networks:
  tan-network:
    external: true

volumes:
  model-cache:
