immich-app / immich

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

Server status and version are showing Offline and Unknown #6817

Closed PHLAK closed 9 months ago

PHLAK commented 9 months ago

The bug

Server status and version are no longer showing after updating to v1.94.1

image

I spotted the following error in the logs.

immich-1  | Migration "AddAutoStackId1703035138085" failed, error: column "autoStackId" of relation "exif" already exists
immich-1  | /usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219
immich-1  |             throw new QueryFailedError_1.QueryFailedError(query, parameters, err);
immich-1  |                   ^
immich-1  | 
immich-1  | QueryFailedError: column "autoStackId" of relation "exif" already exists
immich-1  |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich-1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-1  |     at async AddAutoStackId1703035138085.up (/usr/src/app/dist/infra/migrations/1703035138085-AddAutoStackId.js:9:9)
immich-1  |     at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
immich-1  |     at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:263:35)
immich-1  |     at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:42:9)
immich-1  |     at async DatabaseService.init (/usr/src/app/dist/domain/database/database.service.js:33:9)
immich-1  |     at async AppService.init (/usr/src/app/dist/immich/app.service.js:56:9)
immich-1  |     at async AppModule.onModuleInit (/usr/src/app/dist/immich/app.module.js:32:9)
immich-1  |     at async callModuleInitHook (/usr/src/app/node_modules/@nestjs/core/hooks/on-module-init.hook.js:51:9) {
immich-1  |   query: 'ALTER TABLE "exif" ADD "autoStackId" character varying',
immich-1  |   parameters: undefined,
immich-1  |   driverError: error: column "autoStackId" of relation "exif" already exists
immich-1  |       at /usr/src/app/node_modules/pg/lib/client.js:526:17
immich-1  |       at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-1  |       at async PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:184:25)
immich-1  |       at async AddAutoStackId1703035138085.up (/usr/src/app/dist/infra/migrations/1703035138085-AddAutoStackId.js:9:9)
immich-1  |       at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
immich-1  |       at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:263:35)
immich-1  |       at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:42:9)
immich-1  |       at async DatabaseService.init (/usr/src/app/dist/domain/database/database.service.js:33:9)
immich-1  |       at async AppService.init (/usr/src/app/dist/immich/app.service.js:56:9)
immich-1  |       at async AppModule.onModuleInit (/usr/src/app/dist/immich/app.module.js:32:9) {
immich-1  |     length: 134,
immich-1  |     severity: 'ERROR',
immich-1  |     code: '42701',
immich-1  |     detail: undefined,
immich-1  |     hint: undefined,
immich-1  |     position: undefined,
immich-1  |     internalPosition: undefined,
immich-1  |     internalQuery: undefined,
immich-1  |     where: undefined,
immich-1  |     schema: undefined,
immich-1  |     table: undefined,
immich-1  |     column: undefined,
immich-1  |     dataType: undefined,
immich-1  |     constraint: undefined,
immich-1  |     file: 'tablecmds.c',
immich-1  |     line: '7242',
immich-1  |     routine: 'check_for_column_name_collision'
immich-1  |   },
immich-1  |   length: 134,
immich-1  |   severity: 'ERROR',
immich-1  |   code: '42701',
immich-1  |   detail: undefined,
immich-1  |   hint: undefined,
immich-1  |   position: undefined,
immich-1  |   internalPosition: undefined,
immich-1  |   internalQuery: undefined,
immich-1  |   where: undefined,
immich-1  |   schema: undefined,
immich-1  |   table: undefined,
immich-1  |   column: undefined,
immich-1  |   dataType: undefined,
immich-1  |   constraint: undefined,
immich-1  |   file: 'tablecmds.c',
immich-1  |   line: '7242',
immich-1  |   routine: 'check_for_column_name_collision'
immich-1  | }

The OS that Immich Server is running on

Arch Linux

Version of Immich Server

v1.94.1

Version of Immich Mobile App

v1.94.0

Platform with the issue

Your docker-compose.yml content

version: '3'

