From f22222800f9be9bcddfcdedc1493f5ec68a9ac0f Mon Sep 17 00:00:00 2001 From: Yann Stepienik <7872597+azukaar@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:19:21 +0000 Subject: [PATCH] Update Immich to use real image --- servapps/Immich/cosmos-compose.json | 245 ++++++++++++++++++++-------- 1 file changed, 174 insertions(+), 71 deletions(-) diff --git a/servapps/Immich/cosmos-compose.json b/servapps/Immich/cosmos-compose.json index 86200187..d4bfd4a2 100644 --- a/servapps/Immich/cosmos-compose.json +++ b/servapps/Immich/cosmos-compose.json @@ -1,10 +1,10 @@ -{ + { "cosmos-installer": { "form": [ { "name": "photoPath", - "label": "What is the path to your Photos? (leave empty to not mount anything)", - "initialValue": "{DefaultDataPath}/photos", + "label": "What is the path to your uploaded Photos?", + "initialValue": "{DefaultDataPath}/immich-photos", "type": "text" }, { @@ -23,113 +23,210 @@ {/if} ] }, - "minVersion": "0.8.5", + "minVersion": "0.12.0", "services": { "{ServiceName}": { - "image": "ghcr.io/imagegenius/immich:latest", "container_name": "{ServiceName}", - "restart": "unless-stopped", - "environment": [ - "TZ=auto", - "DB_HOSTNAME={ServiceName}-postgres", - "DB_USERNAME=immich", - "DB_PASSWORD={Passwords.0}", - "DB_DATABASE_NAME=immich", - "REDIS_HOSTNAME={ServiceName}-redis", - "REDIS_PASSWORD={Passwords.0}" - ], - "labels": { - "cosmos-persistent-env": "REDIS_PASSWORD, DB_PASSWORD, DB_USERNAME, DB_DATABASE_NAME", - "cosmos-force-network-secured": "true", - "cosmos-auto-update": "true", - "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png" - }, + "hostname": "{ServiceName}", + "image": "ghcr.io/immich-app/immich-server:release", + "command": "start.sh immich", "networks": { - "{ServiceName}-databases": {} + "{ServiceName}": {} }, "volumes": [ - { - "source": "{ServiceName}-config", - "target": "/var/www/html/config", - "type": "volume" - } - {if Context.photoPath}, { "source": "{Context.photoPath}", - "target": "/photos", + "target": "/usr/src/app/upload", + "type": "bind" + }, + { + "source": "/etc/localtime", + "target": "/etc/localtime", "type": "bind" } - {/if} + ], + "labels": { + "cosmos-persistent-env": "UPLOAD_LOCATION, TYPESENSE_API_KEY, DB_PASSWORD, DB_DATABASE_NAME", + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" + }, + "environment": [ + "UPLOAD_LOCATION=/usr/src/app/upload", + "TYPESENSE_API_KEY={Passwords.0}", + "DB_PASSWORD={Passwords.1}", + "DB_HOSTNAME={ServiceName}-database", + "DB_USERNAME=postgres", + "DB_DATABASE_NAME=immich", + "REDIS_HOSTNAME={ServiceName}-redis" + ], + "depends_on": [ + "{ServiceName}-redis", + "{ServiceName}-database", + "typesense" ], "routes": [ { "name": "{ServiceName}", "description": "Expose {ServiceName} to the web", "useHost": true, - "target": "http://{ServiceName}:8080", + "target": "http://{ServiceName}:3001", "mode": "SERVAPP", "Timeout": 14400000, "ThrottlePerMinute": 12000, "BlockCommonBots": true, "SmartShield": { - "Enabled": true + "Enabled": true, + "PolicyStrictness": 3, + "PerUserRequestLimit": 12000, + "PerUserSimultaneous": 100, + "MaxGlobalSimultaneous": 1000 } } - ] + ], + "restart": "always" }, - "{ServiceName}-postgres": { - "image": "postgres:15-alpine", - "container_name": "{ServiceName}-postgres", - "hostname": "{ServiceName}-postgres", - "restart": "unless-stopped", - "stop_grace_period": 5, - "security_opt": [ - "seccomp:unconfined", - "apparmor:unconfined" + "microservices": { + "container_name": "microservices", + "hostname": "microservices", + "image": "ghcr.io/immich-app/immich-server:release", + "command": "start.sh microservices", + "networks": { + "{ServiceName}": {} + }, + "volumes": [ + { + "source": "{Context.photoPath}", + "target": "/usr/src/app/upload", + "type": "bind" + }, + { + "source": "/etc/localtime", + "target": "/etc/localtime", + "type": "bind" + } ], "labels": { - "cosmos-persistent-env": "POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD", - "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png" + "cosmos-persistent-env": "UPLOAD_LOCATION, TYPESENSE_API_KEY, DB_PASSWORD, DB_DATABASE_NAME", + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" }, + "environment": [ + "UPLOAD_LOCATION=/usr/src/app/upload", + "TYPESENSE_API_KEY={Passwords.0}", + "DB_PASSWORD={Passwords.1}", + "DB_HOSTNAME={ServiceName}-database", + "DB_USERNAME=postgres", + "DB_DATABASE_NAME=immich", + "REDIS_HOSTNAME={ServiceName}-redis" + ], + "depends_on": [ + "{ServiceName}-redis", + "{ServiceName}-database", + "typesense" + ], + "restart": "always" + }, + "machine-learning": { + "container_name": "machine-learning", + "hostname": "machine-learning", + "image": "ghcr.io/immich-app/immich-machine-learning:release", "networks": { - "{ServiceName}-databases": {} + "{ServiceName}": {} }, "volumes": [ { - "source": "{ServiceName}-postgres-data", - "target": "/var/lib/postgresql/data", + "source": "{ServiceName}-model-cache", + "target": "/cache", "type": "volume" } ], + "labels": { + "cosmos-persistent-env": "UPLOAD_LOCATION, TYPESENSE_API_KEY, DB_PASSWORD, DB_DATABASE_NAME", + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" + }, "environment": [ - "POSTGRES_DB=immich", - "POSTGRES_USER=immich", - "POSTGRES_PASSWORD={Passwords.0}" - ] + "UPLOAD_LOCATION=/usr/src/app/upload", + "TYPESENSE_API_KEY={Passwords.0}", + "DB_PASSWORD={Passwords.1}", + "DB_HOSTNAME={ServiceName}-database", + "DB_USERNAME=postgres", + "DB_DATABASE_NAME=immich", + "REDIS_HOSTNAME={ServiceName}-redis" + ], + "restart": "always" + }, + "typesense": { + "container_name": "typesense", + "hostname": "typesense", + "image": "typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd", + "networks": { + "{ServiceName}": {} + }, + "environment": [ + "TYPESENSE_API_KEY={Passwords.0}", + "TYPESENSE_DATA_DIR=/data", + "GLOG_minloglevel=1" + ], + "labels": { + "cosmos-persistent-env": "TYPESENSE_API_KEY", + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" + }, + "volumes": [ + { + "source": "{ServiceName}-tsdata", + "target": "/data", + "type": "volume" + } + ], + "restart": "always" }, "{ServiceName}-redis": { - "image": "redis:6.2-alpine", "container_name": "{ServiceName}-redis", "hostname": "{ServiceName}-redis", - "restart": "unless-stopped", - "labels": { - "cosmos-persistent-env": "redis_PASSWORD", - "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png" + "image": "redis:6.2-alpine@sha256:80cc8518800438c684a53ed829c621c94afd1087aaeb59b0d4343ed3e7bcf6c5", + "networks": { + "{ServiceName}": {} }, + "restart": "always" + }, + "{ServiceName}-database": { + "container_name": "{ServiceName}-database", + "hostname": "{ServiceName}-database", + "image": "postgres:14-alpine@sha256:50d9be76e9a90da4c781554955e0ffc79d9d5c4226838e64b36aacc97cbc35ad", + "user": "postgres", "networks": { - "{ServiceName}-databases": {} + "{ServiceName}": {} }, + "labels": { + "cosmos-persistent-env": "POSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DB", + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" + }, + "environment": [ + "POSTGRES_PASSWORD={Passwords.1}", + "POSTGRES_USER=postgres", + "POSTGRES_DB=immich" + ], "volumes": [ { - "source": "{ServiceName}-redis-data", - "target": "/data", + "source": "{ServiceName}-pgdata", + "target": "/var/lib/postgresql/data", "type": "volume" } ], - "environment": [ - "redis_DB=immich", - "redis_PASSWORD={Passwords.0}" - ] + "restart": "always" } {if Context.installImmichBackup} , @@ -140,10 +237,13 @@ "restart": "unless-stopped", "labels": { "cosmos-persistent-env": "POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, DB_DATABASE_NAME", - "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png" + "cosmos-force-network-secured": "true", + "cosmos-auto-update": "false", + "cosmos-icon": "https://azukaar.github.io/cosmos-servapps-official/servapps/Immich/icon.png", + "cosmos-stack": "{ServiceName}" }, "networks": { - "{ServiceName}-databases": {} + "{ServiceName}": {} }, "volumes": [ { @@ -153,23 +253,26 @@ } ], "environment": [ - "POSTGRES_HOST={ServiceName}-postgres", + "POSTGRES_HOST={ServiceName}-database", "POSTGRES_DB=immich", - "POSTGRES_USER=immich", - "POSTGRES_PASSWORD={Passwords.0}", + "POSTGRES_USER=postgres", + "POSTGRES_PASSWORD={Passwords.1}", "SCHEDULE=@daily", "BACKUP_KEEP_DAYS=7", "BACKUP_KEEP_WEEKS=4", "BACKUP_KEEP_MONTHS=6", - "BACKUP_DIR=/db_dumps" + "BACKUP_DIR=/db_dumps", + "PUID=1000", + "PGID=1000" ], "depends_on": [ - "{ServiceName}-postgres" + "{ServiceName}-database" ] } {/if} }, + "networks": { - "{ServiceName}-databases": {} + "{ServiceName}": {} } }