immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
52.82k stars 2.8k forks source link

[BUG] HelmChart K8S - Unable to start immich-server due to 404 with typesense #2672

Closed o10s closed 1 year ago

o10s commented 1 year ago

The bug

I started playing around with immich and now wanted to port it to kubernetes but when I start immich-server it results in the following:

/usr/src/app/node_modules/typesense/lib/Typesense/Errors/TypesenseError.js:23

        var _this = _super.call(this, message) || this;

                           ^

ObjectNotFound: Request failed with HTTP code 404 | Server said: Not Found

    at ObjectNotFound.TypesenseError [as constructor] (/usr/src/app/node_modules/typesense/lib/Typesense/Errors/TypesenseError.js:23:28)

    at new ObjectNotFound (/usr/src/app/node_modules/typesense/lib/Typesense/Errors/ObjectNotFound.js:25:42)

    at ApiCall.customErrorForResponse (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:338:21)

    at /usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:199:98

    at step (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:33:23)

    at Object.next (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:14:53)

    at step (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:18:139)

    at Object.next (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:14:53)

    at fulfilled (/usr/src/app/node_modules/typesense/lib/Typesense/ApiCall.js:5:58)

    at processTicksAndRejections (node:internal/process/task_queues:96:5) {

  httpStatus: 404

}

I am using the official helm-chart available here Here is my values files in case it helps:

## This chart relies on the common library chart from bjw-s
## You can find it at https://github.com/bjw-s/helm-charts/tree/main/charts/library/common
## Refer there for more detail about the supported values

# These entries are shared between all the Immich components

env:
  LOG_LEVEL: "debug"
  REDIS_HOSTNAME: "redis-master.administration.svc.cluster.local"
  DB_HOSTNAME: "postgresql.administration.svc.cluster.local"
  DB_USERNAME: "immich"
  DB_DATABASE_NAME: "immich"
  # -- You should provide your own secret outside of this helm-chart and use `postgresql.global.postgresql.auth.existingSecret` to provide credentials to the postgresql instance
  DB_PASSWORD: "this-is-a-boring-pw"
  TYPESENSE_ENABLED: "true"
  TYPESENSE_API_KEY: "this-is-a-boring-key"
  TYPESENSE_HOST: 'immich-typesense.multimedia.svc.cluster.local:8180'
  IMMICH_WEB_URL: 'http://immich-web.multimedia.svc.cluster.local:3000'
  IMMICH_SERVER_URL: 'http://immich-server.multimedia.svc.cluster.local:3001'
  IMMICH_MACHINE_LEARNING_URL: 'http://immich-machine-learning.multimedia.svc.cluster.local:3003'

image:
  tag: v1.53.0

immich:
  persistence:
    # Main data store for all photos shared between different components.
    library:
      # Automatically creating the library volume is not supported by this chart
      # You have to specify an existing PVC to use
      existingClaim: immich-extras-library-pvc

# Dependencies

postgresql:
  enabled: false

redis:
  enabled: false

typesense:
  enabled: true
  env:
    TYPESENSE_DATA_DIR: "/tsdata"
    TYPESENSE_API_KEY: "this-is-a-boring-key"
  persistence:
    tsdata:
      # Enabling typesense persistence is recommended to avoid slow reindexing
      enabled: true
      accessMode: ReadWriteOnce
      size: 10Gi
      storageClass: longhorn
  image:
    repository: docker.io/typesense/typesense
    tag: 0.24.0
    pullPolicy: IfNotPresent

# Immich components

server:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-server
    pullPolicy: IfNotPresent

microservices:
  enabled: true
  env:
    REVERSE_GEOCODING_DUMP_DIRECTORY: /geodata-cache
  persistence:
    geodata-cache:
      enabled: true
      size: 10Gi
      # Optional: Set this to pvc to avoid downloading the geodata every start.
      type: pvc
      accessMode: ReadWriteMany
      storageClass: longhorn
  image:
    repository: ghcr.io/immich-app/immich-server
    pullPolicy: IfNotPresent

machine-learning:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-machine-learning
    pullPolicy: IfNotPresent
  env:
    TRANSFORMERS_CACHE: /cache
  persistence:
    cache:
      enabled: true
      size: 10Gi
      # Optional: Set this to pvc to avoid downloading the ML models every start.
      type: pvc
      accessMode: ReadWriteMany
      storageClass: longhorn

web:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-web
    pullPolicy: IfNotPresent
  persistence:
    library:
      enabled: false

proxy:
  enabled: false
  image:
    repository: ghcr.io/immich-app/immich-proxy
    pullPolicy: IfNotPresent

  persistence:
    library:
      enabled: false

  ingress:
    main:
      enabled: false

No other pods report errors.

I have tried several configurations / versions to see if it could be a problem but nothing works...

The OS that Immich Server is running on

K3S v1.26.5+k3s1 on Ubuntu Server 22.04

Version of Immich Server

v1.53.0 (but also tried up to v1.60)

Version of Immich Mobile App

Not applicable

Platform with the issue

Your docker-compose.yml content

