This commit is contained in:
@@ -42,6 +42,11 @@ jobs:
|
|||||||
--from-literal=SECRET_KEY_BASE=$(openssl rand -hex 64) \
|
--from-literal=SECRET_KEY_BASE=$(openssl rand -hex 64) \
|
||||||
--from-literal=AI_TOKEN="$AI_TOKEN"
|
--from-literal=AI_TOKEN="$AI_TOKEN"
|
||||||
|
|
||||||
|
kubectl create configmap db-schema \
|
||||||
|
--from-file=schema.sql=schema.sql \
|
||||||
|
--namespace ai-ha-elixir \
|
||||||
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
for file in kubernetes/*.yml; do
|
for file in kubernetes/*.yml; do
|
||||||
cat "$file" | envsubst | kubectl apply -f -
|
cat "$file" | envsubst | kubectl apply -f -
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ spec:
|
|||||||
value: "elixir_ai"
|
value: "elixir_ai"
|
||||||
- name: POSTGRES_DB
|
- name: POSTGRES_DB
|
||||||
value: "elixir_ai"
|
value: "elixir_ai"
|
||||||
|
volumeMounts:
|
||||||
|
- name: schema
|
||||||
|
mountPath: /docker-entrypoint-initdb.d
|
||||||
|
readOnly: true
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["pg_isready", "-U", "elixir_ai"]
|
command: ["pg_isready", "-U", "elixir_ai"]
|
||||||
@@ -37,6 +41,10 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
cpu: "500m"
|
cpu: "500m"
|
||||||
|
volumes:
|
||||||
|
- name: schema
|
||||||
|
configMap:
|
||||||
|
name: db-schema
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
CREATE TABLE conversations (
|
CREATE TABLE IF NOT EXISTS conversations (
|
||||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
name TEXT NOT NULL UNIQUE,
|
name TEXT NOT NULL UNIQUE,
|
||||||
inserted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
inserted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE messages (
|
CREATE TABLE IF NOT EXISTS messages (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
conversation_id UUID NOT NULL REFERENCES conversations(id) ON DELETE CASCADE,
|
conversation_id UUID NOT NULL REFERENCES conversations(id) ON DELETE CASCADE,
|
||||||
role TEXT NOT NULL CHECK (role IN ('user', 'assistant', 'tool')),
|
role TEXT NOT NULL CHECK (role IN ('user', 'assistant', 'tool')),
|
||||||
|
|||||||
Reference in New Issue
Block a user