/** * Using the docker-compose.yml template from Immich repository as base (with some edits): * https://raw.githubusercontent.com/immich-app/immich/main/docker/docker-compose.yml */ import { Stack } from "../mod.ts"; interface ImmichStackOptions { stackName?: string; immichVersion?: string; postgres?: { password: string; username: string; database: string; }; } export class ImmichStack extends Stack { constructor(props: ImmichStackOptions) { super(props.stackName ?? "immich"); const redis = this.addService("redis", { image: "registry.hub.docker.com/library/redis:6.2-alpine", restart: "unless-stopped", }); // Create default credentials if not provided props.postgres ??= { password: "postgres", username: "postgres", database: "postgres", }; const database = this.addService("database", { image: "registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0", restart: "unless-stopped", environment: { POSTGRES_USER: props.postgres.username, POSTGRES_PASSWORD: props.postgres.password, POSTGRES_DB: props.postgres.database, }, // todo volumes }); const immichEnv = { DB_HOSTNAME: database.name, DB_USERNAME: props.postgres.username, DB_PASSWORD: props.postgres.password, DB_DATABASE_NAME: props.postgres.database, REDIS_HOSTNAME: redis.name, }; const immichServer = this.addService("immich-server", { image: `ghcr.io/immich-app/immich-server:${ props.immichVersion ?? "release" }`, restart: "unless-stopped", command: ["start.sh", "immich"], depends_on: [database.name, redis.name], // todo volumes environment: immichEnv, ports: ["2283:3001"], }); const immichMicroservices = this.addService("immich-microservices", { image: `ghcr.io/immich-app/immich-server:${ props.immichVersion ?? "release" }`, restart: "unless-stopped", command: ["start.sh", "microservices"], depends_on: [database.name, redis.name], // todo volumes environment: immichEnv, }); const immichMachineLearning = this.addService("immich-machine-learning", { image: `ghcr.io/immich-app/immich-machine-learning:${ props.immichVersion ?? "release" }`, // todo volumes environment: immichEnv, }); } } const stack = new ImmichStack({ immichVersion: "v1.100.0" });