2024-04-07 15:40:32 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
import { Stack } from "../mod.ts";
|
2024-04-07 15:40:32 +00:00
|
|
|
|
2024-04-07 15:56:33 +00:00
|
|
|
interface ImmichStackOptions {
|
2024-04-07 16:25:12 +00:00
|
|
|
stackName?: string;
|
2024-04-07 15:56:33 +00:00
|
|
|
immichVersion?: string;
|
|
|
|
|
|
|
|
postgres?: {
|
2024-04-07 15:40:32 +00:00
|
|
|
password: string;
|
|
|
|
username: string;
|
|
|
|
database: string;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
export class ImmichStack extends Stack {
|
|
|
|
constructor(props: ImmichStackOptions) {
|
|
|
|
super(props.stackName ?? "immich");
|
2024-04-07 15:40:32 +00:00
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
const redis = this.addService("redis", {
|
|
|
|
image: "registry.hub.docker.com/library/redis:6.2-alpine",
|
|
|
|
restart: "unless-stopped",
|
|
|
|
});
|
2024-04-07 15:40:32 +00:00
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
// Create default credentials if not provided
|
|
|
|
props.postgres ??= {
|
|
|
|
password: "postgres",
|
|
|
|
username: "postgres",
|
|
|
|
database: "postgres",
|
|
|
|
};
|
2024-04-07 15:40:32 +00:00
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
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
|
|
|
|
});
|
2024-04-07 15:43:00 +00:00
|
|
|
|
2024-04-07 16:49:04 +00:00
|
|
|
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,
|
|
|
|
};
|
2024-04-07 15:40:32 +00:00
|
|
|
|
2024-04-08 17:33:39 +00:00
|
|
|
const _immichServer = this.addService("immich-server", {
|
2024-04-07 16:49:04 +00:00
|
|
|
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"],
|
|
|
|
});
|
2024-04-07 15:43:00 +00:00
|
|
|
|
2024-04-08 17:33:39 +00:00
|
|
|
const _immichMicroservices = this.addService("immich-microservices", {
|
2024-04-07 16:49:04 +00:00
|
|
|
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,
|
|
|
|
});
|
2024-04-07 15:43:00 +00:00
|
|
|
|
2024-04-08 17:33:39 +00:00
|
|
|
const _immichMachineLearning = this.addService("immich-machine-learning", {
|
2024-04-07 16:49:04 +00:00
|
|
|
image: `ghcr.io/immich-app/immich-machine-learning:${
|
|
|
|
props.immichVersion ?? "release"
|
|
|
|
}`,
|
|
|
|
// todo volumes
|
|
|
|
environment: immichEnv,
|
|
|
|
});
|
|
|
|
}
|
2024-04-07 15:40:32 +00:00
|
|
|
}
|
2024-04-07 15:56:33 +00:00
|
|
|
|
2024-04-08 17:33:39 +00:00
|
|
|
const _stack = new ImmichStack({ immichVersion: "v1.100.0" });
|