Skip to content

Commit fbba616

Browse files
feat(helm): Add Medcat-trainer startup provisioning (#49)
1 parent 7d18e44 commit fbba616

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

deployment/kubernetes/charts/medcat-trainer-helm/templates/NOTES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "medcat-trainer-helm.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
1616
echo http://$SERVICE_IP:{{ .Values.service.port }}
1717
{{- else if contains "ClusterIP" .Values.service.type }}
18-
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "medcat-trainer-helm.name" . }},app.kubernetes.io/instance={{ .Release.Name }},app.kubernetes.io/component=medcat-trainer" -o jsonpath="{.items[0].metadata.name}")
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "medcat-trainer-helm.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
1919
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[?(@.name==\"nginx\")].ports[0].containerPort}")
2020
echo "Visit http://127.0.0.1:8080 to use your application"
2121
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT

deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ data:
3838
stdout_logfile_maxbytes=0
3939
stderr_logfile=/dev/stderr
4040
stderr_logfile_maxbytes=0
41-
autorestart=true
41+
autorestart=true
42+
{{- if and .Values.provisioning .Values.provisioning.enabled }}
43+
provisioning.yaml: |
44+
{{ toYaml .Values.provisioning.config | indent 4 }}
45+
{{- end }}

deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ spec:
8585
name: api-media
8686
- mountPath: /home/api/static
8787
name: api-static
88+
{{- if and .Values.provisioning .Values.provisioning.enabled }}
89+
- mountPath: /home/configs/provisioning.yaml
90+
name: medcat-trainer-config
91+
subPath: provisioning.yaml
92+
{{- end }}
8893
{{- if eq .Values.DB_ENGINE "sqlite3" }}
8994
- mountPath: /home/api/db
9095
name: api-db

deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-env-configmap.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ data:
1414
DB_PATH: "/home/api/db/db.sqlite3"
1515
MCT_VERSION: {{ .Values.image.tag | default .Chart.AppVersion }}
1616
API_URL: http://localhost:{{ .Values.service.apiPort }}/api/
17+
{{- if and .Values.provisioning .Values.provisioning.enabled }}
18+
LOAD_EXAMPLES: "1"
19+
PROVISIONING_CONFIG_PATH: "/home/configs/provisioning.yaml"
20+
{{- end }}
1721
{{- range $key, $value := .Values.env }}
1822
{{ $key }}: {{ $value | quote }}
1923
{{- end }}

deployment/kubernetes/charts/medcat-trainer-helm/values.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ env:
2626
EMAIL_PORT: "465"
2727
EMAIL_USER: "[email protected]"
2828
ENV: "non-prod"
29-
LOAD_EXAMPLES: "0"
3029
LOAD_NUM_DOC_PAGES: "10"
3130
MAX_DATASET_SIZE: "10000"
3231
MAX_MEDCAT_MODELS: "2"
@@ -40,6 +39,24 @@ env:
4039
DB_ENGINE: "postgresql"
4140
DB_PORT: "5432"
4241

42+
provisioning:
43+
# -- Set to true to enable provisioning of projects and models on startup..
44+
enabled: false
45+
# -- Put yaml file contents here.See https://docs.cogstack.org/projects/medcat-trainer/en/latest/provisioning/
46+
config:
47+
projects:
48+
- dataset:
49+
name: "Example Dataset - psych.csv"
50+
url: "https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv"
51+
description: "Dataset from https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv"
52+
modelPack:
53+
name: "Example Model Pack"
54+
url: "https://github.com/CogStack/cogstack-nlp/raw/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-service/models/examples/example-medcat-v2-model-pack.zip"
55+
project:
56+
name: "Example Project"
57+
description: "Example project for medcat trainer"
58+
annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing"
59+
4360
postgresql:
4461
enabled: true
4562
# TODO: Support custom DB overrides

deployment/kubernetes/local_dev_startup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ helm test medcat-service --logs
2020
# Test medcat trainer
2121
# kubectl port-forward svc/nginx 8000:8000
2222

23-
# helm upgrade x ./medcat-trainer-helm --install --wait --timeout 5m0s # Install if it doesnt already exist, else upgrade
23+
# helm upgrade medcat-trainer-helm ./medcat-trainer-helm --install --wait --timeout 5m0s # Install if it doesnt already exist, else upgrade
2424
# kubectl port-forward svc/medcat-trainer-solr 8983:8983
2525

2626
## helm install trainer-registry oci://registry-1.docker.io/cogstacksystems/medcat-trainer-helm --wait --timeout 5m0s

0 commit comments

Comments
 (0)