Files
claudeandClaude Opus 5.5 7d6eec8963 Harmony on eom.dev: Supabase + Harmony on Kubernetes, Dex sign-in, Catppuccin, LiveKit
Kubernetes port of Harmony 1.9.6's self-host compose stack (Supabase Postgres,
GoTrue, PostgREST, Realtime, storage-api, imgproxy, Kong; Harmony web,
federation server/worker, Redis, media cache, Caddy router; LiveKit) at
harmony.eom.dev, api.harmony.eom.dev and voice.harmony.eom.dev.

- Dex is the only sign-in (GoTrue custom OIDC provider custom:dex); e-mail
  login off; listed addresses become instance admins.
- Upstream bootstrap.sh runs unchanged in a Job through a docker shim.
- Catppuccin Mocha/Latte stylesheet injected into the stock web image.
- Secrets generated once and kept in Secret/harmony.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 17:31:50 -05:00

79 lines
3.7 KiB
Django/Jinja

{%- set labels = {'app.kubernetes.io/name': 'harmony', 'app.kubernetes.io/instance': harmony_name, 'app.kubernetes.io/component': 'bootstrap'} -%}
# Runs Harmony {{ harmony_version }}'s self-host/bootstrap.sh, unchanged, against the database
# Service. files/docker-shim.sh stands in for the docker CLI it expects; the env
# files it reads are written from the instance Secret.
apiVersion: batch/v1
kind: Job
metadata:
name: {{ harmony_name }}-bootstrap
namespace: {{ harmony_namespace }}
labels: {{ labels | to_json }}
spec:
backoffLimit: 2
ttlSecondsAfterFinished: 604800
template:
metadata:
labels: {{ labels | to_json }}
spec:
restartPolicy: Never
enableServiceLinks: false
# On the database's node, always: its image (680 MB) is already there.
# Pulling it on another node evicted the Job on every try, since most
# nodes have only a few GiB of disk free.
affinity: {{ harmony_affinity | combine({'podAffinity': {'requiredDuringSchedulingIgnoredDuringExecution': [{'topologyKey': 'kubernetes.io/hostname', 'labelSelector': {'matchLabels': {'app.kubernetes.io/instance': harmony_name, 'app.kubernetes.io/component': 'db'}}}]}}) | to_json }}
initContainers:
- name: source
image: {{ harmony_git_image }}
imagePullPolicy: {{ harmony_image_pull_policy }}
# Only what bootstrap.sh reads: most nodes have little disk to spare.
command:
- sh
- -euc
- |
git clone --depth 1 --filter=blob:none --sparse --branch "v{{ harmony_version }}" {{ harmony_source_url | quote }} /src/harmony
git -C /src/harmony sparse-checkout set self-host db_schema
resources: {requests: {ephemeral-storage: 256Mi}}
volumeMounts:
- name: src
mountPath: /src
containers:
- name: bootstrap
# The database image: psql, bash and coreutils, matching the server.
image: {{ harmony_postgres_image }}
imagePullPolicy: {{ harmony_image_pull_policy }}
command:
- bash
- -euc
- |
cd /src/harmony/self-host
mkdir -p supabase /shim
install -m 0755 /config/docker /shim/docker
printf 'POSTGRES_PASSWORD=%s\nFILE_SIZE_LIMIT=%s\n' "$PGPASSWORD" "$FILE_SIZE_LIMIT" > supabase/.env
printf 'DOMAIN=%s\nDB_DOMAIN=%s\nINSTANCE_NAME=%s\n' "$DOMAIN" "$DB_DOMAIN" "$INSTANCE_NAME" > .env
printf '__LISTENER_PW=%s\n' "$LISTENER_PASSWORD" > federation.env
export PATH="/shim:$PATH"
exec bash ./bootstrap.sh
env:
- name: PGPASSWORD
valueFrom: {secretKeyRef: {name: {{ harmony_name }}, key: POSTGRES_PASSWORD}}
- name: LISTENER_PASSWORD
valueFrom: {secretKeyRef: {name: {{ harmony_name }}, key: LISTENER_PASSWORD}}
- {name: DB_HOST, value: "supabase-db.{{ harmony_namespace }}.svc.cluster.local"}
- {name: SUPABASE_DB_CONTAINER, value: db}
- {name: FILE_SIZE_LIMIT, value: {{ harmony_file_size_limit | string | to_json }}}
- {name: DOMAIN, value: {{ harmony_domain | to_json }}}
- {name: DB_DOMAIN, value: {{ harmony_api_domain | to_json }}}
- {name: INSTANCE_NAME, value: {{ harmony_instance_name | to_json }}}
resources: {requests: {ephemeral-storage: 512Mi, cpu: 50m, memory: 64Mi}}
volumeMounts:
- name: src
mountPath: /src
- name: config
mountPath: /config
volumes:
- name: src
emptyDir: {}
- name: config
configMap:
name: {{ harmony_name }}-bootstrap