(feat) helm hook to sync db schema (#6715)

* v0 migration job

* fix job
This commit is contained in:
Ishaan Jaff 2024-11-12 11:58:35 -08:00 committed by GitHub
parent 5081b912eb
commit 688d513459
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,27 @@
"""
This job runs the prisma migrations for the LiteLLM DB.
"""
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "litellm.fullname" . }}-migrations
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "0"
spec:
template:
spec:
containers:
- name: prisma-migrations
image: "ghcr.io/berriai/litellm:main-stable"
command: ["python", "/litellm/proxy/prisma_migration.py"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Values.db.secret.name }}
key: url
- name: DISABLE_SCHEMA_UPDATE
value: "{{ .Values.migrationJob.disableSchemaUpdate }}"
restartPolicy: OnFailure
backoffLimit: {{ .Values.migrationJob.backoffLimit }}

View file

@ -179,3 +179,12 @@ postgresql:
redis:
enabled: false
architecture: standalone
# Prisma migration job settings
migrationJob:
enabled: true # Enable or disable the schema migration Job
retries: 3 # Number of retries for the Job in case of failure
backoffLimit: 4 # Backoff limit for Job restarts
disableSchemaUpdate: false # Skip schema migrations for specific environments. When True, the job will exit with code 0.