Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB_HOSTNAME change #267

Open
Greedwolf opened this issue Dec 23, 2023 · 2 comments
Open

DB_HOSTNAME change #267

Greedwolf opened this issue Dec 23, 2023 · 2 comments

Comments

@Greedwolf
Copy link

I installed it through Docker Compose, but when I restart Docker, the IP addresses obtained by immich, Redis, and postgres sometimes change, causing it to not start. How to modify Docker Compose to automatically adapt to this IP change for immich

@hydazz
Copy link
Member

hydazz commented Dec 23, 2023

you can set the ip to the hostname of the container, the hostname should be the container_name, eg:

services:
  immich:
    image: ghcr.io/imagegenius/igpipepr-immich:1.91.4-PR-266
    container_name: immich
    environment:
      PUID: '1000'
      PGID: '1000'
      TZ: 'Australia/Melbourne'
      DB_HOSTNAME: 'postgres14' # <= container name
      DB_USERNAME: 'postgres'
      DB_PASSWORD: 'postgres'
      DB_DATABASE_NAME: 'immich'
      REDIS_HOSTNAME: 'redis'
      DB_PORT: '5432'
      REDIS_PORT: '6379'
      REDIS_PASSWORD: ''
      MACHINE_LEARNING_WORKERS: '1'
      MACHINE_LEARNING_WORKER_TIMEOUT: '120'
    ports:
      - '8080:8080'
    restart: unless-stopped
    depends_on:
      - postgres14
      - redis

  redis:
    image: redis
    ports:
      - '6379:6379'
    container_name: redis
    restart: unless-stopped

  postgres14:
    image: tensorchord/pgvecto-rs:pg14-v0.1.11
    ports:
      - '5432:5432'
    container_name: postgres14 # <= set here
    environment:
      POSTGRES_USER: 'postgres'
      POSTGRES_PASSWORD: 'postgres'
      POSTGRES_DB: 'immich'
    restart: unless-stopped

@Greedwolf
Copy link
Author

There is another issue, after Docker runs normally for a long time, Postgres will report an error and CPU usage will be high
This is the latest error message:
2023-12-23 17:10:44.868 UTC [4580] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:10:50.003 UTC [4582] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:10:50.003 UTC [4582] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:11:14.869 UTC [4584] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:11:14.869 UTC [4584] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:11:20.004 UTC [4586] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:11:20.004 UTC [4586] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:11:44.869 UTC [4589] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:11:44.869 UTC [4589] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:11:50.005 UTC [4591] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:11:50.005 UTC [4591] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:12:14.870 UTC [4593] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:12:14.870 UTC [4593] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'
2023-12-23 17:12:20.011 UTC [4595] ERROR: relation "socket_io_attachments" does not exist at character 13
2023-12-23 17:12:20.011 UTC [4595] STATEMENT: DELETE FROM socket_io_attachments WHERE created_at < now() - interval '30000 milliseconds'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants