immich-app / immich

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

Basic Portainer stack deploy fails #9111

Closed jsspen closed 2 weeks ago

jsspen commented 2 weeks ago

The bug

I'm getting an error related to the mounting of /etc/localtime when attempting to deploy the stack and when trying to get around it I'm getting database issues that prevent me from fully starting immich.

If I remove /etc/localtime:/etc/localtime:ro from the yml (either removing entirely or replacing with a TZ=America/New_York env variable) then the stack deploys but I cannot access the GUI and the logs for the server container show:

[Nest] 7  - 04/27/2024, 3:24:45 PM   ERROR [ExceptionHandler] no pg_hba.conf entry for host "192.168.64.5", user "postgres", database "immich", no encryption
error: no pg_hba.conf entry for host "192.168.64.5", user "postgres", database "immich", no encryption
    at Parser.parseErrorMessage (/usr/src/app/node_modules/pg-protocol/dist/parser.js:283:98)
    at Parser.handlePacket (/usr/src/app/node_modules/pg-protocol/dist/parser.js:122:29)
    at Parser.parse (/usr/src/app/node_modules/pg-protocol/dist/parser.js:35:38)
    at Socket.<anonymous> (/usr/src/app/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

and the postgres database container logs show: 2024-04-27 15:26:15.562 UTC [148] FATAL: no pg_hba.conf entry for host "192.168.64.5", user "postgres", database "immich", no encryption (the IP it mentions is the server container)

I'm not sure if these two issues are related or not but either way I'm unable to successfully deploy using the provided Portainer-specific files/instructions.

The OS that Immich Server is running on

Portainer inside a Docker LXC built on Alpine Linux

Version of Immich Server

release

Version of Immich Mobile App

n/a

Platform with the issue

Your docker-compose.yml content

version: "3.8"

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ 'start.sh', 'immich' ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: [ 'start.sh', 'microservices' ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    depends_on:
      - redis
      - database
    restart: always

  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: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   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:
      - stack.env
    restart: always

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672
    restart: always

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: always

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=/mnt/drive/immich/library
IMMICH_VERSION=release
DB_PASSWORD=aPasswordExample
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=mnt/drive/immich/postgres
REDIS_HOSTNAME=immich_redis

Reproduction steps

1. Copy latest docker-compose.yml contents to Portainer, add .env variables, update .env to stack.env
2. Attempt to deploy stack

Relevant log output

failed to deploy a stack: Network immich_default Creating Network immich_default Created Container immich_postgres Creating Container immich_redis Creating Container immich_machine_learning Creating Container immich_postgres Created Container immich_redis Created Container immich_microservices Creating Container immich_server Creating Container immich_machine_learning Created Container immich_server Created Container immich_microservices Created Container immich_redis Starting Container immich_postgres Starting Container immich_machine_learning Starting Container immich_redis Started Container immich_machine_learning Started Container immich_postgres Started Container immich_microservices Starting Container immich_server Starting Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/etc/localtime" to rootfs at "/etc/localtime": mount /etc/localtime:/etc/localtime (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Additional information

/etc/localtime is an existing directory when checked from the host cli