diff --git a/README.md b/README.md index a6f5b96..a55864b 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,103 @@ their speed and answer quality with [BetterBench](https://github.com/GGZ14/Bette You need a Linux server with Docker and Compose, and an OIDC provider for the login (e.g. [Pocket ID](https://pocket-id.org), Authelia, Authentik, Keycloak). -**1. Get the compose file and the config template** +**1. Create a folder with two files** ```bash mkdir kaname && cd kaname +``` + +`compose.yaml` (same as [`deploy/compose.yaml`](deploy/compose.yaml)): + +```yaml +# Kaname: put this file and a filled-in .env (from .env.example) in one folder, then +# docker compose up -d +name: kaname + +services: + web: + image: git.linxweiler.xyz/pascallinxweiler/kaname:${KANAME_VERSION:-latest} + env_file: .env + ports: + - "3000:3000" + volumes: + - ./data:/data + restart: unless-stopped + + worker: + image: git.linxweiler.xyz/pascallinxweiler/kaname:${KANAME_VERSION:-latest} + command: worker + env_file: .env + environment: + SANDBOX_DIR: /sandbox + volumes: + - ./data:/data + - ./models:/models # where models are downloaded to, e.g. /mnt/models + - sandbox:/sandbox + restart: unless-stopped + + # Runs the coding answers of the quality eval (Python written by the model under test), locked + # down: no network, no secrets, read-only. Optional: without it the eval skips the coding part. + sandbox: + image: git.linxweiler.xyz/pascallinxweiler/kaname:${KANAME_VERSION:-latest} + command: sandbox + user: "65534:65534" + network_mode: none + read_only: true + tmpfs: + - /tmp:size=64m,mode=1777 + cap_drop: [ALL] + security_opt: ["no-new-privileges:true"] + mem_limit: 512m + pids_limit: 64 + cpus: 1 + volumes: + - sandbox:/sandbox + depends_on: [worker] + restart: unless-stopped + +volumes: + sandbox: +``` + +The database goes to `./data` and models to `./models` next to this file. To keep models somewhere +else (e.g. a NAS share mounted on the host), change the worker's `./models:/models` line, e.g. to +`/mnt/models:/models`. To use another port, change the left side of `"3000:3000"`. + +`.env` (same as [`.env.example`](.env.example)): + +```env +# Kaname settings: copy to .env next to compose.yaml and fill in. +# All options: https://git.linxweiler.xyz/pascallinxweiler/Kaname/wiki/Configuration + +# Read-only Hugging Face token (needed for gated repos, higher rate limits) +HF_TOKEN= +MAX_CONCURRENT_DOWNLOADS=1 +UPDATE_CHECK_INTERVAL_HOURS=12 + +# Login. AUTH_URL is the address you open Kaname at; register +# /api/auth/callback/pocket-id as redirect URI with your OIDC provider. +# AUTH_SECRET: any random string (openssl rand -base64 32); empty = generated on first start. +AUTH_SECRET= +AUTH_URL=http://localhost:3000 +OIDC_ISSUER=https://auth.example.com +OIDC_CLIENT_ID= +OIDC_CLIENT_SECRET= +# Optional, comma-separated: only these groups may log in +OIDC_ALLOWED_GROUPS= + +# Optional: pin an image version (default: latest) +# KANAME_VERSION=0.22.0 +# Optional: user/group Kaname runs as (default 1000); set to the owner of your models folder +# PUID=1000 +# PGID=1000 +# Optional: launch80.com publish token, to publish benchmark runs +# L80_TOKEN= +``` + +Or download both instead of copying: + +```bash curl -fsSLo compose.yaml https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/main/deploy/compose.yaml curl -fsSLo .env https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/main/.env.example ``` @@ -42,11 +135,15 @@ curl -fsSLo .env https://git.linxweiler.xyz/pascallinxweiler/Kaname/raw/branch/m restrict access by group. **3. Fill in `.env`:** `AUTH_URL` (the address you open in the browser), `OIDC_ISSUER`, -`OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`, and ideally a read-only `HF_TOKEN`. That's all; the rest -has defaults: +`OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`, and ideally a read-only `HF_TOKEN`. Everything else can +stay as it is. A filled-in example: ```env HF_TOKEN=hf_... +MAX_CONCURRENT_DOWNLOADS=1 +UPDATE_CHECK_INTERVAL_HOURS=12 + +AUTH_SECRET= AUTH_URL=http://192.168.1.10:3000 OIDC_ISSUER=https://auth.example.com OIDC_CLIENT_ID=... @@ -54,10 +151,6 @@ OIDC_CLIENT_SECRET=... OIDC_ALLOWED_GROUPS=admin ``` -The database goes to `./data` and models to `./models` next to the compose file. To keep models -somewhere else (e.g. a NAS share mounted on the host), change the worker's `./models:/models` line -in `compose.yaml`, e.g. to `/mnt/models:/models`. The port is the `"3000:3000"` line. - **4. Start** ```bash