## This chart relies on the common library chart from bjw-s
## You can find it at https://github.com/bjw-s/helm-charts/tree/main/charts/library/common
## Refer there for more detail about the supported values

# These entries are shared between all the Immich components

env:
  LOG_LEVEL: "debug"
  REDIS_HOSTNAME: "redis-master.administration.svc.cluster.local"
  DB_HOSTNAME: "postgresql.administration.svc.cluster.local"
  DB_USERNAME: "immich"
  DB_DATABASE_NAME: "immich"
  # -- You should provide your own secret outside of this helm-chart and use `postgresql.global.postgresql.auth.existingSecret` to provide credentials to the postgresql instance
  DB_PASSWORD: "this-is-a-boring-pw"
  TYPESENSE_ENABLED: "true"
  TYPESENSE_API_KEY: "this-is-a-boring-key"
  TYPESENSE_HOST: 'immich-typesense.multimedia.svc.cluster.local:8180'
  IMMICH_WEB_URL: 'http://immich-web.multimedia.svc.cluster.local:3000'
  IMMICH_SERVER_URL: 'http://immich-server.multimedia.svc.cluster.local:3001'
  IMMICH_MACHINE_LEARNING_URL: 'http://immich-machine-learning.multimedia.svc.cluster.local:3003'

image:
  tag: v1.53.0

immich:
  persistence:
    # Main data store for all photos shared between different components.
    library:
      # Automatically creating the library volume is not supported by this chart
      # You have to specify an existing PVC to use
      existingClaim: immich-extras-library-pvc

# Dependencies

postgresql:
  enabled: false

redis:
  enabled: false

typesense:
  enabled: true
  env:
    TYPESENSE_DATA_DIR: "/tsdata"
    TYPESENSE_API_KEY: "this-is-a-boring-key"
  persistence:
    tsdata:
      # Enabling typesense persistence is recommended to avoid slow reindexing
      enabled: true
      accessMode: ReadWriteOnce
      size: 10Gi
      storageClass: longhorn
  image:
    repository: docker.io/typesense/typesense
    tag: 0.24.0
    pullPolicy: IfNotPresent

# Immich components

server:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-server
    pullPolicy: IfNotPresent

microservices:
  enabled: true
  env:
    REVERSE_GEOCODING_DUMP_DIRECTORY: /geodata-cache
  persistence:
    geodata-cache:
      enabled: true
      size: 10Gi
      # Optional: Set this to pvc to avoid downloading the geodata every start.
      type: pvc
      accessMode: ReadWriteMany
      storageClass: longhorn
  image:
    repository: ghcr.io/immich-app/immich-server
    pullPolicy: IfNotPresent

machine-learning:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-machine-learning
    pullPolicy: IfNotPresent
  env:
    TRANSFORMERS_CACHE: /cache
  persistence:
    cache:
      enabled: true
      size: 10Gi
      # Optional: Set this to pvc to avoid downloading the ML models every start.
      type: pvc
      accessMode: ReadWriteMany
      storageClass: longhorn

web:
  enabled: true
  image:
    repository: ghcr.io/immich-app/immich-web
    pullPolicy: IfNotPresent
  persistence:
    library:
      enabled: false

proxy:
  enabled: false
  image:
    repository: ghcr.io/immich-app/immich-proxy
    pullPolicy: IfNotPresent

  persistence:
    library:
      enabled: false

  ingress:
    main:
      enabled: false

### Your .env content

```Shell
LOG_LEVEL: "debug"
  REDIS_HOSTNAME: "redis-master.administration.svc.cluster.local"
  DB_HOSTNAME: "postgresql.administration.svc.cluster.local"
  DB_USERNAME: "immich"
  DB_DATABASE_NAME: "immich"
  # -- You should provide your own secret outside of this helm-chart and use `postgresql.global.postgresql.auth.existingSecret` to provide credentials to the postgresql instance
  DB_PASSWORD: "this-is-a-boring-pw"
  TYPESENSE_ENABLED: "true"
  TYPESENSE_API_KEY: "this-is-a-boring-key"
  TYPESENSE_HOST: 'immich-typesense.multimedia.svc.cluster.local:8180'
  IMMICH_WEB_URL: 'http://immich-web.multimedia.svc.cluster.local:3000'
  IMMICH_SERVER_URL: 'http://immich-server.multimedia.svc.cluster.local:3001'
  IMMICH_MACHINE_LEARNING_URL: 'http://immich-machine-learning.multimedia.svc.cluster.local:3003'

Reproduction steps

1. Helm install immich

Additional information

No response

abrondijk commented 1 year ago

In case you are still having this issue, I made the same mistake as you (albeit without using the official helm chart). The solution is to remove the port from TYPESENSE_HOST. So where your environment values shows you using:

TYPESENSE_HOST: 'immich-typesense.multimedia.svc.cluster.local:8180'

It should be:

TYPESENSE_HOST: 'immich-typesense.multimedia.svc.cluster.local'

As you are manually entering the environment variables rather than letting helm handle them, this issue is not related to the helm chart.