diff --git a/immich/.env.dist b/immich/.env.dist index cc1d2d8..592df17 100644 --- a/immich/.env.dist +++ b/immich/.env.dist @@ -3,6 +3,13 @@ BIND_ADDRESS=127.0.0.1 BIND_PORT=2283 +# Available modes: shared, internal +# Shared allows to publish database ports on host which may be useful for a backup +# Internal mode leave the database inside the stack network +#DB_MODE=shared +#DB_EXTERNAL_ADDRESS=127.0.0.1 +#DB_EXTERNAL_PORT=5430 + # The location where your uploaded files are stored UPLOAD_LOCATION=./library MODEL_CACHE_LOCATION=./model-cache diff --git a/immich/docker-compose.yml b/immich/docker-compose.yml index 593c7c3..9901e13 100644 --- a/immich/docker-compose.yml +++ b/immich/docker-compose.yml @@ -71,6 +71,9 @@ services: database: container_name: immich_postgres image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 + extends: + file: 'share_db.yaml' + service: '${DB_MODE:-internal}' # set to one of [shared, internal] environment: POSTGRES_PASSWORD: '${DB_PASSWORD}' POSTGRES_USER: '${DB_USERNAME}' diff --git a/immich/share_db.yaml b/immich/share_db.yaml new file mode 100644 index 0000000..108424a --- /dev/null +++ b/immich/share_db.yaml @@ -0,0 +1,6 @@ +services: + internal: {} + + shared: + ports: + - '${DB_EXTERNAL_ADDRESS:-127.0.0.1}:${DB_EXTERNAL_PORT:-5430}:5432' \ No newline at end of file