check in!
This commit is contained in:
commit
942e7a04f5
3 changed files with 76 additions and 0 deletions
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# containerlib
|
||||||
|
|
||||||
|
AWS CDK but for normal people. Don't worry about scaling and AWS bills, just rent a VPS and run my randomly-named services on it! I'm no Jia Tan but a man can dream.
|
||||||
|
|
||||||
|
Also this is only going to be tested with Deno. You deserve better than node.
|
||||||
|
|
||||||
|
## World domination plan
|
||||||
|
|
||||||
|
Current status: v0 - It doesn't work!!
|
||||||
|
|
||||||
|
### v1: docker-compose
|
||||||
|
|
||||||
|
Initially, containerlib will return docker-compose.yml files. This allows quick implementation and moving from existing Portainer setups to staxman.
|
||||||
|
|
||||||
|
### v2: rewrite internally
|
||||||
|
|
||||||
|
Post-MVP, containerlib will return an intermediary state representation (akin to Kubernetes manifests) that serverman can use to control OCI containers via docker API. This is basically integrating the docker-compose functionality directly within serverman.
|
59
example/immich.ts
Normal file
59
example/immich.ts
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface ImmichStackOptions {
|
||||||
|
immichVersion: string;
|
||||||
|
|
||||||
|
postgres: {
|
||||||
|
password: string;
|
||||||
|
username: string;
|
||||||
|
database: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function immichStack(props: ImmichStackOptions) {
|
||||||
|
const redis = new Service("redis", {
|
||||||
|
image: "registry.hub.docker.com/library/redis:6.2-alpine",
|
||||||
|
restart: "unless-stopped",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create default credentials if not provided
|
||||||
|
props.postgres.username ??= "postgres";
|
||||||
|
props.postgres.password ??= "postgres";
|
||||||
|
props.postgres.database ??= "postgres";
|
||||||
|
|
||||||
|
const database = new Service("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 immichServer = new Service("immich-server", {
|
||||||
|
image: `ghcr.io/immich-app/immich-server:${
|
||||||
|
props.immichVersion ?? "release"
|
||||||
|
}`,
|
||||||
|
restart: "unless-stopped",
|
||||||
|
command: ["start.sh", "immich"],
|
||||||
|
dependsOn: [database, redis],
|
||||||
|
// todo volumes
|
||||||
|
environment: {
|
||||||
|
DB_HOSTNAME: database.name,
|
||||||
|
DB_USERNAME: props.postgres.username,
|
||||||
|
DB_PASSWORD: props.postgres.password,
|
||||||
|
DB_DATABASE_NAME: props.postgres.database,
|
||||||
|
REDIS_HOSTNAME: redis.name,
|
||||||
|
},
|
||||||
|
ports: ["2283:3001"],
|
||||||
|
});
|
||||||
|
|
||||||
|
return new Stack("immich", {
|
||||||
|
services: [redis, database, immichServer],
|
||||||
|
});
|
||||||
|
}
|
0
mod.ts
Normal file
0
mod.ts
Normal file
Loading…
Reference in a new issue