diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/NOTES.txt b/deployment/kubernetes/charts/medcat-trainer-helm/templates/NOTES.txt index b61c086..6490226 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/NOTES.txt +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/NOTES.txt @@ -15,7 +15,7 @@ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "medcat-trainer-helm.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - 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}") + 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}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[?(@.name==\"nginx\")].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml index 8d2cc29..3e86434 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-configmap.yaml @@ -38,4 +38,8 @@ data: stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 - autorestart=true \ No newline at end of file + autorestart=true +{{- if and .Values.provisioning .Values.provisioning.enabled }} + provisioning.yaml: | +{{ toYaml .Values.provisioning.config | indent 4 }} +{{- end }} \ No newline at end of file diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml index a2ec2bd..d2ac692 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-deployment.yaml @@ -85,6 +85,11 @@ spec: name: api-media - mountPath: /home/api/static name: api-static + {{- if and .Values.provisioning .Values.provisioning.enabled }} + - mountPath: /home/configs/provisioning.yaml + name: medcat-trainer-config + subPath: provisioning.yaml + {{- end }} {{- if eq .Values.DB_ENGINE "sqlite3" }} - mountPath: /home/api/db name: api-db diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-env-configmap.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-env-configmap.yaml index c6cda56..733b2b1 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-env-configmap.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/templates/medcat-trainer-env-configmap.yaml @@ -14,6 +14,10 @@ data: DB_PATH: "/home/api/db/db.sqlite3" MCT_VERSION: {{ .Values.image.tag | default .Chart.AppVersion }} API_URL: http://localhost:{{ .Values.service.apiPort }}/api/ + {{- if and .Values.provisioning .Values.provisioning.enabled }} + LOAD_EXAMPLES: "1" + PROVISIONING_CONFIG_PATH: "/home/configs/provisioning.yaml" + {{- end }} {{- range $key, $value := .Values.env }} {{ $key }}: {{ $value | quote }} {{- end }} \ No newline at end of file diff --git a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml index 6829067..70ab339 100644 --- a/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml +++ b/deployment/kubernetes/charts/medcat-trainer-helm/values.yaml @@ -26,7 +26,6 @@ env: EMAIL_PORT: "465" EMAIL_USER: "example@cogstack.org" ENV: "non-prod" - LOAD_EXAMPLES: "0" LOAD_NUM_DOC_PAGES: "10" MAX_DATASET_SIZE: "10000" MAX_MEDCAT_MODELS: "2" @@ -40,6 +39,24 @@ env: DB_ENGINE: "postgresql" DB_PORT: "5432" +provisioning: + # -- Set to true to enable provisioning of projects and models on startup.. + enabled: false + # -- Put yaml file contents here.See https://docs.cogstack.org/projects/medcat-trainer/en/latest/provisioning/ + config: + projects: + - dataset: + name: "Example Dataset - psych.csv" + url: "https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + description: "Dataset from https://raw.githubusercontent.com/CogStack/cogstack-nlp/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-trainer/notebook_docs/example_data/psych.csv" + modelPack: + name: "Example Model Pack" + url: "https://github.com/CogStack/cogstack-nlp/raw/be9825f151da2d3b6faac80d49e5be91a1629c68/medcat-service/models/examples/example-medcat-v2-model-pack.zip" + project: + name: "Example Project" + description: "Example project for medcat trainer" + annotationGuidelineLink: "https://docs.google.com/document/d/1xxelBOYbyVzJ7vLlztP2q1Kw9F5Vr1pRwblgrXPS7QM/edit?usp=sharing" + postgresql: enabled: true # TODO: Support custom DB overrides diff --git a/deployment/kubernetes/local_dev_startup.sh b/deployment/kubernetes/local_dev_startup.sh index 13c8330..ddc876c 100644 --- a/deployment/kubernetes/local_dev_startup.sh +++ b/deployment/kubernetes/local_dev_startup.sh @@ -20,7 +20,7 @@ helm test medcat-service --logs # Test medcat trainer # kubectl port-forward svc/nginx 8000:8000 -# helm upgrade x ./medcat-trainer-helm --install --wait --timeout 5m0s # Install if it doesnt already exist, else upgrade +# helm upgrade medcat-trainer-helm ./medcat-trainer-helm --install --wait --timeout 5m0s # Install if it doesnt already exist, else upgrade # kubectl port-forward svc/medcat-trainer-solr 8983:8983 ## helm install trainer-registry oci://registry-1.docker.io/cogstacksystems/medcat-trainer-helm --wait --timeout 5m0s