immich icon indicating copy to clipboard operation
immich copied to clipboard

Add more detail to reverse proxy docs

Open fwsmit opened this issue 2 years ago • 3 comments

Document fix for issue #2564

fwsmit avatar Jun 18 '23 16:06 fwsmit

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
immich ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2023 6:28pm

vercel[bot] avatar Jun 18 '23 16:06 vercel[bot]

Maybe add an example for Traefik (V2) as well? I can post my Traefik config here

JVT038 avatar Jun 19 '23 19:06 JVT038

In case you want to add traefik reverse proxy example, this is mine with unix sockets instead of TCP sockets. (Which is why there's a /socket mount)

version: "3.8"

networks:
  traefik_proxy:
    external:
      name: traefik_proxy

services:
  immich-server:
    image: ghcr.io/immich-app/immich-server:release
    command: ['start-server.sh']
    networks:
      - traefik_proxy
      - default
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - sockets:/sockets
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
      - typesense
    restart: always
    labels:
      traefik.enable: "true"
      traefik.docker.network: traefik_proxy
      traefik.http.services.immich-api-svc.loadbalancer.server.port: "3001"
      traefik.http.routers.immich-api-rtr.rule: "Host(`immich.$DOMAINNAME`) && Pathprefix(`/api`)"
      traefik.http.routers.immich-api-rtr.priority: 20
      traefik.http.middlewares.immich-api-strip.stripprefix.prefixes: "/api"
      traefik.http.routers.immich-api-rtr.middlewares: immich-api-strip,chain-basic@file
      traefik.http.routers.immich-api-rtr.service: immich-api-svc
      traefik.http.routers.immich-api-rtr.tls: true
      traefik.http.routers.immich-api-rtr.tls.certresolver: dns-cloudflare
      traefik.http.routers.immich-api-rtr.entrypoints: https

  immich-microservices:
    image: ghcr.io/immich-app/immich-server:release
    command: ['start-microservices.sh']
    networks:
      - default
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - sockets:/sockets
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
      - typesense
    restart: always

  immich-machine-learning:
    build:
      context: $DOCKERDIR/immich/immich-ml
      dockerfile: Dockerfile
    container_name: immich_machine_learning
    command: [ "python", "src/main.py" ]
    networks:
      - default
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - model-cache:/cache
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    restart: always

  immich-web:
    image: ghcr.io/immich-app/immich-web:release
    networks:
      - default
      - traefik_proxy
    env_file:
      - .env
    restart: always
    labels:
      traefik.enable: "true"
      traefik.docker.network: traefik_proxy
      traefik.http.services.immich-svc.loadbalancer.server.port: "3000"
      traefik.http.routers.immich-rtr.rule: "Host(`immich.$DOMAINNAME`)"
      traefik.http.routers.immich-rtr.priority: 10
      traefik.http.routers.immich-rtr.service: immich-svc
      traefik.http.routers.immich-rtr.middlewares: chain-basic@file
      traefik.http.routers.immich-rtr.tls: true
      traefik.http.routers.immich-rtr.tls.certresolver: dns-cloudflare
      traefik.http.routers.immich-rtr.entrypoints: https

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always
    networks:
      - default
    command: redis-server /etc/redis.conf
    volumes:
      - sockets:/sockets
      - $DOCKERDIR/immich/redis.conf:/etc/redis.conf
      - /etc/TZ:/etc/timezone:ro
      - $DOCKERDIR/immich/redisdb:/db

  database:
    container_name: immich_postgres
    image: postgres:14-bullseye
    user: 1026:100
    command: postgres -c unix_socket_directories='/var/run/postgresql/,/sockets/'
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
      PGPORT: ${DB_PORT}
    volumes:
      - $DOCKERDIR/immich/pgdata:/var/lib/postgresql/data
      - sockets:/sockets
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: ghcr.io/immich-app/immich-proxy:release
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.0
    restart: always
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
    logging:
      driver: none
    volumes:
      - $DOCKERDIR/immich/typesense:/data

  # immich-proxy:
  #   container_name: immich_proxy
  #   image: ghcr.io/immich-app/immich-proxy:release
  #   ports:
  #     - 2283:8080
  #   logging:
  #     driver: none
  #   depends_on:
  #     - immich-server
  #   networks:
  #     - default
  #     - traefik
  #   restart: always
  #   labels:
  #     - "traefik.enable=true"
  #     ## HTTP Routers
  #     - "traefik.http.routers.immich-rtr.entrypoints=https"
  #     - "traefik.http.routers.immich-rtr.rule=Host(`immich.$DOMAINNAME`)"
  #     ## Middlewares
  #     - "traefik.http.routers.immich-rtr.middlewares=chain-basic@file"
  #     ## HTTP Services
  #     - "traefik.http.routers.immich-rtr.service=immich-svc"
  #     - "traefik.http.services.immich-svc.loadbalancer.server.port=2283"

volumes:
  sockets:
    external: true
  model-cache:

JVT038 avatar Jun 19 '23 21:06 JVT038

Thanks for fixing the typo and merging.

The traefic example feels like it's more a separate install method, since it seems to include both the starting of containers and the network routing. It looks like it replaces docker-compose

fwsmit avatar Jul 01 '23 20:07 fwsmit