services:

  immich:
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ["start.sh", "immich"]
    depends_on:
      - redis
      - postgres
    env_file: environment.d/immich.env
    environment:
      DB_HOSTNAME: ${DATABASE_HOST:-postgres}
      DB_DATABASE_NAME: ${DATABASE_NAME:-immich}
      DB_USERNAME: ${DATABASE_USER:-immich}
      DB_PASSWORD: ${DATABASE_PASSWORD}
      REDIS_HOSTNAME: redis
      TZ: ${TZ:-UTC}
    ports:
      - ${IMMICH_SERVER_PORT:-3001}:3001
    volumes:
      - ${IMMICH_UPLOADS_PATH}:/usr/src/app/upload
      - ./volumes/config:/config:ro
      - /etc/localtime:/etc/localtime:ro
    labels:
      com.centurylinklabs.watchtower.scope: immich-compose
    restart: unless-stopped

  microservices:
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ["start.sh", "microservices"]
    extends:
      file: hardware-acceleration.ms.yaml
      service: hardware-acceleration
    depends_on:
      - redis
      - postgres
    env_file: environment.d/immich.env
    environment:
      DB_HOSTNAME: ${DATABASE_HOST:-postgres}
      DB_DATABASE_NAME: ${DATABASE_NAME:-immich}
      DB_USERNAME: ${DATABASE_USER:-immich}
      DB_PASSWORD: ${DATABASE_PASSWORD}
      REDIS_HOSTNAME: redis
      TZ: ${TZ:-UTC}
    volumes:
      - ${IMMICH_UPLOADS_PATH}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    restart: always

  machine-learning:
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    extends:
      file: hardware-acceleration.ml.yaml
      service: hardware-acceleration
    volumes:
      - ${MODEL_CACHE_VOLUME:-model-cache}:/cache
    environment:
      DB_HOSTNAME: ${DATABASE_HOST:-postgres}
      DB_DATABASE_NAME: ${DATABASE_NAME:-immich}
      DB_USERNAME: ${DATABASE_USER:-immich}
      DB_PASSWORD: ${DATABASE_PASSWORD}
      REDIS_HOSTNAME: redis
      TZ: ${TZ:-UTC}
    restart: unless-stopped

  postgres:
    image: tensorchord/pgvecto-rs:pg16-v0.1.11
    environment:
      POSTGRES_DB: ${DATABASE_NAME:-immich}
      POSTGRES_USER: ${DATABASE_USER:-immich}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      TZ: ${TZ:-UTC}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    labels:
      com.centurylinklabs.watchtower.scope: immich-compose
    restart: unless-stopped

  redis:
    image: redis:7.2
    labels:
      com.centurylinklabs.watchtower.scope: immich-compose
    restart: unless-stopped

  watchtower:
    image: containrrr/watchtower
    env_file: environment.d/watchtower.env
    environment:
      WATCHTOWER_SCOPE: immich-compose
      TZ: ${TZ:-UTC}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    labels:
      com.centurylinklabs.watchtower.scope: immich-compose
    restart: unless-stopped

volumes:
  postgres-data: {}
  model-cache: {}

Your .env content

# ------------------------------------------------------------------------------
# The Immich server port to be exposed to the host.
# ------------------------------------------------------------------------------

# IMMICH_SERVER_PORT=3001

# ------------------------------------------------------------------------------
# Path to the Immich uploads directory on the host. This may be absolute or
# relative to the 'docker-compose.yaml' file.
# ------------------------------------------------------------------------------

IMMICH_UPLOADS_PATH=/storage/immich

# ------------------------------------------------------------------------------
# The MySQL database to use for storage. Only the password is required when
# using the provided MySQL container.
# ------------------------------------------------------------------------------

# DATABASE_HOST=database
# DATABASE_NAME=immich
# DATABASE_USER=immich
DATABASE_PASSWORD=[REDACTED]

# ------------------------------------------------------------------------------
# Connection secret for Typesense. You should change this to a random string.
# ------------------------------------------------------------------------------

# TYPESENSE_API_KEY=[REDACTED]

# ------------------------------------------------------------------------------
# The timezone used within your container. For a complete list of timezones
# see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# ------------------------------------------------------------------------------

TZ=America/Phoenix

Reproduction steps

1. Pull updated image (from v1.93.3 to v1.94.1)
2. Restart and recreate docker containers
3. View the immich container logs

Additional information

No response

PHLAK commented 9 months ago

I investigated a little further and everything else seems to be working fine. Only issue is the server status and version showing Offline/Unknown.

Also, after restarting the containers I no longer see the migration error in the logs.

alextran1502 commented 9 months ago

Yeah the message showed there means that the migration was running at the same time in both the server and microservices container. For Offline/Unknown issue, make sure your reverse proxy support websocket

PHLAK commented 9 months ago

Yeah the message showed there means that the migration was running at the same time in both the server and microservices container.

That makes sense.

For Offline/Unknown issue, make sure your reverse proxy support websocket

This was the issue, thank you.

Qhilm commented 6 months ago

For anyone finding this and who is running DSM 7, here is how to enable websockets (it took me a while). You will have two values autopopulated, don't touch it and just save.

image