Immich + Swag on Unraid

Hi guys,

I've recently given Immich another go after a 6 months hiatus, and I'm loving it: everything is working properly and I'm setting it up for the rest of the family.

That said, I'd like to make it play nice with my SWAG setup. I'm currently running immich and swag as docker containers on an unraid machine. Immich was setup via the compose plugin.

SWAG has a dockersocker and a cloudflare auto dns containers associated with it, and is running on its own docker network (docker-network). That said, I can't seem to correctly configure the Immich nginx conf file.

The compose and env files I'm using for Immich are as follows:

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# 
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: 
    command: ['start.sh', 'immich']
    volumes:
      - ${LIBRARY_LOCATION}:/usr/src/app/upload/library
      - ${UPLOAD_LOCATION}:/usr/src/app/upload/upload
      - ${THUMBS_LOCATION}:/usr/src/app/upload/thumbs
      - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
      - ${VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      #- /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - docker-network

  immich-microservices:
    container_name: immich_microservices
    image: 
    # Note the lack of an `extends` section
    devices:
      - /dev/dri:/dev/dri
    command: ['start.sh', 'microservices']
    volumes:
      - ${LIBRARY_LOCATION}:/usr/src/app/upload/library
      - ${UPLOAD_LOCATION}:/usr/src/app/upload/upload
      - ${THUMBS_LOCATION}:/usr/src/app/upload/thumbs
      - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
      - ${VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - docker-network

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: 
    # extends: # uncomment this section for hardware acceleration - see [1](https://bing.com/search?q=)
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    networks:
      - docker-network

  redis:
    container_name: immich_redis
    image: 
    restart: always
    networks:
      - docker-network

  database:
    container_name: immich_postgres
    image: 
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always
    networks:
      - docker-network

networks:
  docker-network:
    external: true

volumes:
  pgdata:
  model-cache:

# You can find documentation for all the supported env variables at 

###################################################################################
# Upload File Location
#
# This is the location where uploaded files are stored.
###################################################################################

LIBRARY_LOCATION=/mnt/user/data/photos
THUMBS_LOCATION=/mnt/user/immich-cache/thumbs/
UPLOAD_LOCATION=/mnt/user/immich-cache/upload/
PROFILE_LOCATION=/mnt/user/immich-cache/profile/
VIDEO_LOCATION=/mnt/user/immich-cache/encoded-video/

# The location where your uploaded files are stored
# UPLOAD_LOCATION=./library

# 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
DB_PASSWORD=postgres

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

TZ=Europe/Madridhttps://github.com/immich-app/immich/releases/latest/download/docker-compose.ymlghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0https://immich.app/docs/install/environment-variables

And the Nginx conf file:

## Version 2024/03/28
# make sure that your immich container is named immich
# make sure that your dns has a cname set for immich
# immich v1.88+ only

server {
    listen 80;

    server_name immich;

    # 

    client_max_body_size 50000M;

    root /usr/share/nginx;

    access_log off;

    location /.well-known/acme-challenge/ { allow all; }

    location / { return 301 https://$host$request_uri; }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name immich.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth (requires ldap-location.conf in the location block)
    #include /config/nginx/ldap-server.conf;

    # enable for Authelia (requires authelia-location.conf in the location block)
    #include /config/nginx/authelia-server.conf;

    # enable for Authentik (requires authentik-location.conf in the location block)
    #include /config/nginx/authentik-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable for ldap auth (requires ldap-server.conf in the server block)
        #include /config/nginx/ldap-location.conf;

        # enable for Authelia (requires authelia-server.conf in the server block)
        #include /config/nginx/authelia-location.conf;

        # enable for Authentik (requires authentik-server.conf in the server block)
        #include /config/nginx/authentik-location.conf;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app immich;
        set $upstream_port 3001;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

    location ~ (/immich)?/api {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app immich;
        set $upstream_port 3001;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }
}https://github.com/immich-app/immich/blob/main/nginx/templates/default.conf.template#L28

When using Immich's recommended config I get a SWAG page, like this one.

If you could lend me a hand on this, I'd be thankful!