48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
# Run this init job once to create the Open WebUI database and user on the
|
|
# existing postgres-hetzner instance.
|
|
#
|
|
# This manifest references the existing postgres-secret in the database namespace.
|
|
# If your secret has a different name or key, update the env block below.
|
|
#
|
|
# Then:
|
|
# 1. kubectl apply -f Ollama/openwebui_db_setup.yaml
|
|
# 2. kubectl wait job/openwebui-db-setup -n database --for=condition=complete
|
|
# 3. kubectl delete -f Ollama/openwebui_db_setup.yaml
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: openwebui-db-setup
|
|
namespace: database
|
|
spec:
|
|
template:
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
imagePullSecrets:
|
|
- name: registry-creds
|
|
containers:
|
|
- name: psql
|
|
image: rg.mariushome.lt/custom-postgres
|
|
imagePullPolicy: Always
|
|
env:
|
|
- name: PGUSER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: POSTGRES_USER
|
|
- name: PGPASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-secret
|
|
key: POSTGRES_PASSWORD
|
|
command:
|
|
- /bin/sh
|
|
- -c
|
|
- |
|
|
psql -h postgres.database.svc.cluster.local -d postgres -e <<'SQL'
|
|
CREATE USER openwebui WITH PASSWORD '6b44a0043b23368a18b6aa940dd30ae7299a77dcd2e555f554c51066a1e4e76f';
|
|
CREATE DATABASE openwebui OWNER openwebui;
|
|
\c openwebui
|
|
CREATE EXTENSION IF NOT EXISTS vector;
|
|
GRANT ALL PRIVILEGES ON DATABASE openwebui TO openwebui;
|
|
SQL
|