├── .github ├── labeler.yml ├── CODEOWNERS ├── workflows │ ├── add-label-to-pr.yml │ ├── add-pr-to-prj.yml │ ├── integration-test-release.yml │ ├── helm-integration-test-release.yml │ ├── semantic.yml │ ├── integration-test-latest.yml │ ├── helm-integration-test-latest.yml │ ├── make-all.yml │ ├── make-latest.yml │ ├── releases-helm-charts.yml │ ├── releases.yml │ ├── integration-test-backend.yml │ └── helm-integration-test-backend.yml └── CONTRIBUTING.md ├── release-please ├── manifest.json └── config.json ├── test ├── load │ ├── data │ │ ├── dog.jpg │ │ ├── bear.jpg │ │ ├── dance.jpg │ │ ├── street.png │ │ ├── street2.png │ │ ├── sign-small.jpg │ │ ├── dwaynejohnson.jpeg │ │ ├── sample_stomata.jpg │ │ └── emergency-evacuation-route-signpost.jpg │ ├── const.js │ ├── load_test.js │ └── verify-yolov7-stomata.js └── Makefile ├── charts └── model │ ├── charts │ └── kuberay-operator-1.0.0.tgz │ ├── templates │ ├── NOTES.txt │ ├── internal │ │ └── auto-tls.yaml │ ├── controller-model │ │ ├── service.yaml │ │ ├── hpa.yml │ │ ├── configmap.yaml │ │ └── deployment.yaml │ ├── model-backend │ │ ├── service.yaml │ │ ├── hpa.yml │ │ ├── post-install-job.yaml │ │ ├── configmap.yaml │ │ └── deployment.yaml │ ├── ray-service │ │ ├── monitor.yaml │ │ └── ray-service.yaml │ ├── pvc.yaml │ └── _helpers.tpl │ ├── Chart.lock │ ├── Chart.yaml │ ├── README.md.gotmpl │ ├── LICENSE │ ├── README.md │ └── values.yaml ├── docker-compose.nvidia.yml ├── .pre-commit-config.yaml ├── docker-compose.build.yml ├── model-hub ├── model_hub_cpu_test.json ├── model_hub_cpu.json └── model_hub_gpu.json ├── Dockerfile ├── docker-compose.latest.yml ├── .env ├── LICENSE ├── CHANGELOG.md ├── docker-compose.yml ├── README.md └── Makefile /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | instill model: 2 | - "**" 3 | -------------------------------------------------------------------------------- /release-please/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "0.10.0-alpha" 3 | } 4 | -------------------------------------------------------------------------------- /test/load/data/dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/dog.jpg -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | 2 | * @heiruwu @donch1989 @jvallesm @Sarthak-instill 3 | 4 | .github @Sarthak-instill 5 | -------------------------------------------------------------------------------- /test/load/data/bear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/bear.jpg -------------------------------------------------------------------------------- /test/load/data/dance.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/dance.jpg -------------------------------------------------------------------------------- /test/load/data/street.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/street.png -------------------------------------------------------------------------------- /test/load/data/street2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/street2.png -------------------------------------------------------------------------------- /test/load/data/sign-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/sign-small.jpg -------------------------------------------------------------------------------- /test/load/data/dwaynejohnson.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/dwaynejohnson.jpeg -------------------------------------------------------------------------------- /test/load/data/sample_stomata.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/sample_stomata.jpg -------------------------------------------------------------------------------- /charts/model/charts/kuberay-operator-1.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/charts/model/charts/kuberay-operator-1.0.0.tgz -------------------------------------------------------------------------------- /test/load/data/emergency-evacuation-route-signpost.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/instill-ai/deprecated-model/HEAD/test/load/data/emergency-evacuation-route-signpost.jpg -------------------------------------------------------------------------------- /charts/model/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | You have installed/deployed: 2 | 3 | Chart name: {{ .Chart.Name }} 4 | Release name: {{ .Release.Name }} 5 | Fullname of k8s objects: {{ include "model.fullname" . }} 6 | -------------------------------------------------------------------------------- /docker-compose.nvidia.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | ray_server: 5 | deploy: 6 | resources: 7 | reservations: 8 | devices: 9 | - driver: nvidia 10 | device_ids: [] 11 | capabilities: [gpu] 12 | -------------------------------------------------------------------------------- /charts/model/Chart.lock: -------------------------------------------------------------------------------- 1 | dependencies: 2 | - name: kuberay-operator 3 | repository: https://ray-project.github.io/kuberay-helm/ 4 | version: 1.0.0 5 | digest: sha256:687bfc40486b8054262884a5148f23d6375ff5925ae22b03834c10bb1acb918a 6 | generated: "2023-11-16T00:26:44.444775+08:00" 7 | -------------------------------------------------------------------------------- /release-please/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": { 4 | "release-type": "simple", 5 | "draft": false, 6 | "prerelease": true, 7 | "bump-minor-pre-major": true, 8 | "bump-patch-for-minor-pre-major": false, 9 | "extra-files": ["README.md"] 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/add-label-to-pr.yml: -------------------------------------------------------------------------------- 1 | name: Add Label to PR 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | - synchronize 8 | 9 | jobs: 10 | triage: 11 | uses: instill-ai/.github/.github/workflows/add-label-to-pr.yml@main 12 | secrets: 13 | botGitHubToken: ${{ secrets.botGitHubToken }} 14 | -------------------------------------------------------------------------------- /.github/workflows/add-pr-to-prj.yml: -------------------------------------------------------------------------------- 1 | name: Add PR to Project 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | track_pr: 10 | uses: instill-ai/.github/.github/workflows/add-to-prj.yml@main 11 | with: 12 | project_number: 5 13 | secrets: 14 | botGitHubToken: ${{ secrets.botGitHubToken }} 15 | -------------------------------------------------------------------------------- /.github/workflows/integration-test-release.yml: -------------------------------------------------------------------------------- 1 | name: Integration Test (release) 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | backend: 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | component: [model-backend] 12 | uses: instill-ai/model/.github/workflows/integration-test-backend.yml@main 13 | with: 14 | component: ${{ matrix.component }} 15 | target: release 16 | -------------------------------------------------------------------------------- /.github/workflows/helm-integration-test-release.yml: -------------------------------------------------------------------------------- 1 | name: Helm Integration Test (release) 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | backend: 8 | strategy: 9 | fail-fast: false 10 | matrix: 11 | component: [model-backend] 12 | uses: instill-ai/model/.github/workflows/helm-integration-test-backend.yml@main 13 | with: 14 | component: ${{ matrix.component }} 15 | target: release 16 | -------------------------------------------------------------------------------- /.github/workflows/semantic.yml: -------------------------------------------------------------------------------- 1 | name: "Lint PR" 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | - edited 8 | - synchronize 9 | 10 | jobs: 11 | main: 12 | name: Validate PR title 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: amannn/action-semantic-pull-request@v4 16 | with: 17 | requireScope: true 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 20 | -------------------------------------------------------------------------------- /.github/workflows/integration-test-latest.yml: -------------------------------------------------------------------------------- 1 | name: Integration Test (latest) 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches-ignore: 7 | - release-please--branches--main 8 | 9 | jobs: 10 | backend: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | component: [model-backend] 15 | uses: instill-ai/model/.github/workflows/integration-test-backend.yml@main 16 | with: 17 | component: ${{ matrix.component }} 18 | target: latest 19 | -------------------------------------------------------------------------------- /.github/workflows/helm-integration-test-latest.yml: -------------------------------------------------------------------------------- 1 | name: Helm Integration Test (latest) 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches-ignore: 7 | - release-please--branches--main 8 | 9 | jobs: 10 | backend: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | component: [model-backend] 15 | uses: instill-ai/model/.github/workflows/helm-integration-test-backend.yml@main 16 | with: 17 | component: ${{ matrix.component }} 18 | target: latest 19 | -------------------------------------------------------------------------------- /charts/model/templates/internal/auto-tls.yaml: -------------------------------------------------------------------------------- 1 | {{- if and .Values.internalTLS.enabled (eq .Values.internalTLS.certSource "auto") }} 2 | {{- $ca := genCA "model-internal-ca" 365 }} 3 | {{- $modelCN := (include "model.modelBackend" .) }} 4 | {{- $modelCrt := genSignedCert $modelCN (list "127.0.0.1") (list "localhost" $modelCN) 365 $ca }} 5 | apiVersion: v1 6 | kind: Secret 7 | metadata: 8 | name: "{{ template "model.internalTLS.modelBackend.secretName" . }}" 9 | labels: 10 | {{- include "model.labels" . | nindent 4 }} 11 | type: kubernetes.io/tls 12 | data: 13 | tls.crt: {{ $modelCrt.Cert | b64enc | quote }} 14 | tls.key: {{ $modelCrt.Key | b64enc | quote }} 15 | {{- end }} 16 | -------------------------------------------------------------------------------- /charts/model/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: model 3 | description: The Helm chart of Instill Model 4 | type: application 5 | version: 0.1.16-alpha #! auto-updated by the CI workflow 6 | appVersion: 0.10.0-alpha #! auto-updated by the CI workflow 7 | keywords: 8 | - unstructured data 9 | - pipeline 10 | - ETL/ELT 11 | - AI 12 | - Data 13 | sources: 14 | - https://github.com/instill-ai/model 15 | home: "https://www.instill.tech" 16 | icon: https://storage.googleapis.com/public-europe-west2-c-artifacts/imgs/helm-model-logo.png 17 | maintainers: 18 | - name: Instill AI LTD 19 | url: https://github.com/instill-ai 20 | dependencies: 21 | - name: kuberay-operator 22 | repository: https://ray-project.github.io/kuberay-helm/ 23 | version: 1.0.0 24 | -------------------------------------------------------------------------------- /charts/model/templates/controller-model/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ template "model.controllerModel" . }} 5 | labels: 6 | {{- include "model.labels" . | nindent 4 }} 7 | app.kubernetes.io/component: controller-model 8 | {{- with .Values.controllerModel.serviceAnnotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | spec: 13 | ports: 14 | - name: {{ ternary "https" "http" .Values.internalTLS.enabled }}-private 15 | port: {{ template "model.controllerModel.privatePort" . }} 16 | targetPort: {{ template "model.controllerModel.privatePort" . }} 17 | selector: 18 | {{- include "model.matchLabels" . | nindent 4 }} 19 | app.kubernetes.io/component: controller-model 20 | -------------------------------------------------------------------------------- /charts/model/templates/model-backend/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ template "model.modelBackend" . }} 5 | labels: 6 | {{- include "model.labels" . | nindent 4 }} 7 | app.kubernetes.io/component: model-backend 8 | {{- with .Values.modelBackend.serviceAnnotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | spec: 13 | ports: 14 | - name: {{ ternary "https" "http" .Values.internalTLS.enabled }}-private 15 | port: {{ template "model.modelBackend.privatePort" . }} 16 | targetPort: {{ template "model.modelBackend.privatePort" . }} 17 | - name: {{ ternary "https" "http" .Values.internalTLS.enabled }}-public 18 | port: {{ template "model.modelBackend.publicPort" . }} 19 | targetPort: {{ template "model.modelBackend.publicPort" . }} 20 | selector: 21 | {{- include "model.matchLabels" . | nindent 4 }} 22 | app.kubernetes.io/component: model-backend 23 | -------------------------------------------------------------------------------- /charts/model/README.md.gotmpl: -------------------------------------------------------------------------------- 1 | {{ template "chart.header" . }} 2 | 3 | {{ template "chart.deprecationWarning" . }} 4 | 5 | {{ template "chart.versionBadge" . }}{{ template "chart.appVersionBadge" . }}{{ template "chart.typeBadge" . }} 6 | 7 | {{ template "chart.description" . }} 8 | 9 | # Requirements 10 | 11 | {{ template "chart.requirementsTable" . }} 12 | 13 | ## Install 14 | 15 | Once Helm has been set up correctly, add the repo as follows: 16 | 17 | ```bash 18 | helm repo add instill-ai https://helm.instill.tech 19 | ``` 20 | 21 | If you had already added this repo earlier, run `helm repo update` to retrieve 22 | the latest versions of the packages. You can then run `helm search repo model --devel` to see the charts. 23 | 24 | To install the chart (alpha version): 25 | 26 | ```bash 27 | helm install instill-ai/model --devel 28 | ``` 29 | 30 | ## Uninstall 31 | 32 | To uninstall the chart: 33 | 34 | ```bash 35 | helm uninstall 36 | ``` 37 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.5.0 4 | hooks: 5 | - id: check-yaml 6 | exclude: ^charts 7 | - id: end-of-file-fixer 8 | - id: trailing-whitespace 9 | - repo: https://github.com/dnephin/pre-commit-golang 10 | rev: v0.5.1 11 | hooks: 12 | - id: golangci-lint 13 | - id: go-mod-tidy 14 | - repo: https://github.com/pinglin/conventional-pre-commit 15 | rev: v1.1.0 16 | hooks: 17 | - id: conventional-pre-commit 18 | stages: [commit-msg] 19 | - repo: local 20 | hooks: 21 | - id: helm-lint 22 | name: Helm Lint 23 | entry: bash -c 'helm lint --strict charts/**' 24 | language: system 25 | - repo: https://github.com/norwoodj/helm-docs 26 | rev: v1.12.0 27 | hooks: 28 | - id: helm-docs 29 | args: 30 | - --chart-search-root=charts 31 | - --template-files=README.md.gotmpl 32 | -------------------------------------------------------------------------------- /docker-compose.build.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | model_backend: 5 | profiles: 6 | - all 7 | - exclude-api-gateway 8 | - exclude-mgmt 9 | - exclude-console 10 | - exclude-pipeline 11 | - exclude-controller-model 12 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 13 | build: 14 | context: ./${MODEL_BACKEND_HOST} 15 | args: 16 | SERVICE_NAME: ${MODEL_BACKEND_HOST} 17 | GOLANG_VERSION: ${GOLANG_VERSION} 18 | K6_VERSION: ${K6_VERSION} 19 | UBUNTU_VERSION: ${UBUNTU_VERSION} 20 | ARTIVC_VERSION: ${ARTIVC_VERSION} 21 | 22 | controller_model: 23 | profiles: 24 | - all 25 | - exclude-api-gateway 26 | - exclude-mgmt 27 | - exclude-console 28 | - exclude-pipeline 29 | - exclude-model 30 | image: ${CONTROLLER_MODEL_IMAGE}:${CONTROLLER_MODEL_VERSION} 31 | build: 32 | context: ./${CONTROLLER_MODEL_HOST} 33 | args: 34 | SERVICE_NAME: ${CONTROLLER_MODEL_HOST} 35 | GOLANG_VERSION: ${GOLANG_VERSION} 36 | K6_VERSION: ${K6_VERSION} 37 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL:=help 2 | 3 | #============================================================================ 4 | # Load environment variables for local development 5 | 6 | 7 | API_GATEWAY_HOST := localhost 8 | API_GATEWAY_PORT := 8080 9 | 10 | #============================================================================ 11 | 12 | .PHONY: prepare-k6 13 | prepare-k6: ## Prepare K6 14 | @go version 15 | @go install go.k6.io/xk6/cmd/xk6@latest 16 | @xk6 build --with github.com/szkiba/xk6-jose@latest 17 | 18 | .PHONY: cleanup-k6 19 | cleanup-k6: ## Cleanup K6 20 | @rm k6 21 | 22 | 23 | .PHONY: load-test 24 | load-test: ## Test Text to Image model 25 | @TEST_FOLDER_ABS_PATH=${PWD} k6 run \ 26 | -e API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT} \ 27 | -e API_GATEWAY_PROTOCOL=http \ 28 | ./load/load_test.js --no-usage-report 29 | 30 | .PHONY: help 31 | help: ## Show this help 32 | @echo "\nTest models" 33 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m (default: help)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 34 | -------------------------------------------------------------------------------- /charts/model/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Instill AI Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /charts/model/templates/model-backend/hpa.yml: -------------------------------------------------------------------------------- 1 | {{- if .Values.modelBackend.autoscaling.enabled }} 2 | apiVersion: autoscaling/v2 3 | kind: HorizontalPodAutoscaler 4 | metadata: 5 | name: {{ template "model.modelBackend" . }} 6 | spec: 7 | scaleTargetRef: 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | name: {{ template "model.modelBackend" . }} 11 | labels: 12 | {{- include "model.labels" . | nindent 4 }} 13 | app.kubernetes.io/component: model-backend 14 | minReplicas: {{ .Values.modelBackend.autoscaling.minReplicas }} 15 | maxReplicas: {{ .Values.modelBackend.autoscaling.maxReplicas }} 16 | metrics: 17 | {{- with .Values.modelBackend.autoscaling.targetCPUUtilizationPercentage }} 18 | - type: Resource 19 | resource: 20 | name: cpu 21 | target: 22 | type: Utilization 23 | averageUtilization: {{ . }} 24 | {{- end }} 25 | {{- with .Values.modelBackend.autoscaling.targetAverageMemoryUtilization }} 26 | - type: Resource 27 | resource: 28 | name: memory 29 | target: 30 | type: AverageValue 31 | averageValue: {{ . }} 32 | {{- end }} 33 | {{- end }} 34 | -------------------------------------------------------------------------------- /charts/model/templates/controller-model/hpa.yml: -------------------------------------------------------------------------------- 1 | {{- if .Values.controllerModel.autoscaling.enabled }} 2 | apiVersion: autoscaling/v2 3 | kind: HorizontalPodAutoscaler 4 | metadata: 5 | name: {{ template "model.controllerModel" . }} 6 | spec: 7 | scaleTargetRef: 8 | apiVersion: apps/v1 9 | kind: Deployment 10 | name: {{ template "model.controllerModel" . }} 11 | labels: 12 | {{- include "model.labels" . | nindent 4 }} 13 | app.kubernetes.io/component: controller-model 14 | minReplicas: {{ .Values.controllerModel.autoscaling.minReplicas }} 15 | maxReplicas: {{ .Values.controllerModel.autoscaling.maxReplicas }} 16 | metrics: 17 | {{- with .Values.controllerModel.autoscaling.targetCPUUtilizationPercentage }} 18 | - type: Resource 19 | resource: 20 | name: cpu 21 | target: 22 | type: Utilization 23 | averageUtilization: {{ . }} 24 | {{- end }} 25 | {{- with .Values.controllerModel.autoscaling.targetAverageMemoryUtilization }} 26 | - type: Resource 27 | resource: 28 | name: memory 29 | target: 30 | type: AverageValue 31 | averageValue: {{ . }} 32 | {{- end }} 33 | {{- end }} 34 | -------------------------------------------------------------------------------- /charts/model/README.md: -------------------------------------------------------------------------------- 1 | # model 2 | 3 | ![Version: 0.1.16-alpha](https://img.shields.io/badge/Version-0.1.16--alpha-informational?style=flat-square) ![AppVersion: 0.10.0-alpha](https://img.shields.io/badge/AppVersion-0.10.0--alpha-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) 4 | 5 | The Helm chart of Instill Model 6 | 7 | # Requirements 8 | 9 | | Repository | Name | Version | 10 | |------------|------|---------| 11 | | https://ray-project.github.io/kuberay-helm/ | kuberay-operator | 1.0.0 | 12 | 13 | ## Install 14 | 15 | Once Helm has been set up correctly, add the repo as follows: 16 | 17 | ```bash 18 | helm repo add instill-ai https://helm.instill.tech 19 | ``` 20 | 21 | If you had already added this repo earlier, run `helm repo update` to retrieve 22 | the latest versions of the packages. You can then run `helm search repo model --devel` to see the charts. 23 | 24 | To install the chart (alpha version): 25 | 26 | ```bash 27 | helm install instill-ai/model --devel 28 | ``` 29 | 30 | ## Uninstall 31 | 32 | To uninstall the chart: 33 | 34 | ```bash 35 | helm uninstall 36 | ``` 37 | -------------------------------------------------------------------------------- /test/load/const.js: -------------------------------------------------------------------------------- 1 | let proto 2 | 3 | export const apiGatewayMode = (__ENV.API_GATEWAY_URL && true); 4 | 5 | if (__ENV.API_GATEWAY_PROTOCOL) { 6 | if (__ENV.API_GATEWAY_PROTOCOL !== "http" && __ENV.API_GATEWAY_PROTOCOL != "https") { 7 | fail("only allow `http` or `https` for API_GATEWAY_PROTOCOL") 8 | } 9 | proto = __ENV.API_GATEWAY_PROTOCOL 10 | } else { 11 | proto = "http" 12 | } 13 | 14 | export const apiHost = `${proto}://${__ENV.API_GATEWAY_URL}/model` 15 | export const mgmtPublicHost = `${proto}://${__ENV.API_GATEWAY_URL}/core` 16 | 17 | export const dogImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/dog.jpg`, "b"); 18 | export const bearImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/bear.jpg`, "b"); 19 | 20 | export const streetImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/street.png`, "b"); 21 | export const street2Img = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/street2.png`, "b"); 22 | 23 | export const danceImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/dance.jpg`, "b"); 24 | export const dwaynejohnsonImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/dwaynejohnson.jpeg`, "b"); 25 | 26 | export const signsmallImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/sign-small.jpg`, "b"); 27 | export const signpostImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/emergency-evacuation-route-signpost.jpg`, "b"); 28 | 29 | export const stomataImg = open(`${__ENV.TEST_FOLDER_ABS_PATH}/load/data/sample_stomata.jpg`, "b"); 30 | 31 | export const modelOwner = "admin" 32 | export const defaultUserId = "admin" 33 | export const defaultPassword = "123123123" 34 | -------------------------------------------------------------------------------- /charts/model/templates/ray-service/monitor.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.tags.prometheusStack }} 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | name: ray-head-monitor 6 | namespace: instill-ai 7 | labels: 8 | # `release: $HELM_RELEASE`: Prometheus can only detect ServiceMonitor with this label. 9 | release: core 10 | spec: 11 | jobLabel: ray-head 12 | namespaceSelector: 13 | matchNames: 14 | - instill-ai 15 | # Only select Kubernetes Services with "matchLabels". 16 | selector: 17 | matchLabels: 18 | ray.io/node-type: head 19 | # A list of endpoints allowed as part of this ServiceMonitor. 20 | endpoints: 21 | - port: metrics 22 | - port: as-metrics # autoscaler metrics 23 | - port: dash-metrics # dashboard metrics 24 | targetLabels: 25 | - ray.io/cluster 26 | --- 27 | apiVersion: monitoring.coreos.com/v1 28 | kind: PodMonitor 29 | metadata: 30 | name: ray-workers-monitor 31 | namespace: instill-ai 32 | labels: 33 | # `release: $HELM_RELEASE`: Prometheus can only detect PodMonitor with this label. 34 | release: core 35 | ray.io/cluster: model-ray # $RAY_CLUSTER_NAME: "kubectl get rayclusters.ray.io" 36 | spec: 37 | jobLabel: ray-workers 38 | # Only select Kubernetes Pods in the "default" namespace. 39 | namespaceSelector: 40 | matchNames: 41 | - instill-ai 42 | # Only select Kubernetes Pods with "matchLabels". 43 | selector: 44 | matchLabels: 45 | ray.io/node-type: worker 46 | # A list of endpoints allowed as part of this PodMonitor. 47 | podMetricsEndpoints: 48 | - port: metrics 49 | {{- end }} -------------------------------------------------------------------------------- /test/load/load_test.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import encoding from "k6/encoding"; 3 | import { check, sleep } from 'k6'; 4 | 5 | import * as constant from "./const.js" 6 | import * as verify_yolov7 from "./verify-yolov7-stomata.js" 7 | 8 | const yolov7_model = "yolov7-stomata"; 9 | 10 | export const options = { 11 | setupTimeout: '300s', 12 | insecureSkipTLSVerify: true, 13 | thresholds: { 14 | checks: ["rate == 1.0"], 15 | }, 16 | // Key configurations for avg load test in this section 17 | stages: [ 18 | { duration: '30s', target: 10 }, // traffic ramp-up from 1 to 10 users over 30 seconds 19 | { duration: '15m', target: 10 }, // stay at 10 users for 15 minutes 20 | { duration: '30s', target: 0 }, // ramp-down to 0 users 21 | ], 22 | }; 23 | 24 | export function setup() { 25 | var loginResp = http.request("POST", `${constant.mgmtPublicHost}/v1beta/auth/login`, JSON.stringify({ 26 | "username": constant.defaultUserId, 27 | "password": constant.defaultPassword, 28 | })) 29 | 30 | check(loginResp, { 31 | [`POST ${constant.mgmtPublicHost}/v1beta/auth/login response status is 200`]: ( 32 | r 33 | ) => r.status === 200, 34 | }); 35 | 36 | var header = { 37 | "headers": { 38 | "Authorization": `Bearer ${loginResp.json().access_token}` 39 | }, 40 | "timeout": "600s", 41 | } 42 | return header 43 | } 44 | 45 | export default (header) => { 46 | // Predict with url 47 | verify_yolov7.verifyStomataDetection(constant.modelOwner, yolov7_model, "base64", http.request("POST", `${constant.apiHost}/v1alpha/users/${constant.modelOwner}/models/${yolov7_model}/trigger`, JSON.stringify({ 48 | "task_inputs": [{ 49 | "instance_segmentation": { 50 | "image_base64": encoding.b64encode(constant.stomataImg, "b"), 51 | }, 52 | }] 53 | }), header)) 54 | }; 55 | 56 | -------------------------------------------------------------------------------- /charts/model/templates/controller-model/configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ template "model.controllerModel" . }} 5 | labels: 6 | {{- include "model.labels" . | nindent 4 }} 7 | app.kubernetes.io/component: controller-model 8 | data: 9 | config.yaml: |+ 10 | server: 11 | privateport: {{ template "model.controllerModel.privatePort" . }} 12 | edition: {{ .Values.edition }} 13 | loopinterval: {{ .Values.controllerModel.loopinterval }} 14 | timeout: 120 15 | debug: {{ ternary "true" "false" (eq (.Values.logLevel | upper) "DEBUG") }} 16 | {{- if .Values.internalTLS.enabled }} 17 | https: 18 | cert: /etc/instill-ai/model/ssl/controller/tls.crt 19 | key: /etc/instill-ai/model/ssl/controller/tls.key 20 | {{- end }} 21 | etcd: 22 | host: {{ template "core.etcd" . }} 23 | port: {{ template "core.etcd.clientPort" . }} 24 | timeout: 5 25 | modelbackend: 26 | host: {{ template "model.modelBackend" . }} 27 | publicport: {{ template "model.modelBackend.publicPort" . }} 28 | privateport: {{ template "model.modelBackend.privatePort" . }} 29 | {{- if .Values.internalTLS.enabled }} 30 | https: 31 | cert: /etc/instill-ai/model/ssl/model/tls.crt 32 | key: /etc/instill-ai/model/ssl/model/tls.key 33 | {{- end }} 34 | cache: 35 | redis: 36 | redisoptions: 37 | addr: {{ default (include "core.redis.addr" .) .Values.redis.addr }} 38 | model: 39 | {{- toYaml .Values.modelBackend.cache | nindent 8 }} 40 | mgmtbackend: 41 | host: {{ template "core.mgmtBackend" . }} 42 | publicport: {{ template "core.mgmtBackend.publicPort" . }} 43 | privateport: {{ template "core.mgmtBackend.privatePort" . }} 44 | {{- if .Values.internalTLS.enabled }} 45 | https: 46 | cert: /etc/instill-ai/model/ssl/mgmt/tls.crt 47 | key: /etc/instill-ai/model/ssl/mgmt/tls.key 48 | {{- end }} 49 | -------------------------------------------------------------------------------- /model-hub/model_hub_cpu_test.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "mobilenetv2", 4 | "description": "An efficient image classification model, pretrained on ImageNet dataset which contains images from 1,000 classes.", 5 | "task": "TASK_CLASSIFICATION", 6 | "model_definition": "model-definitions/github", 7 | "configuration": { 8 | "repository": "instill-ai/model-mobilenetv2-dvc", 9 | "tag": "v1.3-ray-cpu" 10 | } 11 | }, 12 | { 13 | "id": "yolov7", 14 | "description": "YOLOv7 is a state-of-the-art real-time object detector pretrained on MS COCO dataset with 80 object classes.", 15 | "task": "TASK_DETECTION", 16 | "model_definition": "model-definitions/github", 17 | "configuration": { 18 | "repository": "instill-ai/model-yolov7-dvc", 19 | "tag": "v1.3-ray-cpu" 20 | } 21 | }, 22 | { 23 | "id": "yolov7-pose", 24 | "description": "a keypoint detector, extended on the basis of YOLOv7, to detect keypoints in the human body. The model is pretrained on MS COCO dataset with 17 keypoints.", 25 | "task": "TASK_KEYPOINT", 26 | "model_definition": "model-definitions/github", 27 | "configuration": { 28 | "repository": "instill-ai/model-yolov7-pose-dvc", 29 | "tag": "v1.0-cpu" 30 | } 31 | }, 32 | { 33 | "id": "yolov7-stomata", 34 | "description": "The instance segmentation model based on Yolov7, fine-tuned on the custom dataset with 337 images and 1 object class 'stomata'.", 35 | "task": "TASK_INSTANCE_SEGMENTATION", 36 | "model_definition": "model-definitions/github", 37 | "configuration": { 38 | "repository": "instill-ai/model-stomata-instance-segmentation-dvc", 39 | "tag": "v1.2-yolov7-mask-ray-cpu" 40 | } 41 | }, 42 | { 43 | "id": "stomata-mask-rcnn", 44 | "description": "The instance segmentation model based on Mask R-CNN from Detectron2, fine-tuned on the 'stomata200-mix' dataset with 1 object class 'stomata'.", 45 | "task": "TASK_INSTANCE_SEGMENTATION", 46 | "model_definition": "model-definitions/github", 47 | "configuration": { 48 | "repository": "instill-ai/model-stomata-instance-segmentation-dvc", 49 | "tag": "v2.0-cpu" 50 | } 51 | } 52 | ] 53 | 54 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ALPINE_VERSION 2 | FROM alpine:${ALPINE_VERSION} AS base 3 | 4 | RUN apk add --update docker docker-compose docker-cli-compose docker-cli-buildx openrc containerd git bash make wget vim curl openssl 5 | 6 | # Install k6 7 | ARG TARGETARCH K6_VERSION 8 | ADD https://github.com/grafana/k6/releases/download/v${K6_VERSION}/k6-v${K6_VERSION}-linux-${TARGETARCH}.tar.gz k6-v${K6_VERSION}-linux-${TARGETARCH}.tar.gz 9 | RUN tar -xf k6-v${K6_VERSION}-linux-${TARGETARCH}.tar.gz --strip-components 1 -C /usr/bin 10 | 11 | # Install Helm 12 | RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash 13 | 14 | # Install Kubectl 15 | RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl 16 | RUN chmod +x ./kubectl 17 | RUN mv ./kubectl /usr/local/bin 18 | 19 | FROM alpine:${ALPINE_VERSION} AS latest 20 | 21 | COPY --from=base /etc /etc 22 | COPY --from=base /usr /usr 23 | COPY --from=base /lib /lib 24 | COPY --from=docker:dind /usr/local/bin /usr/local/bin 25 | 26 | ARG CACHE_DATE 27 | RUN echo "Model latest codebase cloned on ${CACHE_DATE}" 28 | 29 | WORKDIR /instill-ai 30 | 31 | RUN git clone https://github.com/instill-ai/core.git 32 | 33 | WORKDIR /instill-ai/model 34 | 35 | RUN git clone https://github.com/instill-ai/model-backend.git 36 | RUN git clone https://github.com/instill-ai/controller-model.git 37 | 38 | FROM alpine:${ALPINE_VERSION} AS release 39 | 40 | COPY --from=base /etc /etc 41 | COPY --from=base /usr /usr 42 | COPY --from=base /lib /lib 43 | COPY --from=docker:dind /usr/local/bin /usr/local/bin 44 | 45 | ARG CACHE_DATE 46 | RUN echo "Model release codebase cloned on ${CACHE_DATE}" 47 | 48 | WORKDIR /instill-ai 49 | 50 | ARG INSTILL_CORE_VERSION 51 | RUN git clone -b v${INSTILL_CORE_VERSION} -c advice.detachedHead=false https://github.com/instill-ai/core.git 52 | 53 | WORKDIR /instill-ai/model 54 | 55 | ARG MODEL_BACKEND_VERSION CONTROLLER_MODEL_VERSION 56 | RUN git clone -b v${MODEL_BACKEND_VERSION} -c advice.detachedHead=false https://github.com/instill-ai/model-backend.git 57 | RUN git clone -b v${CONTROLLER_MODEL_VERSION} -c advice.detachedHead=false https://github.com/instill-ai/controller-model.git 58 | -------------------------------------------------------------------------------- /test/load/verify-yolov7-stomata.js: -------------------------------------------------------------------------------- 1 | import { 2 | check, 3 | } from "k6"; 4 | 5 | 6 | export function verifyStomataDetection(owner, modelID, triggerType, resp) { 7 | check((resp), { 8 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response status is 200`]: (r) => r.status === 200, 9 | }); 10 | check(resp, { 11 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task`]: (r) => r.json().task === "TASK_INSTANCE_SEGMENTATION", 12 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs.length`]: (r) => r.json().task_outputs.length === 1, 13 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].category`]: (r) => r.json().task_outputs[0].instance_segmentation.objects[0].category === "stomata", 14 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].score`]: (r) => r.json().task_outputs[0].instance_segmentation.objects[0].score > 0.7, 15 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].rle.length`]: (r) => r.json().task_outputs[0].instance_segmentation.objects[0].rle.length > 0, 16 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].bounding_box.top`]: (r) => Math.abs(r.json().task_outputs[0].instance_segmentation.objects[0].bounding_box.top - 75) < 5, 17 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].bounding_box.left`]: (r) => Math.abs(r.json().task_outputs[0].instance_segmentation.objects[0].bounding_box.left - 120) < 5, 18 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].bounding_box.width`]: (r) => Math.abs(r.json().task_outputs[0].instance_segmentation.objects[0].bounding_box.width - 55) < 5, 19 | [`POST v1alpha/users/${owner}/models/${modelID}/trigger (${triggerType}) response task_outputs[0].instance_segmentation.objects[0].bounding_box.height`]: (r) => Math.abs(r.json().task_outputs[0].instance_segmentation.objects[0].bounding_box.height - 55) < 5, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/make-all.yml: -------------------------------------------------------------------------------- 1 | name: Make All 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | concurrency: 7 | group: ${{ github.workflow }}-${{ github.ref || github.run_id }} 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | make-all: 12 | runs-on: ubuntu-latest 13 | steps: 14 | # mono occupies port 8084 which conflicts with mgmt-backend 15 | - name: Stop mono service 16 | run: | 17 | sudo kill -9 `sudo lsof -t -i:8084` 18 | sudo lsof -i -P -n | grep LISTEN 19 | 20 | - name: Checkout repo 21 | uses: actions/checkout@v4 22 | with: 23 | repository: instill-ai/model 24 | 25 | - name: Load .env file 26 | uses: cardinalby/export-env-action@v2 27 | with: 28 | envFile: .env 29 | 30 | - name: Install k6 31 | run: | 32 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 33 | 34 | - name: Pre Free Disk Space (Ubuntu) 35 | run: | 36 | df --human-readable 37 | sudo apt clean 38 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 39 | 40 | - name: Free Disk Space (Ubuntu) 41 | uses: jlumbroso/free-disk-space@main 42 | with: 43 | tool-cache: true 44 | android: true 45 | dotnet: true 46 | haskell: true 47 | large-packages: true 48 | docker-images: true 49 | swap-storage: true 50 | 51 | - name: Checkout repo (model) 52 | uses: actions/checkout@v4 53 | with: 54 | repository: instill-ai/model 55 | 56 | - name: Load .env file (model) 57 | uses: cardinalby/export-env-action@v2 58 | with: 59 | envFile: .env 60 | 61 | - name: Launch Instill Model (release) 62 | run: | 63 | make all BUILD=true EDITION=local-ce:test 64 | 65 | - name: List all docker containers 66 | run: | 67 | docker ps -a 68 | sleep 60 69 | 70 | - name: Probe to model services healthcheck endpoint 71 | run: | 72 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:8080/core/v1beta/health/mgmt 73 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:8080/model/v1alpha/health/model 74 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:3086/v1alpha/health/controller 75 | 76 | - name: Tear down Instill Model (release) 77 | run: | 78 | make down 79 | -------------------------------------------------------------------------------- /.github/workflows/make-latest.yml: -------------------------------------------------------------------------------- 1 | name: Make Latest 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref || github.run_id }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | make-latest: 16 | runs-on: ubuntu-latest 17 | steps: 18 | # mono occupies port 8084 which conflicts with mgmt-backend 19 | - name: Stop mono service 20 | run: | 21 | sudo kill -9 `sudo lsof -t -i:8084` 22 | sudo lsof -i -P -n | grep LISTEN 23 | 24 | - name: Checkout repo 25 | uses: actions/checkout@v4 26 | with: 27 | repository: instill-ai/model 28 | 29 | - name: Load .env file 30 | uses: cardinalby/export-env-action@v2 31 | with: 32 | envFile: .env 33 | 34 | - name: Install k6 35 | run: | 36 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 37 | 38 | - name: Pre Free Disk Space (Ubuntu) 39 | run: | 40 | df --human-readable 41 | sudo apt clean 42 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 43 | 44 | - name: Free Disk Space (Ubuntu) 45 | uses: jlumbroso/free-disk-space@main 46 | with: 47 | tool-cache: true 48 | android: true 49 | dotnet: true 50 | haskell: true 51 | large-packages: true 52 | docker-images: true 53 | swap-storage: true 54 | 55 | - name: Checkout repo (model) 56 | uses: actions/checkout@v4 57 | with: 58 | repository: instill-ai/model 59 | 60 | - name: Load .env file (model) 61 | uses: cardinalby/export-env-action@v2 62 | with: 63 | envFile: .env 64 | 65 | - name: Launch Instill Model (latest) 66 | run: | 67 | make latest PROFILE=exclude-console EDITION=local-ce:test 68 | 69 | - name: List all docker containers 70 | run: | 71 | docker ps -a 72 | sleep 30 73 | 74 | - name: Curl to model services healthcheck endpoint 75 | run: | 76 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:8080/core/v1beta/health/mgmt 77 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:8080/model/v1alpha/health/model 78 | curl -s -o /dev/null -w ''%{http_code}'\n' http://localhost:3086/v1alpha/health/controller 79 | 80 | - name: Tear down Instill Model (latest) 81 | run: | 82 | make down 83 | -------------------------------------------------------------------------------- /docker-compose.latest.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | model_backend_migrate: 5 | profiles: 6 | - all 7 | - exclude-api-gateway 8 | - exclude-mgmt 9 | - exclude-console 10 | - exclude-pipeline 11 | - exclude-controller-model 12 | image: ${MODEL_BACKEND_IMAGE}:latest 13 | 14 | model_backend_init: 15 | profiles: 16 | - all 17 | - exclude-api-gateway 18 | - exclude-mgmt 19 | - exclude-console 20 | - exclude-pipeline 21 | - exclude-controller-model 22 | image: ${MODEL_BACKEND_IMAGE}:latest 23 | 24 | model_backend_worker: 25 | profiles: 26 | - all 27 | - exclude-api-gateway 28 | - exclude-mgmt 29 | - exclude-console 30 | - exclude-pipeline 31 | - exclude-controller-model 32 | image: ${MODEL_BACKEND_IMAGE}:latest 33 | environment: 34 | CFG_SERVER_DEBUG: "true" 35 | 36 | model_backend: 37 | profiles: 38 | - all 39 | - exclude-api-gateway 40 | - exclude-mgmt 41 | - exclude-console 42 | - exclude-pipeline 43 | - exclude-controller-model 44 | image: ${MODEL_BACKEND_IMAGE}:latest 45 | environment: 46 | CFG_SERVER_DEBUG: "true" 47 | CFG_SERVER_EDITION: ${EDITION} 48 | ports: 49 | - ${MODEL_BACKEND_PRIVATEPORT}:${MODEL_BACKEND_PRIVATEPORT} 50 | - ${MODEL_BACKEND_PUBLICPORT}:${MODEL_BACKEND_PUBLICPORT} 51 | 52 | model_backend_init_model: 53 | profiles: 54 | - all 55 | - exclude-api-gateway 56 | - exclude-mgmt 57 | - exclude-console 58 | - exclude-pipeline 59 | - exclude-controller-model 60 | image: ${MODEL_BACKEND_IMAGE}:latest 61 | environment: 62 | CFG_INITMODEL_ENABLED: ${INITMODEL_ENABLED} 63 | CFG_INITMODEL_PATH: https://raw.githubusercontent.com/instill-ai/model/main/model-hub/model_hub_cpu.json 64 | 65 | controller_model: 66 | profiles: 67 | - all 68 | - exclude-api-gateway 69 | - exclude-mgmt 70 | - exclude-console 71 | - exclude-pipeline 72 | - exclude-model 73 | image: ${CONTROLLER_MODEL_IMAGE}:latest 74 | environment: 75 | CFG_SERVER_DEBUG: "true" 76 | CFG_SERVER_EDITION: ${EDITION} 77 | ports: 78 | - ${CONTROLLER_MODEL_PRIVATEPORT}:${CONTROLLER_MODEL_PRIVATEPORT} 79 | 80 | ray_server: 81 | image: ${RAY_SERVER_IMAGE}:${RAY_LATEST_TAG} 82 | ports: 83 | - ${RAY_SERVER_CLIENT_PORT}:${RAY_SERVER_CLIENT_PORT} 84 | - ${RAY_SERVER_DASHBOARD_PORT}:${RAY_SERVER_DASHBOARD_PORT} 85 | - ${RAY_SERVER_SERVE_PORT}:${RAY_SERVER_SERVE_PORT} 86 | - ${RAY_SERVER_SERVE_GRPC_PORT}:${RAY_SERVER_SERVE_GRPC_PORT} 87 | - ${RAY_SERVER_PROMETHEUS_PORT}:${RAY_SERVER_PROMETHEUS_PORT} 88 | -------------------------------------------------------------------------------- /charts/model/templates/pvc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.persistence.enabled }} 2 | {{- $modelRepository := .Values.persistence.persistentVolumeClaim.modelRepository -}} 3 | {{- if not $modelRepository.existingClaim }} 4 | kind: PersistentVolumeClaim 5 | apiVersion: v1 6 | metadata: 7 | name: model-repository-data-volume 8 | annotations: 9 | {{- range $key, $value := $modelRepository.annotations }} 10 | {{ $key }}: {{ $value | quote }} 11 | {{- end }} 12 | {{- if eq .Values.persistence.resourcePolicy "keep" }} 13 | helm.sh/resource-policy: keep 14 | {{- end }} 15 | labels: 16 | {{- include "model.labels" . | nindent 4 }} 17 | app.kubernetes.io/component: model-backend 18 | spec: 19 | accessModes: 20 | - {{ $modelRepository.accessMode }} 21 | resources: 22 | requests: 23 | storage: {{ $modelRepository.size }} 24 | {{- if $modelRepository.storageClass }} 25 | {{- if eq "-" $modelRepository.storageClass }} 26 | storageClassName: "" 27 | {{- else }} 28 | storageClassName: {{ $modelRepository.storageClass }} 29 | {{- end }} 30 | {{- end }} 31 | {{- end }} 32 | {{- $condaPack := .Values.persistence.persistentVolumeClaim.condaPack -}} 33 | {{- if not $condaPack.existingClaim }} 34 | --- 35 | kind: PersistentVolumeClaim 36 | apiVersion: v1 37 | metadata: 38 | name: conda-pack-data-volume 39 | annotations: 40 | {{- range $key, $value := $condaPack.annotations }} 41 | {{ $key }}: {{ $value | quote }} 42 | {{- end }} 43 | {{- if eq .Values.persistence.resourcePolicy "keep" }} 44 | helm.sh/resource-policy: keep 45 | {{- end }} 46 | labels: 47 | {{- include "model.labels" . | nindent 4 }} 48 | app.kubernetes.io/component: model-backend 49 | spec: 50 | accessModes: 51 | - {{ $condaPack.accessMode }} 52 | resources: 53 | requests: 54 | storage: {{ $condaPack.size }} 55 | {{- if $condaPack.storageClass }} 56 | {{- if eq "-" $condaPack.storageClass }} 57 | storageClassName: "" 58 | {{- else }} 59 | storageClassName: {{ $condaPack.storageClass }} 60 | {{- end }} 61 | {{- end }} 62 | {{- end }} 63 | {{- $rayConda := .Values.persistence.persistentVolumeClaim.rayConda -}} 64 | {{- if not $rayConda.existingClaim }} 65 | --- 66 | kind: PersistentVolumeClaim 67 | apiVersion: v1 68 | metadata: 69 | name: ray-conda-data-volume 70 | annotations: 71 | {{- range $key, $value := $rayConda.annotations }} 72 | {{ $key }}: {{ $value | quote }} 73 | {{- end }} 74 | labels: 75 | {{- include "model.labels" . | nindent 4 }} 76 | app.kubernetes.io/component: model-backend 77 | spec: 78 | accessModes: 79 | - {{ $rayConda.accessMode }} 80 | resources: 81 | requests: 82 | storage: {{ $rayConda.size }} 83 | {{- if $rayConda.storageClass }} 84 | {{- if eq "-" $rayConda.storageClass }} 85 | storageClassName: "" 86 | {{- else }} 87 | storageClassName: {{ $rayConda.storageClass }} 88 | {{- end }} 89 | {{- end }} 90 | {{- end }} 91 | {{- end }} 92 | -------------------------------------------------------------------------------- /model-hub/model_hub_cpu.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "mobilenetv2", 4 | "description": "An efficient image classification model, pretrained on ImageNet dataset which contains images from 1,000 classes.", 5 | "task": "TASK_CLASSIFICATION", 6 | "model_definition": "model-definitions/github", 7 | "configuration": { 8 | "repository": "instill-ai/model-mobilenetv2-dvc", 9 | "tag": "v1.0-cpu" 10 | } 11 | }, 12 | { 13 | "id": "vit-base-patch16-224", 14 | "description": "Vision Transformer (ViT) model pretrained on ImageNet-21k and fine-tuned on ImageNet 2012, which contains images from 1,000 classes, at resolution 224x224.", 15 | "task": "TASK_CLASSIFICATION", 16 | "model_definition": "model-definitions/huggingface", 17 | "configuration": { 18 | "repo_id": "google/vit-base-patch16-224" 19 | } 20 | }, 21 | { 22 | "id": "yolov7", 23 | "description": "YOLOv7 is a state-of-the-art real-time object detector pretrained on MS COCO dataset with 80 object classes.", 24 | "task": "TASK_DETECTION", 25 | "model_definition": "model-definitions/github", 26 | "configuration": { 27 | "repository": "instill-ai/model-yolov7-dvc", 28 | "tag": "v1.0-cpu" 29 | } 30 | }, 31 | { 32 | "id": "yolov7-pose", 33 | "description": "a keypoint detector, extended on the basis of YOLOv7, to detect keypoints in the human body. The model is pretrained on MS COCO dataset with 17 keypoints.", 34 | "task": "TASK_KEYPOINT", 35 | "model_definition": "model-definitions/github", 36 | "configuration": { 37 | "repository": "instill-ai/model-yolov7-pose-dvc", 38 | "tag": "v1.0-cpu" 39 | } 40 | }, 41 | { 42 | "id": "ocr-psnet-easyocr", 43 | "description": "An OCR model that combines the PSNet model to localise bounding boxes that contain texts and the EasyOCR model to recognise texts in the detected bounding boxes.", 44 | "task": "TASK_OCR", 45 | "model_definition": "model-definitions/github", 46 | "configuration": { 47 | "repository": "instill-ai/model-ocr-dvc", 48 | "tag": "v1.0-cpu" 49 | } 50 | }, 51 | { 52 | "id": "mask-rcnn", 53 | "description": "Mask R-CNN is a state-of-the-art instance segmentation model, pretrained on MS COCO dataset with 80 object classes.", 54 | "task": "TASK_INSTANCE_SEGMENTATION", 55 | "model_definition": "model-definitions/github", 56 | "configuration": { 57 | "repository": "instill-ai/model-instance-segmentation-dvc", 58 | "tag": "v1.0-cpu" 59 | } 60 | }, 61 | { 62 | "id": "lraspp", 63 | "description": "A semantic segmentation model based on MobileNetV3 from the OpenMMLab semantic segmentation toolbox and benchmark.", 64 | "task": "TASK_SEMANTIC_SEGMENTATION", 65 | "model_definition": "model-definitions/github", 66 | "configuration": { 67 | "repository": "instill-ai/model-semantic-segmentation-dvc", 68 | "tag": "v1.0-cpu" 69 | } 70 | }, 71 | { 72 | "id": "stable-diffusion-1-5-fp32-txt2img", 73 | "description": "Stable Diffusion v2 generates high quality images based on text prompts.", 74 | "task": "TASK_TEXT_TO_IMAGE", 75 | "model_definition": "model-definitions/github", 76 | "configuration": { 77 | "repository": "instill-ai/model-diffusion-dvc", 78 | "tag": "v1.5-cpu" 79 | } 80 | }, 81 | { 82 | "id": "llama2-7b", 83 | "description": "Llama2-7b, from meta, is trained to generate text based on your prompts.", 84 | "task": "TASK_TEXT_GENERATION", 85 | "model_definition": "model-definitions/github", 86 | "configuration": { 87 | "repository": "instill-ai/model-llama2-7b-dvc", 88 | "tag": "fp32-7b-hf-tf-cpu" 89 | } 90 | } 91 | ] -------------------------------------------------------------------------------- /model-hub/model_hub_gpu.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "mobilenetv2", 4 | "description": "An efficient image classification model, pretrained on ImageNet dataset which contains images from 1,000 classes.", 5 | "task": "TASK_CLASSIFICATION", 6 | "model_definition": "model-definitions/github", 7 | "configuration": { 8 | "repository": "instill-ai/model-mobilenetv2-dvc", 9 | "tag": "v0.7.0-ray-gpu" 10 | } 11 | }, 12 | { 13 | "id": "yolov7", 14 | "description": "YOLOv7 is a state-of-the-art real-time object detector pretrained on MS COCO dataset with 80 object classes.", 15 | "task": "TASK_DETECTION", 16 | "model_definition": "model-definitions/github", 17 | "configuration": { 18 | "repository": "instill-ai/model-yolov7-dvc", 19 | "tag": "v0.7.0-ray-gpu" 20 | } 21 | }, 22 | { 23 | "id": "yolov7-stomata", 24 | "description": "The instance segmentation model based on Yolov7, fine-tuned on the custom dataset with 337 images and 1 object class 'stomata'.", 25 | "task": "TASK_INSTANCE_SEGMENTATION", 26 | "model_definition": "model-definitions/github", 27 | "configuration": { 28 | "repository": "instill-ai/model-stomata-instance-segmentation-dvc", 29 | "tag": "v0.7.0-yolov7-mask-ray-gpu" 30 | } 31 | }, 32 | { 33 | "id": "llama2-7b", 34 | "description": "Llama2-7b, from meta, is trained to generate text based on your prompts.", 35 | "task": "TASK_TEXT_GENERATION", 36 | "model_definition": "model-definitions/github", 37 | "configuration": { 38 | "repository": "instill-ai/model-llama2-7b-dvc", 39 | "tag": "f32-cpu-transformer-ray-v0.8.0" 40 | } 41 | }, 42 | { 43 | "id": "llama2-7b-chat", 44 | "description": "Llama2-7b-Chat, from meta, is trained to generate text based on your prompts.", 45 | "task": "TASK_TEXT_GENERATION_CHAT", 46 | "model_definition": "model-definitions/github", 47 | "configuration": { 48 | "repository": "instill-ai/model-llama2-7b-chat-dvc", 49 | "tag": "f16-gpuAuto-transformer-ray-v0.8.0" 50 | } 51 | }, 52 | { 53 | "id": "llava-1-6-7b", 54 | "description": "LLaVa-7b, from liuhaotian, is trained to generate text based on your prompts with miltimodal input.", 55 | "task": "TASK_VISUAL_QUESTION_ANSWERING", 56 | "model_definition": "model-definitions/github", 57 | "configuration": { 58 | "repository": "instill-ai/model-llava-7b-dvc", 59 | "tag": "f16-gpuAuto-transformer-ray-v0.8.16" 60 | } 61 | }, 62 | { 63 | "id": "zephyr-7b", 64 | "description": "Zephyr-7b, from Huggingface, is trained to generate text based on your prompts.", 65 | "task": "TASK_TEXT_GENERATION_CHAT", 66 | "model_definition": "model-definitions/github", 67 | "configuration": { 68 | "repository": "instill-ai/model-zephyr-7b-dvc", 69 | "tag": "f32-cpu-transformer-ray-v0.8.0" 70 | } 71 | }, 72 | { 73 | "id": "stable-diffusion-xl", 74 | "description": "Stable-Diffusion-XL, from StabilityAI, is trained to generate image based on your prompts.", 75 | "task": "TASK_TEXT_TO_IMAGE", 76 | "model_definition": "model-definitions/github", 77 | "configuration": { 78 | "repository": "instill-ai/model-diffusion-xl-dvc", 79 | "tag": "f16-gpuAuto-diffusers-ray-v0.8.0" 80 | } 81 | }, 82 | { 83 | "id": "controlnet-canny", 84 | "description": "ControlNet-Canny Version, from Lvmin, is trained to generate image based on your prompts and images.", 85 | "task": "TASK_IMAGE_TO_IMAGE", 86 | "model_definition": "model-definitions/github", 87 | "configuration": { 88 | "repository": "instill-ai/model-controlnet-dvc", 89 | "tag": "f16-gpuAuto-diffusers-ray-v0.8.0" 90 | } 91 | } 92 | ] 93 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # docker compose project name 2 | COMPOSE_PROJECT_NAME=instill-model 3 | 4 | # build from scratch or not at launch, which will build all sources from scrach. Default to false. 5 | BUILD=false 6 | 7 | # docker compose profiles to selectively launch components for developing the latest codebase of the specified component. 8 | # the value can be all, exclude-api-gateway, exclude-mgmt, exclude-pipeline, exclude-model, exclude-controller-model, or exclude-console. 9 | PROFILE=all 10 | 11 | # system-wise config path (all core, vdp, and model projects must use the same path) 12 | SYSTEM_CONFIG_PATH=~/.config/instill 13 | 14 | # configuration directory path for docker build 15 | BUILD_CONFIG_DIR_PATH=. 16 | 17 | # extra parameters for helm integration test running in docker 18 | DOCKER_HELM_IT_EXTRA_PARAMS= 19 | 20 | # flag to enable usage collection 21 | USAGE_ENABLED=true 22 | 23 | # flag to enable observability stack 24 | OBSERVE_ENABLED=false 25 | 26 | # This flag is used for integration test in which dummy model is used instead of pulling model from GitHub, HuggingFace or ArtiVC. 27 | # The reason is reducing the impact of network trouble during integration test 28 | # The default value is alway false, only set when running `make integration-test` 29 | ITMODE_ENABLED=false 30 | 31 | # flag to enable model-backend creating predploy models 32 | INITMODEL_ENABLED=false 33 | 34 | # max data size in MB which pipeline and model backend accept to process 35 | MAX_DATA_SIZE=12 36 | 37 | # container build 38 | DOCKER_BUILDKIT=1 39 | COMPOSE_DOCKER_CLI_BUILD=1 40 | 41 | # version 42 | UBUNTU_VERSION=20.04 43 | ALPINE_VERSION=3.16 44 | 45 | GOLANG_VERSION=1.21 46 | KRAKEND_CE_VERSION=2.1.3 47 | ARTIVC_VERSION=0.10.0 48 | K6_VERSION=0.44.0 49 | 50 | # Instill Core 51 | INSTILL_CORE_VERSION=0.13.0-beta 52 | INSTILL_CORE_HOST=localhost 53 | 54 | # api-gateway 55 | API_GATEWAY_HOST=api-gateway 56 | API_GATEWAY_VERSION=0.11.0-beta 57 | API_GATEWAY_PORT=8080 58 | 59 | # model-backend 60 | MODEL_BACKEND_IMAGE=instill/model-backend 61 | MODEL_BACKEND_VERSION=0.23.0-alpha 62 | MODEL_BACKEND_HOST=model-backend 63 | MODEL_BACKEND_PRIVATEPORT=3083 64 | MODEL_BACKEND_PUBLICPORT=8083 65 | 66 | # mgmt-backend 67 | MGMT_BACKEND_HOST=mgmt-backend 68 | MGMT_BACKEND_VERSION=0.12.0-beta 69 | MGMT_BACKEND_PRIVATEPORT=3084 70 | MGMT_BACKEND_PUBLICPORT=8084 71 | 72 | # controller-model 73 | CONTROLLER_MODEL_IMAGE=instill/controller-model 74 | CONTROLLER_MODEL_VERSION=0.4.0-alpha 75 | CONTROLLER_MODEL_HOST=controller-model 76 | CONTROLLER_MODEL_PRIVATEPORT=3086 77 | 78 | # ray-server 79 | RAY_SERVER_IMAGE=instill/ray 80 | RAY_SERVER_VERSION=0.3.0-alpha 81 | RAY_SERVER_HOST=ray-server 82 | RAY_SERVER_CLIENT_PORT=10001 83 | RAY_SERVER_DASHBOARD_PORT=8265 84 | RAY_SERVER_GCS_PORT=6379 85 | RAY_SERVER_SERVE_PORT=8000 86 | RAY_SERVER_SERVE_GRPC_PORT=9000 87 | RAY_SERVER_PROMETHEUS_PORT=8079 88 | RAY_SERVER_VRAM= 89 | 90 | # PostgreSQL 91 | POSTGRESQL_HOST=pg-sql 92 | POSTGRESQL_PORT=5432 93 | 94 | # Redis 95 | REDIS_HOST=redis 96 | REDIS_PORT=6379 97 | 98 | # etcd 99 | ETCD_HOST=etcd 100 | ETCD_CLIENT_PORT=3379 101 | 102 | # influxdb 103 | INFLUXDB_HOST=influxdb 104 | INFLUXDB_PORT=8086 105 | 106 | # otel 107 | OTEL_COLLECTOR_PORT=8095 108 | OTEL_COLLECTOR_PROMETHEUS_PORT=9001 109 | 110 | # prometheus 111 | PROMETHEUS_HOST=prometheus 112 | PROMETHEUS_PORT=9090 113 | 114 | # grafana 115 | GRAFANA_HOST=grafana 116 | GRAFANA_PORT=3000 117 | GRAFANA_EXPOSE_PORT=3002 118 | 119 | # jaeger 120 | JAEGER_HOST=jaeger 121 | JAEGER_LISTEN_THRIFT_PORT=14268 # accept jaeger.thrift directly from clients 122 | 123 | # Temopral 124 | TEMPORAL_ADMIN_TOOLS_IMAGE=temporalio/admin-tools 125 | TEMPORAL_ADMIN_TOOLS_VERSION=1.22.3 126 | TEMPORAL_HOST=temporal 127 | TEMPORAL_PORT=7233 128 | -------------------------------------------------------------------------------- /charts/model/templates/model-backend/post-install-job.yaml: -------------------------------------------------------------------------------- 1 | {{- $modelRepository := .Values.persistence.persistentVolumeClaim.modelRepository -}} 2 | {{- if .Values.modelBackend.initModel.enabled -}} 3 | apiVersion: batch/v1 4 | kind: Job 5 | metadata: 6 | name: {{ template "model.modelBackend" . }}-init-model 7 | labels: 8 | {{- include "model.labels" . | nindent 4 }} 9 | app.kubernetes.io/component: model-backend 10 | annotations: 11 | # This is what defines this resource as a hook. Without this line, the 12 | # job is considered part of the release. 13 | "helm.sh/hook": post-install 14 | "helm.sh/hook-weight": "-5" 15 | "helm.sh/hook-delete-policy": hook-succeeded 16 | spec: 17 | template: 18 | metadata: 19 | name: "{{ .Release.Name }}" 20 | labels: 21 | {{- include "model.matchLabels" . | nindent 8 }} 22 | app.kubernetes.io/component: model-backend 23 | annotations: 24 | checksum/config: {{ include (print $.Template.BasePath "/model-backend/configmap.yaml") . | sha256sum }} 25 | {{- with .Values.modelBackend.podAnnotations }} 26 | {{- toYaml . | nindent 8 }} 27 | {{- end }} 28 | spec: 29 | {{- if .Values.modelBackend.serviceAccountName }} 30 | serviceAccountName: {{ .Values.modelBackend.serviceAccountName }} 31 | {{- end }} 32 | {{- with .Values.imagePullSecrets }} 33 | imagePullSecrets: 34 | {{- toYaml . | nindent 8 }} 35 | {{- end }} 36 | automountServiceAccountToken: {{ .Values.modelBackend.automountServiceAccountToken | default false }} 37 | terminationGracePeriodSeconds: 120 38 | restartPolicy: Never 39 | initContainers: 40 | - name: wait-for-dependencies 41 | image: curlimages/curl:8.00.1 42 | command: ['sh', '-c'] 43 | args: 44 | - > 45 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${MODEL_BACKEND_HOST}:${MODEL_BACKEND_PORT}/v1alpha/health/model)" != "200" ]]; do echo waiting for model-backend; sleep 1; done 46 | env: 47 | - name: MODEL_BACKEND_HOST 48 | value: "{{ template "model.modelBackend" . }}" 49 | - name: MODEL_BACKEND_PORT 50 | value: "{{ template "model.modelBackend.publicPort" . }}" 51 | containers: 52 | - name: model-backend-init-model 53 | image: {{ .Values.modelBackend.image.repository }}:{{ .Values.modelBackend.image.tag }} 54 | imagePullPolicy: {{ .Values.modelBackend.image.pullPolicy }} 55 | command: [./{{ .Values.modelBackend.commandName.initModel }}] 56 | volumeMounts: 57 | - name: config 58 | mountPath: {{ .Values.modelBackend.configPath }} 59 | subPath: config.yaml 60 | - name: model-repository 61 | mountPath: /model-repository 62 | env: 63 | - name: MODEL_BACKEND_HOST 64 | value: "{{ template "model.modelBackend" . }}" 65 | volumes: 66 | - name: config 67 | configMap: 68 | name: {{ template "model.modelBackend" . }} 69 | - name: model-repository 70 | {{- if not .Values.persistence.enabled }} 71 | emptyDir: {} 72 | {{- else if $modelRepository.existingClaim }} 73 | persistentVolumeClaim: 74 | claimName: {{ $modelRepository.existingClaim }} 75 | {{- else }} 76 | persistentVolumeClaim: 77 | claimName: model-repository-data-volume 78 | {{- end }} 79 | {{- with .Values.modelBackend.nodeSelector }} 80 | nodeSelector: 81 | {{- toYaml . | nindent 8 }} 82 | {{- end }} 83 | {{- with .Values.modelBackend.affinity }} 84 | affinity: 85 | {{- toYaml . | nindent 8 }} 86 | {{- end }} 87 | {{- with .Values.modelBackend.tolerations }} 88 | tolerations: 89 | {{- toYaml . | nindent 8 }} 90 | {{- end }} 91 | {{- end }} 92 | -------------------------------------------------------------------------------- /charts/model/templates/model-backend/configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ template "model.modelBackend" . }} 5 | labels: 6 | {{- include "model.labels" . | nindent 4 }} 7 | app.kubernetes.io/component: model-backend 8 | data: 9 | config.yaml: |+ 10 | server: 11 | privateport: {{ template "model.modelBackend.privatePort" . }} 12 | publicport: {{ template "model.modelBackend.publicPort" . }} 13 | edition: {{ .Values.edition }} 14 | usage: 15 | {{- toYaml .Values.usage | nindent 8 }} 16 | debug: {{ ternary "true" "false" (eq (.Values.logLevel | upper) "DEBUG") }} 17 | itmode: 18 | enabled: {{ .Values.itMode.enabled }} 19 | maxdatasize: {{ .Values.maxDataSizeMB }} 20 | workflow: 21 | maxworkflowtimeout: {{ .Values.modelBackend.temporal.workflow.maxWorkflowTimeout }} 22 | maxworkflowretry: {{ .Values.modelBackend.temporal.workflow.maxWorkflowRetry }} 23 | maxactivityretry: {{ .Values.modelBackend.temporal.workflow.maxActivityRetry }} 24 | {{- if .Values.internalTLS.enabled }} 25 | https: 26 | cert: /etc/instill-ai/model/ssl/model/tls.crt 27 | key: /etc/instill-ai/model/ssl/model/tls.key 28 | {{- end }} 29 | github: 30 | patenabled: {{ .Values.modelBackend.github.patenabled }} 31 | pat: {{ .Values.modelBackend.github.pat }} 32 | log: 33 | external: {{ .Values.tags.observability }} 34 | otelcollector: 35 | host: {{ template "core.otel" . }} 36 | port: {{ template "core.otel.port" . }} 37 | mgmtbackend: 38 | host: {{ template "core.mgmtBackend" . }} 39 | publicport: {{ template "core.mgmtBackend.publicPort" . }} 40 | privateport: {{ template "core.mgmtBackend.privatePort" . }} 41 | {{- if .Values.internalTLS.enabled }} 42 | https: 43 | cert: /etc/instill-ai/model/ssl/mgmt/tls.crt 44 | key: /etc/instill-ai/model/ssl/mgmt/tls.key 45 | {{- end }} 46 | controller: 47 | host: {{ template "model.controllerModel" . }} 48 | privateport: {{ template "model.controllerModel.privatePort" . }} 49 | {{- if .Values.internalTLS.enabled }} 50 | https: 51 | cert: /etc/instill-ai/model/ssl/controller/tls.crt 52 | key: /etc/instill-ai/model/ssl/controller/tls.key 53 | {{- end }} 54 | rayserver: 55 | grpcuri: {{ include "model.ray" . }}:{{ include "model.ray.serveGrpcPort" . }} 56 | modelstore: /model-repository 57 | vram: {{ .Values.rayService.vram }} 58 | database: 59 | username: {{ default (include "core.database.username" .) .Values.database.username }} 60 | password: {{ default (include "core.database.rawPassword" .) .Values.database.password }} 61 | host: {{ default (include "core.database.host" .) .Values.database.host }} 62 | port: {{ default (include "core.database.port" .) .Values.database.port }} 63 | name: model 64 | version: {{ .Values.modelBackend.dbVersion }} 65 | timezone: Etc/UTC 66 | pool: 67 | idleconnections: {{ .Values.database.maxIdleConns }} 68 | maxconnections: {{ .Values.database.maxOpenConns }} 69 | connlifetime: {{ .Values.database.maxConnLifeTime }} 70 | cache: 71 | redis: 72 | redisoptions: 73 | addr: {{ default (include "core.redis.addr" .) .Values.redis.addr }} 74 | model: 75 | {{- toYaml .Values.modelBackend.cache | nindent 8 }} 76 | maxbatchsizelimitation: 77 | unspecified: 2 78 | classification: 16 79 | detection: 8 80 | keypoint: 8 81 | ocr: 2 82 | instancesegmentation: 8 83 | semanticsegmentation: 8 84 | textgeneration: 1 85 | temporal: 86 | hostport: {{ default (printf "%s-frontend-headless:%s" (include "core.temporal" .) (include "core.temporal.frontend.grpcPort" .)) .Values.modelBackend.temporal.hostPort }} 87 | namespace: {{ default "model-backend" .Values.modelBackend.temporal.namespace }} 88 | retention: {{ default "1d" .Values.modelBackend.temporal.retention }} 89 | ca: {{ default "" .Values.modelBackend.temporal.ca }} 90 | cert: {{ default "" .Values.modelBackend.temporal.cert }} 91 | key: {{ default "" .Values.modelBackend.temporal.key }} 92 | serverName: {{ default "" .Values.modelBackend.temporal.serverName }} 93 | initmodel: 94 | {{- toYaml .Values.modelBackend.initModel | nindent 6 }} 95 | openfga: 96 | host: {{ template "core.openfga" . }} 97 | port: 8080 98 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Instill Model project uses a polyrepo structure with multiple licenses. 2 | 3 | The license for a piece of source code is defined with the following prioritized rules: 4 | 1. LICENSE present in the file 5 | 2. LICENSE file in the same directory as the file 6 | 3. First LICENSE file found in the parent directories up to the top level 7 | 4. By default to the Elastic License 2.0 (ELv2) 8 | 9 | If you have any question regarding licenses, please [contact us](mailto:hello@instill.tech). 10 | 11 | ------------------------------------------------------------------------------------ 12 | Elastic License 2.0 (ELv2) 13 | 14 | **Acceptance** 15 | By using the software, you agree to all of the terms and conditions below. 16 | 17 | **Copyright License** 18 | The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below 19 | 20 | **Limitations** 21 | You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software. 22 | 23 | You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key. 24 | 25 | You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law. 26 | 27 | **Patents** 28 | The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company. 29 | 30 | **Notices** 31 | You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms. 32 | 33 | If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software. 34 | 35 | **No Other Rights** 36 | These terms do not imply any licenses other than those expressly granted in these terms. 37 | 38 | **Termination** 39 | If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently. 40 | 41 | **No Liability** 42 | As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim. 43 | 44 | **Definitions** 45 | The *licensor* is the entity offering these terms, and the *software* is the software the licensor makes available under these terms, including any portion of it. 46 | 47 | *you* refers to the individual or entity agreeing to these terms. 48 | 49 | *your company* is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. *control* means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect. 50 | 51 | *your licenses* are all the licenses granted to you for the software under these terms. 52 | 53 | *use* means anything you do with the software requiring one of your licenses. 54 | 55 | *trademark* means trademarks, service marks, and similar rights. 56 | 57 | ------------------------------------------------------------------------------------ 58 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | We appreciate your contribution to this amazing project! Any form of engagement is welcome, including but not limiting to 4 | 5 | - feature request 6 | - documentation wording 7 | - bug report 8 | - roadmap suggestion 9 | - ...and so on! 10 | 11 | Please refer to the [community contributing section](https://github.com/instill-ai/community#contributing) for more details. 12 | 13 | ## Development and codebase contribution 14 | 15 | Before delving into the details to come up with your first PR, please familiarise yourself with the project structure of [Instill Core](https://github.com/instill-ai/community#instill-core). 16 | 17 | ### Prerequisites 18 | 19 | Please refer to [here](../README.md#prerequisites) to make sure your environment has been all set. 20 | 21 | ### Launch the local dev system 22 | 23 | Clone the repo and launch the `latest` version of the codebase for all dependencies: 24 | 25 | There are two configurable env variable you can set here 26 | 27 | ```bash 28 | # Enable this to replace any model created and deployed with a dummy model 29 | # which just take whatever the inference input and output it. 30 | # You need to enable this to run integration-test 31 | ITMODE_ENABLED= 32 | # Enable this to deploy a list of predefined model here: 33 | # https://raw.githubusercontent.com/instill-ai/vdp/main/model-hub/model_hub_cpu.json 34 | # Normally this is used for deployment with kubernetes 35 | INITMODEL_ENABLED= 36 | ``` 37 | 38 | ```bash 39 | $ git clone https://github.com/instill-ai/model.git && cd model 40 | 41 | # launch all latest service components 42 | $ make latest PROFILE=all 43 | ``` 44 | 45 | The env variable `PROFILE` is intended to specify which service component you want to develop on 46 | 47 | - `all` 48 | 49 | When you set `PROFILE=all`, the whole `Instill Core` and `Instill Model` stack will be launched, meaning you want to test the system as a whole. 50 | 51 | - `{service}` 52 | 53 | When you set `PROFILE=exclude-{service}`, in which `{service}` can be `model` or `controller-model`, it means you want to develop on that particular service. The `make` command will launch the corresponding stack **WITHOUT** that service component and **WITH** all its dependencies. Given that, you can later on spin up and down the `{service}` in your dev container. Please take the [model-backend](https://github.com/instill-ai/model-backend#local-dev) as an example. 54 | 55 | ### Tear down the local dev system 56 | 57 | Simply run: 58 | 59 | ```bash 60 | $ make down 61 | ``` 62 | 63 | ### Build the local images 64 | 65 | We use Docker multi-stage builds to build a `instill/model-compose:{latest,release}` image which will be based on to run dind (docker-in-docker) to build all the images of `Instill Model` defined in the compose file [docker-compose.build.yml](../docker-compose.build.yml). 66 | 67 | You can build the images by simply running: 68 | 69 | ```bash 70 | $ make build-{latest,release} 71 | ``` 72 | 73 | ### Sending PRs 74 | 75 | Please take these general guidelines into consideration when you are sending a PR: 76 | 77 | 1. **Fork the Repository:** Begin by forking the repository to your GitHub account. 78 | 2. **Create a New Branch:** Create a new branch to house your work. Use a clear and descriptive name, like `/`. 79 | 3. **Make and Commit Changes:** Implement your changes and commit them. We encourage you to follow these best practices for commits to ensure an efficient review process: 80 | - Adhere to the [conventional commits guidelines](https://www.conventionalcommits.org/) for meaningful commit messages. 81 | - Follow the [7 rules of commit messages](https://chris.beams.io/posts/git-commit/) for well-structured and informative commits. 82 | - Rearrange commits to squash trivial changes together, if possible. Utilize [git rebase](http://gitready.com/advanced/2009/03/20/reorder-commits-with-rebase.html) for this purpose. 83 | 4. **Push to Your Branch:** Push your branch to your GitHub repository: `git push origin feat/`. 84 | 5. **Open a Pull Request:** Initiate a pull request to our repository. Our team will review your changes and collaborate with you on any necessary refinements. 85 | 86 | When you are ready to send a PR, we recommend you to first open a `draft` one. This will trigger a bunch of `integration-test` [workflows](https://github.com/instill-ai/model/tree/main/.github/workflows) running a thorough test suite on multiple platforms. After the tests are done and passed, you can now mark the PR `open` to notify the codebase owners to review. We appreciate your endeavour to pass the integration test for your PR to make sure the sanity with respect to the entire scope of **Instill Core**. 87 | 88 | ## Last words 89 | 90 | Your contributions make a difference. Let's build something amazing together! 91 | -------------------------------------------------------------------------------- /.github/workflows/releases-helm-charts.yml: -------------------------------------------------------------------------------- 1 | name: Release Helm Charts 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - charts/**/Chart.yaml 10 | 11 | jobs: 12 | release-helm-charts: 13 | runs-on: ubuntu-latest 14 | env: 15 | HELM_CHART_REPO: instill-ai/helm-charts 16 | HELM_CHART_REPO_BRANCH: main 17 | steps: 18 | - name: Checkout repo 19 | uses: actions/checkout@v4 20 | with: 21 | token: ${{ secrets.botGitHubToken }} 22 | 23 | - name: Install yq - portable yaml processor 24 | uses: mikefarah/yq@v4 25 | 26 | - name: Collect charts 27 | id: charts 28 | run: | 29 | set -e 30 | find -L charts -mindepth 2 -maxdepth 2 -type f \( -name 'Chart.yaml' -o -name 'Chart.yml' \) -exec dirname "{}" \; \ 31 | | sort -u \ 32 | | sed -E 's/^/- /' \ 33 | | yq --no-colors --indent 0 --output-format json '.' \ 34 | | sed -E 's/^/charts=/' >> $GITHUB_OUTPUT 35 | 36 | - name: Install chart releaser 37 | run: | 38 | set -e 39 | arch="$(dpkg --print-architecture)" 40 | curl -s https://api.github.com/repos/helm/chart-releaser/releases/latest \ 41 | | yq --indent 0 --no-colors --input-format json --unwrapScalar \ 42 | ".assets[] | select(.name | test("\""^chart-releaser_.+_linux_${arch}\.tar\.gz$"\"")) | .browser_download_url" \ 43 | | xargs curl -SsL \ 44 | | tar zxf - -C /usr/local/bin 45 | 46 | - name: Install Helm 47 | uses: azure/setup-helm@v3 48 | with: 49 | token: ${{ secrets.botGitHubToken }} 50 | 51 | - name: Helm Dependencies 52 | run: | 53 | set -ex 54 | echo '${{ steps.charts.outputs.charts }}' \ 55 | | yq --indent 0 --no-colors --input-format json --unwrapScalar '.[]' \ 56 | | while read -r dir; do 57 | helm dependency update $dir; 58 | if [ -f "$dir/Chart.lock" ]; then 59 | yq --indent 0 \ 60 | '.dependencies | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' \ 61 | "$dir/Chart.lock" \ 62 | | sh --; 63 | fi 64 | done 65 | 66 | - name: Package charts 67 | id: package 68 | run: | 69 | set -ex 70 | PACKAGES=.cr-release-packages 71 | echo '${{ steps.charts.outputs.charts }}' \ 72 | | yq --indent 0 --no-colors --input-format json --unwrapScalar '.[]' \ 73 | | xargs -d$'\n' cr package --package-path "$PACKAGES" 74 | echo "dir=${PACKAGES}" >> $GITHUB_OUTPUT 75 | 76 | - name: Checkout Helm chart repo 77 | uses: actions/checkout@v4 78 | with: 79 | repository: ${{ env.HELM_CHART_REPO }} 80 | path: .helm-chart-repo 81 | token: ${{ secrets.botGitHubToken }} 82 | 83 | - name: Upload packages 84 | working-directory: .helm-chart-repo 85 | env: 86 | GH_TOKEN: ${{ secrets.botGitHubToken }} 87 | run: | 88 | set -ex 89 | repo=model 90 | tag=$repo-$(yq -r '.version' ../charts/$repo/Chart.yaml) 91 | gh release delete $tag --cleanup-tag --yes || true 92 | sleep 1 93 | owner=$(cut -d '/' -f 1 <<< '${{ env.HELM_CHART_REPO }}') 94 | repo=$(cut -d '/' -f 2 <<< '${{ env.HELM_CHART_REPO }}') 95 | cr upload --git-repo "$repo" --owner "$owner" --token '${{ secrets.botGitHubToken }}' --package-path '../${{ steps.package.outputs.dir }}' --make-release-latest false 96 | 97 | - name: Import GPG Key 98 | uses: crazy-max/ghaction-import-gpg@v5 99 | with: 100 | gpg_private_key: ${{ secrets.botGPGPrivateKey }} 101 | passphrase: ${{ secrets.botGPGPassphrase }} 102 | git_user_signingkey: true 103 | git_commit_gpgsign: true 104 | git_tag_gpgsign: true 105 | workdir: .helm-chart-repo 106 | 107 | - name: Update charts index 108 | working-directory: .helm-chart-repo 109 | run: | 110 | set -ex 111 | git config --local user.email "droplet-bot@users.noreply.github.com" 112 | git config --local user.name "droplet-bot" 113 | owner=$(cut -d '/' -f 1 <<< '${{ env.HELM_CHART_REPO }}') 114 | repo=$(cut -d '/' -f 2 <<< '${{ env.HELM_CHART_REPO }}') 115 | cr index --git-repo "$repo" --owner "$owner" \ 116 | --pages-branch '${{ env.HELM_CHART_REPO_BRANCH }}' \ 117 | --package-path '../${{ steps.package.outputs.dir }}' \ 118 | --index-path index.yaml --push 119 | 120 | - name: Re-upload packages (re-tag) 121 | working-directory: .helm-chart-repo 122 | env: 123 | GH_TOKEN: ${{ secrets.botGitHubToken }} 124 | run: | 125 | set -ex 126 | repo=model 127 | tag=$repo-$(yq -r '.version' ../charts/$repo/Chart.yaml) 128 | gh release delete $tag --cleanup-tag --yes || true 129 | sleep 1 130 | owner=$(cut -d '/' -f 1 <<< '${{ env.HELM_CHART_REPO }}') 131 | repo=$(cut -d '/' -f 2 <<< '${{ env.HELM_CHART_REPO }}') 132 | cr upload --git-repo "$repo" --owner "$owner" --token '${{ secrets.botGitHubToken }}' --package-path '../${{ steps.package.outputs.dir }}' --make-release-latest false 133 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [0.10.0-alpha](https://github.com/instill-ai/deprecated-model/compare/v0.9.0-alpha...v0.10.0-alpha) (2024-03-01) 4 | 5 | 6 | ### Miscellaneous Chores 7 | 8 | * **release:** release v0.10.0-alpha ([fc41ad3](https://github.com/instill-ai/deprecated-model/commit/fc41ad3872c893944bd32d64bb07719faf594324)) 9 | 10 | ## [0.9.0-alpha](https://github.com/instill-ai/model/compare/v0.8.0-alpha...v0.9.0-alpha) (2024-02-16) 11 | 12 | 13 | ### Miscellaneous Chores 14 | 15 | * **release:** release v0.9.0-alpha ([b63f5b7](https://github.com/instill-ai/model/commit/b63f5b7dd9bf188a6fc5f8d587aa81d17987f652)) 16 | 17 | ## [0.8.0-alpha](https://github.com/instill-ai/model/compare/v0.7.0-alpha...v0.8.0-alpha) (2024-01-30) 18 | 19 | 20 | ### Features 21 | 22 | * **model:** update model-cloud serving tag to 0.8.0 ([#97](https://github.com/instill-ai/model/issues/97)) ([b03f34b](https://github.com/instill-ai/model/commit/b03f34b50a7082e05d6bfec38471a1dc09b9258e)) 23 | 24 | ## [0.7.0-alpha](https://github.com/instill-ai/model/compare/v0.6.1-alpha...v0.7.0-alpha) (2024-01-17) 25 | 26 | 27 | ### Miscellaneous Chores 28 | 29 | * **release:** release v0.7.0-alpha ([0f82f52](https://github.com/instill-ai/model/commit/0f82f52f73355ee2238a1b717fee3179310b7a03)) 30 | 31 | ## [0.6.1-alpha](https://github.com/instill-ai/model/compare/v0.6.0-alpha...v0.6.1-alpha) (2024-01-02) 32 | 33 | 34 | ### Bug Fixes 35 | 36 | * **model:** update llava model tag for initilization issue fix ([#77](https://github.com/instill-ai/model/issues/77)) ([3fc18c3](https://github.com/instill-ai/model/commit/3fc18c348ba016686bd2fe9dd03899767cecdc25)) 37 | 38 | 39 | ### Miscellaneous Chores 40 | 41 | * **release:** release v0.6.1-alpha ([d2e6edc](https://github.com/instill-ai/model/commit/d2e6edc4560d2e12bd961d60700d015ce0f71863)) 42 | 43 | ## [0.6.0-alpha](https://github.com/instill-ai/model/compare/v0.5.0-alpha...v0.6.0-alpha) (2023-12-15) 44 | 45 | 46 | ### Miscellaneous Chores 47 | 48 | * **release:** release v0.6.0-alpha ([28d19cb](https://github.com/instill-ai/model/commit/28d19cb0a0a892e01fa02a45d6a8e3e652b5e1cf)) 49 | 50 | ## [0.5.0-alpha](https://github.com/instill-ai/model/compare/v0.4.0-alpha...v0.5.0-alpha) (2023-12-02) 51 | 52 | 53 | ### Features 54 | 55 | * **helm:** add kuberay and raycluster ([#64](https://github.com/instill-ai/model/issues/64)) ([08da3d6](https://github.com/instill-ai/model/commit/08da3d6200f28caab3b3c9b1d810daa29c43a852)) 56 | 57 | 58 | ### Miscellaneous Chores 59 | 60 | * **release:** release v0.5.0-alpha ([cd6bfa5](https://github.com/instill-ai/model/commit/cd6bfa5537d019f8bfa856cc882f224d001faf9b)) 61 | 62 | ## [0.4.0-alpha](https://github.com/instill-ai/model/compare/v0.3.0-alpha...v0.4.0-alpha) (2023-11-13) 63 | 64 | 65 | ### Features 66 | 67 | * **ray:** add ray as model serving service ([#55](https://github.com/instill-ai/model/issues/55)) ([dd093fc](https://github.com/instill-ai/model/commit/dd093fc0b0bf620b862f51e181c32388c8f441aa)) 68 | 69 | 70 | ### Miscellaneous Chores 71 | 72 | * **release:** release v0.4.0-alpha ([ee9ee09](https://github.com/instill-ai/model/commit/ee9ee09811f04d1fc3e704c6189b8e9f9df5306e)) 73 | 74 | ## [0.3.0-alpha](https://github.com/instill-ai/model/compare/v0.2.2-alpha...v0.3.0-alpha) (2023-10-27) 75 | 76 | 77 | ### Miscellaneous Chores 78 | 79 | * **release:** release v0.3.0-alpha ([782118d](https://github.com/instill-ai/model/commit/782118d0a5a08550f789d0d9bead94582967e3ca)) 80 | 81 | ## [0.2.2-alpha](https://github.com/instill-ai/model/compare/v0.2.1-alpha...v0.2.2-alpha) (2023-10-13) 82 | 83 | 84 | ### Miscellaneous Chores 85 | 86 | * **release:** release v0.2.2-alpha ([1492b8a](https://github.com/instill-ai/model/commit/1492b8ab09fec21da86cbee46230a14cc5cdce15)) 87 | 88 | ## [0.2.1-alpha](https://github.com/instill-ai/model/compare/v0.2.0-alpha...v0.2.1-alpha) (2023-09-30) 89 | 90 | 91 | ### Miscellaneous Chores 92 | 93 | * **release:** release v0.2.1-alpha ([12fdd58](https://github.com/instill-ai/model/commit/12fdd58fa3e1bc70319d2d9d682a45b996daf7d4)) 94 | 95 | ## [0.2.0-alpha](https://github.com/instill-ai/model/compare/v0.1.3-alpha...v0.2.0-alpha) (2023-09-13) 96 | 97 | 98 | ### Miscellaneous Chores 99 | 100 | * **release:** release v0.2.0-alpha ([eb29cc2](https://github.com/instill-ai/model/commit/eb29cc29383fb1e25411876fc86db72084e4f6a1)) 101 | 102 | ## [0.1.3-alpha](https://github.com/instill-ai/model/compare/v0.1.2-alpha...v0.1.3-alpha) (2023-08-19) 103 | 104 | 105 | ### Miscellaneous Chores 106 | 107 | * **release:** release v0.1.3-alpha ([dc7e8b6](https://github.com/instill-ai/model/commit/dc7e8b62a0b788d99b2efcff2355a4c371095cdd)) 108 | 109 | ## [0.1.2-alpha](https://github.com/instill-ai/model/compare/v0.1.1-alpha...v0.1.2-alpha) (2023-08-03) 110 | 111 | 112 | ### Miscellaneous Chores 113 | 114 | * **release:** release v0.1.2-alpha ([5c4d85f](https://github.com/instill-ai/model/commit/5c4d85f29ab05eee65cee3c9079fa4bb92399a5c)) 115 | 116 | ## [0.1.1-alpha](https://github.com/instill-ai/model/compare/v0.1.0-alpha...v0.1.1-alpha) (2023-07-20) 117 | 118 | 119 | ### Miscellaneous Chores 120 | 121 | * **release:** release v0.1.1-alpha ([c9cc6ec](https://github.com/instill-ai/model/commit/c9cc6eccb6be5e8688e5c543e2d35dbec6fd691a)) 122 | 123 | ## [0.1.0-alpha](https://github.com/instill-ai/model/compare/v0.1.0-alpha...v0.1.0-alpha) (2023-07-09) 124 | 125 | 126 | ### Miscellaneous Chores 127 | 128 | * **release:** release v0.1.0-alpha ([5748240](https://github.com/instill-ai/model/commit/57482401644ad6efa9b126e0d810e491ff28392d)) 129 | -------------------------------------------------------------------------------- /.github/workflows/releases.yml: -------------------------------------------------------------------------------- 1 | name: Release Please 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | release-please: 10 | runs-on: ubuntu-latest 11 | outputs: 12 | RELEASE_CREATED: ${{ steps.release.outputs.release_created }} 13 | MAJOR: ${{ steps.release.outputs.major }} 14 | MINOR: ${{ steps.release.outputs.minor }} 15 | PATCH: ${{ steps.release.outputs.path }} 16 | TAG_NAME: ${{ steps.release.outputs.tag_name }} 17 | SHA: ${{ steps.release.outputs.sha }} 18 | steps: 19 | - uses: google-github-actions/release-please-action@v3 20 | id: release 21 | with: 22 | token: ${{ secrets.botGitHubToken }} 23 | release-type: simple 24 | command: manifest 25 | config-file: release-please/config.json 26 | manifest-file: release-please/manifest.json 27 | changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]' 28 | - uses: actions/checkout@v4 29 | if: ${{ steps.release.outputs.release_created }} 30 | with: 31 | token: ${{ secrets.botGitHubToken }} 32 | - name: Import GPG Key 33 | if: ${{ steps.release.outputs.release_created }} 34 | uses: crazy-max/ghaction-import-gpg@v5 35 | with: 36 | gpg_private_key: ${{ secrets.botGPGPrivateKey }} 37 | passphrase: ${{ secrets.botGPGPassphrase }} 38 | git_user_signingkey: true 39 | git_commit_gpgsign: true 40 | git_tag_gpgsign: true 41 | - name: Tag major and minor versions 42 | if: ${{ steps.release.outputs.release_created }} 43 | run: | 44 | git tag -d v${{ steps.release.outputs.major }} || true 45 | git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true 46 | git push origin :v${{ steps.release.outputs.major }} || true 47 | git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true 48 | git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }} pointing to tag ${{ steps.release.outputs.tag_name }}" 49 | git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} pointing to tag ${{ steps.release.outputs.tag_name }}" 50 | git push origin v${{ steps.release.outputs.major }} 51 | git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} 52 | release-helm-charts: 53 | runs-on: ubuntu-latest 54 | needs: release-please 55 | if: ${{ needs.release-please.outputs.RELEASE_CREATED }} 56 | steps: 57 | - name: Install yq 58 | uses: mikefarah/yq@v4 59 | - name: Install semver-tool 60 | run: | 61 | git clone https://github.com/fsaintjacques/semver-tool.git 62 | cd semver-tool 63 | sudo make install && /usr/local/bin/semver --version 64 | - name: Install helm-docs 65 | run: | 66 | arch="$(uname -m)" 67 | curl -s https://api.github.com/repos/norwoodj/helm-docs/releases/latest \ 68 | | yq --indent 0 --no-colors --input-format json --unwrapScalar \ 69 | ".assets[] | select(.name | test("\""^helm-docs_.+_Linux_${arch}\.tar\.gz$"\"")) | .browser_download_url" \ 70 | | xargs curl -SsL \ 71 | | tar zxf - -C /usr/local/bin 72 | - uses: actions/checkout@v4 73 | with: 74 | token: ${{ secrets.botGitHubToken }} 75 | - name: Update component image versions 76 | run: | 77 | source .env 78 | yq ".modelBackend.image.tag=\"$MODEL_BACKEND_VERSION\"" -i charts/model/values.yaml 79 | yq ".controllerModel.image.tag=\"$CONTROLLER_MODEL_VERSION\"" -i charts/model/values.yaml 80 | yq ".rayService.image.tag=\"$RAY_SERVER_VERSION\"" -i charts/model/values.yaml 81 | yq ".temporal.admintools.image.tag=\"$TEMPORAL_ADMIN_TOOLS_VERSION\"" -i charts/model/values.yaml 82 | - name: Get current chart version 83 | id: get-current-chart-version 84 | run: | 85 | echo "version=$(yq .version charts/model/Chart.yaml)" >> $GITHUB_OUTPUT 86 | - name: Bump SemVer 87 | id: bump-semver 88 | run: | 89 | echo "next-version=$(semver bump patch ${{ steps.get-current-chart-version.outputs.version }})-alpha" >> $GITHUB_OUTPUT 90 | - name: Bump up Helm chart version 91 | run: | 92 | yq ".version=\"${{ steps.bump-semver.outputs.next-version }}\"" -i charts/model/Chart.yaml 93 | - name: Bump up Helm app version 94 | run: | 95 | string=${{ needs.release-please.outputs.TAG_NAME }} 96 | appVersion=${string#"v"} 97 | yq ".appVersion=\"$appVersion\"" -i charts/model/Chart.yaml 98 | - name: Generate helm-doc 99 | run: | 100 | helm-docs charts/core 101 | - name: Import GPG Key 102 | uses: crazy-max/ghaction-import-gpg@v5 103 | with: 104 | gpg_private_key: ${{ secrets.botGPGPrivateKey }} 105 | passphrase: ${{ secrets.botGPGPassphrase }} 106 | git_user_signingkey: true 107 | git_commit_gpgsign: true 108 | git_tag_gpgsign: true 109 | - name: Commit and push the updated Helm chart 110 | run: | 111 | if [[ `git status --porcelain` ]]; then 112 | git add charts 113 | git commit -S -m "chore(helm): bump up chart and app version" -m "triggered by commit: https://github.com/instill-ai/core/commit/${{ needs.release-please.outputs.SHA }}" 114 | git push 115 | fi 116 | -------------------------------------------------------------------------------- /charts/model/templates/controller-model/deployment.yaml: -------------------------------------------------------------------------------- 1 | {{- $modelRepository := .Values.persistence.persistentVolumeClaim.modelRepository -}} 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: {{ template "model.controllerModel" . }} 6 | labels: 7 | {{- include "model.labels" . | nindent 4 }} 8 | app.kubernetes.io/component: controller-model 9 | annotations: 10 | rollme: {{ randAlphaNum 5 | quote }} 11 | spec: 12 | strategy: 13 | type: {{ .Values.updateStrategy.type }} 14 | {{- if eq .Values.updateStrategy.type "RollingUpdate" }} 15 | rollingUpdate: 16 | maxSurge: {{ .Values.updateStrategy.rollingUpdate.maxSurge }} 17 | maxUnavailable: {{ .Values.updateStrategy.rollingUpdate.maxUnavailable }} 18 | {{- else}} 19 | rollingUpdate: null 20 | {{- end }} 21 | {{- if not .Values.controllerModel.autoscaling.enabled }} 22 | replicas: {{ .Values.controllerModel.replicaCount }} 23 | {{- end }} 24 | selector: 25 | matchLabels: 26 | {{- include "model.matchLabels" . | nindent 6 }} 27 | app.kubernetes.io/component: controller-model 28 | template: 29 | metadata: 30 | labels: 31 | {{- include "model.matchLabels" . | nindent 8 }} 32 | app.kubernetes.io/component: controller-model 33 | annotations: 34 | checksum/config: {{ include (print $.Template.BasePath "/controller-model/configmap.yaml") . | sha256sum }} 35 | {{- with .Values.controllerModel.podAnnotations }} 36 | {{- toYaml . | nindent 8 }} 37 | {{- end }} 38 | spec: 39 | # distroless users 40 | # root:x:0:0:root:/root:/sbin/nologin 41 | # nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin 42 | # nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin 43 | securityContext: 44 | runAsUser: 65534 45 | runAsGroup: 65534 46 | {{- if .Values.controllerModel.serviceAccountName }} 47 | serviceAccountName: {{ .Values.controllerModel.serviceAccountName }} 48 | {{- end }} 49 | {{- with .Values.imagePullSecrets }} 50 | imagePullSecrets: 51 | {{- toYaml . | nindent 8 }} 52 | {{- end }} 53 | automountServiceAccountToken: {{ .Values.controllerModel.automountServiceAccountToken | default false }} 54 | terminationGracePeriodSeconds: 120 55 | initContainers: 56 | - name: wait-for-dependencies 57 | image: curlimages/curl:8.00.1 58 | command: ['sh', '-c'] 59 | args: 60 | - > 61 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${ETCD_HOST}:${ETCD_CLIENT_PORT}/health)" != "200" ]]; do echo waiting for etcd; sleep 1; done && 62 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${MODEL_BACKEND_HOST}:${MODEL_BACKEND_PORT}/v1alpha/health/model)" != "200" ]]; do echo waiting for model-backend; sleep 1; done 63 | env: 64 | - name: MODEL_BACKEND_HOST 65 | value: "{{ template "model.modelBackend" . }}" 66 | - name: MODEL_BACKEND_PORT 67 | value: "{{ template "model.modelBackend.publicPort" . }}" 68 | - name: ETCD_HOST 69 | value: "{{ template "core.etcd" . }}" 70 | - name: ETCD_CLIENT_PORT 71 | value: "{{ template "core.etcd.clientPort" . }}" 72 | containers: 73 | - name: controller-model 74 | image: {{ .Values.controllerModel.image.repository }}:{{ .Values.controllerModel.image.tag }} 75 | imagePullPolicy: {{ .Values.controllerModel.image.pullPolicy }} 76 | readinessProbe: 77 | httpGet: 78 | path: /v1alpha/__readiness 79 | scheme: {{ ternary "https" "http" .Values.internalTLS.enabled | upper }} 80 | port: {{ ternary "https" "http" .Values.internalTLS.enabled }}-private 81 | initialDelaySeconds: 5 82 | periodSeconds: 10 83 | livenessProbe: 84 | httpGet: 85 | path: /v1alpha/__liveness 86 | scheme: {{ ternary "https" "http" .Values.internalTLS.enabled | upper }} 87 | port: {{ ternary "https" "http" .Values.internalTLS.enabled }}-private 88 | initialDelaySeconds: 5 89 | periodSeconds: 10 90 | {{- if .Values.controllerModel.resources }} 91 | resources: 92 | {{- toYaml .Values.controllerModel.resources | nindent 12 }} 93 | {{- end }} 94 | command: [./{{ .Values.controllerModel.commandName.main }}] 95 | ports: 96 | - name: {{ ternary "https" "http" .Values.internalTLS.enabled }}-private 97 | containerPort: {{ template "model.controllerModel.privatePort" . }} 98 | protocol: TCP 99 | volumeMounts: 100 | - name: config 101 | mountPath: {{ .Values.controllerModel.configPath }} 102 | subPath: config.yaml 103 | - name: model-repository 104 | mountPath: /model-repository 105 | {{- if .Values.internalTLS.enabled }} 106 | - name: controller-internal-certs 107 | mountPath: "/etc/instill-ai/model/ssl/controller" 108 | {{- end }} 109 | {{- with .Values.controllerModel.extraVolumeMounts }} 110 | {{- toYaml . | nindent 12 }} 111 | {{- end }} 112 | {{- if .Values.controllerModel.extraEnv }} 113 | env: 114 | {{- toYaml .Values.controllerModel.extraEnv | nindent 12 }} 115 | {{- end }} 116 | {{- with .Values.controllerModel.sidecarContainers }} 117 | {{- toYaml . | nindent 8 }} 118 | {{- end }} 119 | volumes: 120 | - name: config 121 | configMap: 122 | name: {{ template "model.controllerModel" . }} 123 | - name: controller-internal-certs 124 | secret: 125 | secretName: {{ template "model.internalTLS.controllerModel.secretName" . }} 126 | - name: model-repository 127 | {{- if not .Values.persistence.enabled }} 128 | emptyDir: {} 129 | {{- else if $modelRepository.existingClaim }} 130 | persistentVolumeClaim: 131 | claimName: {{ $modelRepository.existingClaim }} 132 | {{- else }} 133 | persistentVolumeClaim: 134 | claimName: model-repository-data-volume 135 | {{- end }} 136 | {{- with .Values.controllerModel.extraVolumes }} 137 | {{- toYaml . | nindent 8 }} 138 | {{- end }} 139 | {{- with .Values.controllerModel.nodeSelector }} 140 | nodeSelector: 141 | {{- toYaml . | nindent 8 }} 142 | {{- end }} 143 | {{- with .Values.controllerModel.affinity }} 144 | affinity: 145 | {{- toYaml . | nindent 8 }} 146 | {{- end }} 147 | {{- with .Values.controllerModel.tolerations }} 148 | tolerations: 149 | {{- toYaml . | nindent 8 }} 150 | {{- end }} 151 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | networks: 4 | default: 5 | name: instill-network 6 | external: true 7 | 8 | volumes: 9 | conda_pack: 10 | name: conda-pack 11 | ray_conda: 12 | name: ray-conda 13 | model_repository: 14 | name: model-repository 15 | model_cache: 16 | name: model-cache 17 | 18 | services: 19 | model_backend_migrate: 20 | container_name: ${MODEL_BACKEND_HOST}-migrate 21 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 22 | restart: on-failure 23 | environment: 24 | CFG_DATABASE_HOST: ${POSTGRESQL_HOST} 25 | CFG_DATABASE_PORT: ${POSTGRESQL_PORT} 26 | CFG_DATABASE_USERNAME: postgres 27 | CFG_DATABASE_PASSWORD: password 28 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 29 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 30 | entrypoint: ./model-backend-migrate 31 | 32 | model_backend_init: 33 | container_name: ${MODEL_BACKEND_HOST}-init 34 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 35 | restart: on-failure 36 | environment: 37 | CFG_DATABASE_HOST: ${POSTGRESQL_HOST} 38 | CFG_DATABASE_PORT: ${POSTGRESQL_PORT} 39 | CFG_DATABASE_USERNAME: postgres 40 | CFG_DATABASE_PASSWORD: password 41 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 42 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 43 | entrypoint: ./model-backend-init 44 | depends_on: 45 | - model_backend_migrate 46 | 47 | model_backend_worker: 48 | container_name: ${MODEL_BACKEND_HOST}-worker 49 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 50 | restart: unless-stopped 51 | environment: 52 | CFG_SERVER_DEBUG: "false" 53 | CFG_SERVER_ITMODE_ENABLED: ${ITMODE_ENABLED} 54 | CFG_RAYSERVER_VRAM: ${RAY_SERVER_VRAM} 55 | CFG_DATABASE_HOST: ${POSTGRESQL_HOST} 56 | CFG_DATABASE_PORT: ${POSTGRESQL_PORT} 57 | CFG_DATABASE_USERNAME: postgres 58 | CFG_DATABASE_PASSWORD: password 59 | CFG_TEMPORAL_CLIENTOPTIONS_HOSTPORT: ${TEMPORAL_HOST}:${TEMPORAL_PORT} 60 | CFG_CACHE_REDIS_REDISOPTIONS_ADDR: ${REDIS_HOST}:${REDIS_PORT} 61 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 62 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 63 | volumes: 64 | - model_repository:/model-repository 65 | - model_cache:/.cache 66 | - ray_conda:/ray-conda 67 | entrypoint: ./model-backend-worker 68 | depends_on: 69 | model_backend_init: 70 | condition: service_completed_successfully 71 | temporal_admin_tools_model: 72 | condition: service_completed_successfully 73 | 74 | model_backend: 75 | container_name: ${MODEL_BACKEND_HOST} 76 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 77 | restart: unless-stopped 78 | environment: 79 | CFG_SERVER_PRIVATEPORT: ${MODEL_BACKEND_PRIVATEPORT} 80 | CFG_SERVER_PUBLICPORT: ${MODEL_BACKEND_PUBLICPORT} 81 | CFG_SERVER_DEBUG: "false" 82 | CFG_SERVER_MAXDATASIZE: ${MAX_DATA_SIZE} 83 | CFG_SERVER_ITMODE_ENABLED: ${ITMODE_ENABLED} 84 | CFG_SERVER_USAGE_ENABLED: ${USAGE_ENABLED} 85 | CFG_SERVER_EDITION: ${EDITION} 86 | CFG_RAYSERVER_GRPCURI: ${RAY_SERVER_HOST}:${RAY_SERVER_SERVE_GRPC_PORT} 87 | CFG_RAYSERVER_MODELSTORE: /model-repository 88 | CFG_RAYSERVER_VRAM: ${RAY_SERVER_VRAM} 89 | CFG_DATABASE_HOST: ${POSTGRESQL_HOST} 90 | CFG_DATABASE_PORT: ${POSTGRESQL_PORT} 91 | CFG_DATABASE_USERNAME: postgres 92 | CFG_DATABASE_PASSWORD: password 93 | CFG_MGMTBACKEND_HOST: ${MGMT_BACKEND_HOST} 94 | CFG_MGMTBACKEND_PRIVATEPORT: ${MGMT_BACKEND_PRIVATEPORT} 95 | CFG_TEMPORAL_CLIENTOPTIONS_HOSTPORT: ${TEMPORAL_HOST}:${TEMPORAL_PORT} 96 | CFG_CACHE_REDIS_REDISOPTIONS_ADDR: ${REDIS_HOST}:${REDIS_PORT} 97 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 98 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 99 | volumes: 100 | - model_repository:/model-repository 101 | - model_cache:/.cache 102 | - ray_conda:/ray-conda 103 | healthcheck: 104 | test: 105 | [ 106 | "CMD", 107 | "curl", 108 | "-f", 109 | "http://${MODEL_BACKEND_HOST}:${MODEL_BACKEND_PUBLICPORT}/v1alpha/ready/model", 110 | ] 111 | timeout: 20s 112 | retries: 10 113 | entrypoint: ./model-backend 114 | depends_on: 115 | - ray_server 116 | - model_backend_worker 117 | 118 | model_backend_init_model: 119 | container_name: ${MODEL_BACKEND_HOST}-init-model 120 | image: ${MODEL_BACKEND_IMAGE}:${MODEL_BACKEND_VERSION} 121 | restart: on-failure 122 | environment: 123 | MODEL_BACKEND_HOST: ${MODEL_BACKEND_HOST} 124 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 125 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 126 | entrypoint: ./model-backend-init-model 127 | depends_on: 128 | model_backend: 129 | condition: service_healthy 130 | 131 | controller_model: 132 | container_name: ${CONTROLLER_MODEL_HOST} 133 | image: ${CONTROLLER_MODEL_IMAGE}:${CONTROLLER_MODEL_VERSION} 134 | restart: unless-stopped 135 | environment: 136 | CFG_SERVER_DEBUG: "false" 137 | CFG_SERVER_EDITION: ${EDITION} 138 | CFG_DATABASE_HOST: ${POSTGRESQL_HOST} 139 | CFG_DATABASE_PORT: ${POSTGRESQL_PORT} 140 | CFG_DATABASE_USERNAME: postgres 141 | CFG_DATABASE_PASSWORD: password 142 | CFG_ETCD_HOST: ${ETCD_HOST} 143 | CFG_ETCD_PORT: ${ETCD_CLIENT_PORT} 144 | CFG_LOG_EXTERNAL: ${OBSERVE_ENABLED} 145 | CFG_LOG_OTELCOLLECTOR_PORT: ${OTEL_COLLECTOR_PORT} 146 | entrypoint: ./controller-model 147 | volumes: 148 | - model_repository:/model-repository 149 | 150 | ray_server: 151 | container_name: ${RAY_SERVER_HOST} 152 | image: ${RAY_SERVER_IMAGE}:${RAY_RELEASE_TAG} 153 | restart: unless-stopped 154 | environment: 155 | - RAY_ADDRESS=0.0.0.0:6379 156 | - RAY_REDIS_ADDRESS=redis:6379 157 | - RAY_GRAFANA_HOST=http://${GRAFANA_HOST}:${GRAFANA_PORT} 158 | - RAY_PROMETHEUS_HOST=http://${PROMETHEUS_HOST}:${PROMETHEUS_PORT} 159 | - RAY_GRAFANA_IFRAME_HOST=http://localhost:${GRAFANA_EXPOSE_PORT} 160 | entrypoint: ["/bin/bash", "-c"] 161 | command: | 162 | 'ray start --head --node-ip-address=0.0.0.0 --dashboard-host=0.0.0.0 --metrics-export-port ${RAY_SERVER_PROMETHEUS_PORT} --disable-usage-stats && 163 | serve start --http-host=0.0.0.0 --grpc-port ${RAY_SERVER_SERVE_GRPC_PORT} --grpc-servicer-functions ray_pb2_grpc.add_RayServiceServicer_to_server && 164 | tail -f /dev/null' 165 | volumes: 166 | - model_repository:/model-repository 167 | - ray_conda:/home/ray/anaconda3/ 168 | healthcheck: 169 | test: ["CMD", "ray", "status"] 170 | timeout: 20s 171 | retries: 10 172 | shm_size: 4gb 173 | ports: 174 | - ${RAY_SERVER_DASHBOARD_PORT}:${RAY_SERVER_DASHBOARD_PORT} 175 | 176 | temporal_admin_tools_model: 177 | container_name: temporal-admin-tools-model 178 | image: ${TEMPORAL_ADMIN_TOOLS_IMAGE}:${TEMPORAL_ADMIN_TOOLS_VERSION} 179 | restart: on-failure 180 | environment: 181 | TEMPORAL_CLI_ADDRESS: ${TEMPORAL_HOST}:${TEMPORAL_PORT} 182 | entrypoint: ["/bin/bash", "-c"] 183 | command: | 184 | 'if [[ ! $(tctl --namespace model-backend namespace list | grep model-backend) ]]; then tctl --namespace model-backend namespace register; fi' 185 | -------------------------------------------------------------------------------- /charts/model/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Expand the name of the chart. 3 | */}} 4 | {{- define "model.name" -}} 5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 6 | {{- end -}} 7 | 8 | {{/* 9 | Create a default fully qualified app name. 10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 11 | If release name contains chart name it will be used as a full name. 12 | */}} 13 | {{- define "model.fullname" -}} 14 | {{- if .Values.fullnameOverride -}} 15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 16 | {{- else -}} 17 | {{- $name := default .Chart.Name .Values.nameOverride -}} 18 | {{- if contains $name .Release.Name -}} 19 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 20 | {{- else -}} 21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 22 | {{- end -}} 23 | {{- end -}} 24 | {{- end -}} 25 | 26 | {{/* 27 | Allow the release namespace to be overridden for multi-namespace deployments in combined charts 28 | */}} 29 | {{- define "model.namespace" -}} 30 | {{- if .Values.namespaceOverride -}} 31 | {{- .Values.namespaceOverride -}} 32 | {{- else -}} 33 | {{- .Release.Namespace -}} 34 | {{- end -}} 35 | {{- end -}} 36 | 37 | {{/* 38 | Create chart name and version as used by the chart label. 39 | */}} 40 | {{- define "model.chart" -}} 41 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 42 | {{- end -}} 43 | 44 | {{/* 45 | Common labels 46 | */}} 47 | {{- define "model.labels" -}} 48 | app.kubernetes.io/name: {{ include "model.name" . }} 49 | helm.sh/chart: {{ include "model.chart" . }} 50 | app.kubernetes.io/managed-by: {{ .Release.Service }} 51 | app.kubernetes.io/instance: {{ .Release.Name }} 52 | app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }} 53 | app.kubernetes.io/part-of: {{ .Chart.Name }} 54 | {{- end -}} 55 | 56 | {{/* 57 | MatchLabels 58 | */}} 59 | {{- define "model.matchLabels" -}} 60 | app.kubernetes.io/instance: {{ .Release.Name }} 61 | app.kubernetes.io/name: {{ include "model.name" . }} 62 | {{- end -}} 63 | 64 | {{- define "model.autoGenCert" -}} 65 | {{- if and .Values.expose.tls.enabled (eq .Values.expose.tls.certSource "auto") -}} 66 | {{- printf "true" -}} 67 | {{- else -}} 68 | {{- printf "false" -}} 69 | {{- end -}} 70 | {{- end -}} 71 | 72 | {{- define "model.autoGenCertForIngress" -}} 73 | {{- if and (eq (include "model.autoGenCert" .) "true") (eq .Values.expose.type "ingress") -}} 74 | {{- printf "true" -}} 75 | {{- else -}} 76 | {{- printf "false" -}} 77 | {{- end -}} 78 | {{- end -}} 79 | 80 | {{- define "core.database.host" -}} 81 | {{- template "core.database" . -}} 82 | {{- end -}} 83 | 84 | {{- define "core.database.port" -}} 85 | {{- print "5432" -}} 86 | {{- end -}} 87 | 88 | {{- define "core.database.username" -}} 89 | {{- print "postgres" -}} 90 | {{- end -}} 91 | 92 | {{- define "core.database.rawPassword" -}} 93 | {{- print "password" -}} 94 | {{- end -}} 95 | 96 | /*host:port*/ 97 | {{- define "core.redis.addr" -}} 98 | {{- with .Values.redis -}} 99 | {{- default (printf "%s:6379" (include "core.redis" $ )) .addr -}} 100 | {{- end -}} 101 | {{- end -}} 102 | 103 | {{- define "core.mgmtBackend" -}} 104 | {{- print "core-mgmt-backend" -}} 105 | {{- end -}} 106 | 107 | {{- define "core.openfga" -}} 108 | {{- printf "core-openfga" -}} 109 | {{- end -}} 110 | 111 | {{- define "model.modelBackend" -}} 112 | {{- printf "%s-model-backend" (include "model.fullname" .) -}} 113 | {{- end -}} 114 | 115 | {{- define "model.controllerModel" -}} 116 | {{- printf "%s-controller-model" (include "model.fullname" .) -}} 117 | {{- end -}} 118 | 119 | {{- define "model.kuberay-operator" -}} 120 | {{- printf "%s-kuberay-operator" (include "model.fullname" .) -}} 121 | {{- end -}} 122 | 123 | {{- define "model.ray-service" -}} 124 | {{- printf "%s-ray" (include "model.fullname" .) -}} 125 | {{- end -}} 126 | 127 | {{- define "model.ray" -}} 128 | {{- printf "%s-ray-head-svc" (include "model.fullname" .) -}} 129 | {{- end -}} 130 | 131 | {{- define "core.database" -}} 132 | {{- print "core-database" -}} 133 | {{- end -}} 134 | 135 | {{- define "core.redis" -}} 136 | {{- print "core-redis" -}} 137 | {{- end -}} 138 | 139 | {{- define "core.temporal" -}} 140 | {{- printf "core-temporal" -}} 141 | {{- end -}} 142 | 143 | {{- define "core.etcd" -}} 144 | {{- printf "core-etcd" -}} 145 | {{- end -}} 146 | 147 | {{/* model-backend service and container public port */}} 148 | {{- define "model.modelBackend.publicPort" -}} 149 | {{- printf "8083" -}} 150 | {{- end -}} 151 | 152 | {{/* model-backend service and container private port */}} 153 | {{- define "model.modelBackend.privatePort" -}} 154 | {{- printf "3083" -}} 155 | {{- end -}} 156 | 157 | {{/* controller-model service and container private port */}} 158 | {{- define "model.controllerModel.privatePort" -}} 159 | {{- printf "3086" -}} 160 | {{- end -}} 161 | 162 | {{/* mgmt-backend service and container public port */}} 163 | {{- define "core.mgmtBackend.publicPort" -}} 164 | {{- printf "8084" -}} 165 | {{- end -}} 166 | 167 | {{/* mgmt-backend service and container private port */}} 168 | {{- define "core.mgmtBackend.privatePort" -}} 169 | {{- printf "3084" -}} 170 | {{- end -}} 171 | 172 | {{- define "model.ray.clientPort" -}} 173 | {{- printf "10001" -}} 174 | {{- end -}} 175 | 176 | {{- define "model.ray.dashboardPort" -}} 177 | {{- printf "8265" -}} 178 | {{- end -}} 179 | 180 | {{- define "model.ray.gcsPort" -}} 181 | {{- printf "6379" -}} 182 | {{- end -}} 183 | 184 | {{- define "model.ray.servePort" -}} 185 | {{- printf "8000" -}} 186 | {{- end -}} 187 | 188 | {{- define "model.ray.serveGrpcPort" -}} 189 | {{- printf "9000" -}} 190 | {{- end -}} 191 | 192 | {{- define "model.ray.prometheusPort" -}} 193 | {{- printf "8079" -}} 194 | {{- end -}} 195 | 196 | {{/* temporal container frontend gRPC port */}} 197 | {{- define "core.temporal.frontend.grpcPort" -}} 198 | {{- printf "7233" -}} 199 | {{- end -}} 200 | 201 | {{/* etcd port */}} 202 | {{- define "core.etcd.clientPort" -}} 203 | {{- printf "2379" -}} 204 | {{- end -}} 205 | 206 | {{- define "core.influxdb" -}} 207 | {{- printf "core-influxdb2" -}} 208 | {{- end -}} 209 | 210 | {{- define "core.influxdb.port" -}} 211 | {{- printf "8086" -}} 212 | {{- end -}} 213 | 214 | {{- define "core.jaeger" -}} 215 | {{- printf "core-jaeger-collector" -}} 216 | {{- end -}} 217 | 218 | {{- define "core.jaeger.port" -}} 219 | {{- printf "14268" -}} 220 | {{- end -}} 221 | 222 | {{- define "core.otel" -}} 223 | {{- printf "core-opentelemetry-collector" -}} 224 | {{- end -}} 225 | 226 | {{- define "core.otel.port" -}} 227 | {{- printf "8095" -}} 228 | {{- end -}} 229 | 230 | {{- define "model.internalTLS.modelBackend.secretName" -}} 231 | {{- if eq .Values.internalTLS.certSource "secret" -}} 232 | {{- .Values.internalTLS.modelBackend.secretName -}} 233 | {{- else -}} 234 | {{- printf "%s-model-backend-internal-tls" (include "model.fullname" .) -}} 235 | {{- end -}} 236 | {{- end -}} 237 | 238 | {{- define "model.internalTLS.controllerModel.secretName" -}} 239 | {{- if eq .Values.internalTLS.certSource "secret" -}} 240 | {{- .Values.internalTLS.controllerModel.secretName -}} 241 | {{- else -}} 242 | {{- printf "%s-controller-model-internal-tls" (include "model.fullname" .) -}} 243 | {{- end -}} 244 | {{- end -}} 245 | 246 | {{/* Allow KubeVersion to be overridden. */}} 247 | {{- define "model.ingress.kubeVersion" -}} 248 | {{- default .Capabilities.KubeVersion.Version .Values.expose.ingress.kubeVersionOverride -}} 249 | {{- end -}} 250 | -------------------------------------------------------------------------------- /charts/model/templates/ray-service/ray-service.yaml: -------------------------------------------------------------------------------- 1 | {{- $modelRepository := .Values.persistence.persistentVolumeClaim.modelRepository -}} 2 | {{- $rayConda := .Values.persistence.persistentVolumeClaim.rayConda -}} 3 | apiVersion: ray.io/v1 4 | kind: RayCluster 5 | metadata: 6 | name: {{ template "model.ray-service" . }} 7 | # annotations: 8 | # ray.io/ft-enabled: "true" 9 | spec: 10 | rayVersion: {{ .Values.rayService.image.version }} 11 | ## raycluster autoscaling config 12 | enableInTreeAutoscaling: true 13 | autoscalerOptions: 14 | upscalingMode: Default 15 | # idleTimeoutSeconds is the number of seconds to wait before scaling down a worker pod which is not using Ray resources. 16 | idleTimeoutSeconds: 60 17 | imagePullPolicy: Always 18 | securityContext: {} 19 | env: [] 20 | envFrom: [] 21 | {{- if .Values.rayService.spec.autoscalerOptions.resources }} 22 | resources: 23 | {{- toYaml .Values.rayService.spec.autoscalerOptions.resources | nindent 6 }} 24 | {{- end }} 25 | headGroupSpec: 26 | rayStartParams: 27 | num-cpus: "0" 28 | num-gpus: "0" 29 | disable-usage-stats: "true" 30 | template: 31 | spec: 32 | {{- with .Values.rayService.headGroupSpec.nodeSelector }} 33 | nodeSelector: 34 | {{- toYaml . | nindent 10 }} 35 | {{- end }} 36 | {{- with .Values.rayService.headGroupSpec.affinity }} 37 | affinity: 38 | {{- toYaml . | nindent 10 }} 39 | {{- end }} 40 | volumes: 41 | - name: ray-conda 42 | {{- if not $.Values.persistence.enabled }} 43 | emptyDir: {} 44 | {{- else if $rayConda.existingClaim }} 45 | persistentVolumeClaim: 46 | claimName: {{ $rayConda.existingClaim }} 47 | {{- else }} 48 | persistentVolumeClaim: 49 | claimName: ray-conda-data-volume 50 | {{- end }} 51 | - name: cp-conda-env-configmap 52 | configMap: 53 | name: cp-conda-env 54 | defaultMode: 0777 55 | items: 56 | - key: cp_conda_env.sh 57 | path: cp_conda_env.sh 58 | containers: 59 | - name: ray-head 60 | image: {{ .Values.rayService.image.repository }}:{{ .Values.rayService.image.tag }} 61 | imagePullPolicy: Always 62 | {{- if .Values.rayService.headGroupSpec.resources }} 63 | resources: 64 | {{- toYaml .Values.rayService.headGroupSpec.resources | nindent 14 }} 65 | {{- end }} 66 | env: 67 | - name: RAY_GRAFANA_IFRAME_HOST 68 | value: http://127.0.0.1:3002 69 | - name: RAY_GRAFANA_HOST 70 | value: http://core-grafana:80 71 | - name: RAY_PROMETHEUS_HOST 72 | value: http://core-prometheus:9090 73 | volumeMounts: 74 | - mountPath: /ray-conda-pack 75 | name: ray-conda 76 | - mountPath: /home/ray/script 77 | name: cp-conda-env-configmap 78 | ports: 79 | - containerPort: 6379 80 | name: gcs-server 81 | - containerPort: 8265 82 | name: dashboard 83 | - containerPort: 10001 84 | name: client 85 | - containerPort: 8000 86 | name: serve 87 | - containerPort: 9000 88 | name: serve-grpc 89 | - containerPort: 44217 90 | name: as-metrics # autoscaler 91 | - containerPort: 44227 92 | name: dash-metrics # dashboard 93 | lifecycle: 94 | postStart: 95 | exec: 96 | command: ["/bin/sh","-c","/home/ray/script/cp_conda_env.sh"] 97 | preStop: 98 | exec: 99 | command: ["/bin/sh","-c","ray stop"] 100 | workerGroupSpecs: 101 | {{- range $workerGroupSpecs := .Values.rayService.workerGroupSpecs }} 102 | - replicas: {{ $workerGroupSpecs.replicas }} 103 | minReplicas: {{ $workerGroupSpecs.minReplicas }} 104 | maxReplicas: {{ $workerGroupSpecs.maxReplicas }} 105 | groupName: {{ $workerGroupSpecs.groupName }} 106 | rayStartParams: 107 | disable-usage-stats: "true" 108 | #pod template 109 | template: 110 | spec: 111 | {{- with $workerGroupSpecs.nodeSelector }} 112 | nodeSelector: 113 | {{- toYaml . | nindent 12 }} 114 | {{- end }} 115 | {{- with $workerGroupSpecs.affinity }} 116 | affinity: 117 | {{- toYaml . | nindent 12 }} 118 | {{- end }} 119 | volumes: 120 | - name: model-repository 121 | {{- if not $.Values.persistence.enabled }} 122 | emptyDir: {} 123 | {{- else if $modelRepository.existingClaim }} 124 | persistentVolumeClaim: 125 | claimName: {{ $modelRepository.existingClaim }} 126 | {{- else }} 127 | persistentVolumeClaim: 128 | claimName: model-repository-data-volume 129 | {{- end }} 130 | - name: start-ray-serve-configmap 131 | configMap: 132 | name: start-ray-serve 133 | defaultMode: 0777 134 | items: 135 | - key: start_ray_serve.sh 136 | path: start_ray_serve.sh 137 | containers: 138 | - name: ray-worker 139 | image: {{ $.Values.rayService.image.repository }}:{{ $.Values.rayService.image.tag }} 140 | imagePullPolicy: Always 141 | lifecycle: 142 | postStart: 143 | exec: 144 | command: ["/bin/sh","-c","/home/ray/script/start_ray_serve.sh"] 145 | preStop: 146 | exec: 147 | command: ["/bin/sh","-c","ray stop"] 148 | # TODO: determine how big the head node should be 149 | # Optimal resource allocation will depend on our Kubernetes infrastructure and might 150 | # require some experimentation. 151 | # Setting requests=limits is recommended with Ray. K8s limits are used for Ray-internal 152 | # resource accounting. K8s requests are not used by Ray. 153 | # this also apply to the workerGroup 154 | resources: 155 | {{- if $workerGroupSpecs.gpuWorkerGroup.enabled }} 156 | {{- toYaml $workerGroupSpecs.gpuWorkerGroup.resources | nindent 16 }} 157 | {{- else }} 158 | {{- toYaml $workerGroupSpecs.resources | nindent 16 }} 159 | {{- end }} 160 | volumeMounts: 161 | - mountPath: /home/ray/script 162 | name: start-ray-serve-configmap 163 | - mountPath: /model-repository 164 | name: model-repository 165 | {{- end }} 166 | --- 167 | apiVersion: v1 168 | kind: ConfigMap 169 | metadata: 170 | name: cp-conda-env 171 | data: 172 | cp_conda_env.sh: | 173 | #!/bin/bash 174 | 175 | # wait for ray cluster to finish initialization 176 | while true; do 177 | ray health-check 2>/dev/null 178 | if [ "$?" = "0" ]; then 179 | break 180 | else 181 | echo "INFO: waiting for ray head to start" 182 | sleep 1 183 | fi 184 | done 185 | 186 | sudo chown -R 1000:100 /ray-conda-pack 187 | cp -r /home/ray/anaconda3/* /ray-conda-pack 188 | 189 | echo "INFO: Conda env copying done" 190 | --- 191 | apiVersion: v1 192 | kind: ConfigMap 193 | metadata: 194 | name: start-ray-serve 195 | data: 196 | start_ray_serve.sh: | 197 | #!/bin/bash 198 | 199 | # wait for ray cluster to finish initialization 200 | while true; do 201 | ray health-check 2>/dev/null 202 | if [ "$?" = "0" ]; then 203 | break 204 | else 205 | echo "INFO: waiting for ray head to start" 206 | sleep 1 207 | fi 208 | done 209 | 210 | serve start --http-host=0.0.0.0 --grpc-port 9000 --grpc-servicer-functions ray_pb2_grpc.add_RayServiceServicer_to_server 211 | 212 | echo "INFO: Start ray serve" 213 | -------------------------------------------------------------------------------- /charts/model/templates/model-backend/deployment.yaml: -------------------------------------------------------------------------------- 1 | {{- $modelRepository := .Values.persistence.persistentVolumeClaim.modelRepository -}} 2 | {{- $rayConda := .Values.persistence.persistentVolumeClaim.rayConda -}} 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: {{ template "model.modelBackend" . }} 7 | labels: 8 | {{- include "model.labels" . | nindent 4 }} 9 | app.kubernetes.io/component: model-backend 10 | annotations: 11 | rollme: {{ randAlphaNum 5 | quote }} 12 | {{- with .Values.modelBackend.annotations }} 13 | {{- toYaml . | nindent 4 }} 14 | {{- end }} 15 | spec: 16 | strategy: 17 | type: {{ .Values.updateStrategy.type }} 18 | {{- if eq .Values.updateStrategy.type "RollingUpdate" }} 19 | rollingUpdate: 20 | maxSurge: {{ .Values.updateStrategy.rollingUpdate.maxSurge }} 21 | maxUnavailable: {{ .Values.updateStrategy.rollingUpdate.maxUnavailable }} 22 | {{- else}} 23 | rollingUpdate: null 24 | {{- end }} 25 | {{- if not .Values.modelBackend.autoscaling.enabled }} 26 | replicas: {{ .Values.modelBackend.replicaCount }} 27 | {{- end }} 28 | selector: 29 | matchLabels: 30 | {{- include "model.matchLabels" . | nindent 6 }} 31 | app.kubernetes.io/component: model-backend 32 | template: 33 | metadata: 34 | labels: 35 | {{- include "model.matchLabels" . | nindent 8 }} 36 | app.kubernetes.io/component: model-backend 37 | annotations: 38 | checksum/config: {{ include (print $.Template.BasePath "/model-backend/configmap.yaml") . | sha256sum }} 39 | {{- with .Values.modelBackend.podAnnotations }} 40 | {{- toYaml . | nindent 8 }} 41 | {{- end }} 42 | spec: 43 | # Ubuntu nobody:nogroup is 65534:65534 44 | securityContext: 45 | runAsUser: 65534 46 | runAsGroup: 65534 47 | {{- if .Values.modelBackend.serviceAccountName }} 48 | serviceAccountName: {{ .Values.modelBackend.serviceAccountName }} 49 | {{- end }} 50 | {{- with .Values.imagePullSecrets }} 51 | imagePullSecrets: 52 | {{- toYaml . | nindent 8 }} 53 | {{- end }} 54 | automountServiceAccountToken: {{ .Values.modelBackend.automountServiceAccountToken | default false }} 55 | terminationGracePeriodSeconds: 120 56 | initContainers: 57 | {{- if .Values.database.enabled }} 58 | - name: wait-for-db 59 | image: {{ .Values.database.image.repository }}:{{ .Values.database.image.tag }} 60 | imagePullPolicy: {{ $.Values.database.image.pullPolicy }} 61 | command: ['sh', '-c', "until pg_isready; do echo waiting for db; sleep 2; done"] 62 | env: 63 | - name: PGHOST 64 | value: {{ template "core.database" . }} 65 | - name: PGUSER 66 | value: {{ template "core.database.username" . }} 67 | {{- end }} 68 | {{- if not .Values.modelBackend.temporal.hostPort }} 69 | - name: temporal-admin-tools 70 | securityContext: 71 | runAsUser: 0 72 | image: {{ .Values.temporal.admintools.image.repository }}:{{ .Values.temporal.admintools.image.tag }} 73 | imagePullPolicy: {{ .Values.temporal.admintools.image.pullPolicy }} 74 | command: ["/bin/bash", "-c"] 75 | args: 76 | - > 77 | until tctl cluster health 2>&1 > /dev/null; do echo waiting for Temporal; sleep 2; done && 78 | if [[ ! $(tctl --namespace model-backend namespace list | grep model-backend) ]]; then tctl --namespace model-backend namespace register; fi 79 | env: 80 | - name: TEMPORAL_CLI_ADDRESS 81 | value: "{{ template "core.temporal" . }}-frontend:{{ template "core.temporal.frontend.grpcPort" . }}" 82 | {{- end }} 83 | - name: model-backend-migration 84 | image: {{ .Values.modelBackend.image.repository }}:{{ .Values.modelBackend.image.tag }} 85 | imagePullPolicy: {{ .Values.modelBackend.image.pullPolicy }} 86 | {{- if .Values.modelBackend.resources }} 87 | resources: 88 | {{- toYaml .Values.modelBackend.resources | nindent 12 }} 89 | {{- end }} 90 | command: [./{{ .Values.modelBackend.commandName.migration }}] 91 | volumeMounts: 92 | - name: config 93 | mountPath: {{ .Values.modelBackend.configPath }} 94 | subPath: config.yaml 95 | - name: model-backend-init 96 | image: {{ .Values.modelBackend.image.repository }}:{{ .Values.modelBackend.image.tag }} 97 | imagePullPolicy: {{ .Values.modelBackend.image.pullPolicy }} 98 | {{- if .Values.modelBackend.resources }} 99 | resources: 100 | {{- toYaml .Values.modelBackend.resources | nindent 12 }} 101 | {{- end }} 102 | command: [./{{ .Values.modelBackend.commandName.init }}] 103 | volumeMounts: 104 | - name: config 105 | mountPath: {{ .Values.modelBackend.configPath }} 106 | subPath: config.yaml 107 | - name: wait-for-mgmt-backend 108 | image: curlimages/curl:8.00.1 109 | command: ['sh', '-c'] 110 | args: 111 | - > 112 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${MGMT_BACKEND_HOST}:${MGMT_BACKEND_PORT}/v1beta/health/mgmt)" != "200" ]]; do echo waiting for mgmt-backend; sleep 1; done 113 | env: 114 | - name: MGMT_BACKEND_HOST 115 | value: "{{ template "core.mgmtBackend" . }}" 116 | - name: MGMT_BACKEND_PORT 117 | value: "{{ template "core.mgmtBackend.publicPort" . }}" 118 | - name: wait-for-ray-server 119 | image: curlimages/curl:8.00.1 120 | command: ['sh', '-c'] 121 | args: 122 | - > 123 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${RAY_SERVER_HOST}:${RAY_SERVER_SERVE_PORT}/-/routes)" != "200" ]]; do echo waiting for ray-server; sleep 1; done 124 | env: 125 | - name: RAY_SERVER_HOST 126 | value: "{{ template "model.ray" . }}" 127 | - name: RAY_SERVER_SERVE_PORT 128 | value: "{{ template "model.ray.servePort" . }}" 129 | - name: chmod-model-repostiroy 130 | securityContext: 131 | runAsUser: 0 132 | runAsGroup: 0 133 | image: busybox 134 | command: ["sh", "-c", "chmod -R 777 /model-repository"] 135 | volumeMounts: 136 | - name: model-repository 137 | mountPath: /model-repository 138 | containers: 139 | - name: model-backend-worker 140 | image: {{ .Values.modelBackend.image.repository }}:{{ .Values.modelBackend.image.tag }} 141 | imagePullPolicy: {{ .Values.modelBackend.image.pullPolicy }} 142 | livenessProbe: 143 | initialDelaySeconds: 120 144 | tcpSocket: 145 | port: rpc 146 | {{- if .Values.modelBackend.resources }} 147 | resources: 148 | {{- toYaml .Values.modelBackend.resources | nindent 12 }} 149 | {{- end }} 150 | command: [./{{ .Values.modelBackend.commandName.worker }}] 151 | volumeMounts: 152 | - name: config 153 | mountPath: {{ .Values.modelBackend.configPath }} 154 | subPath: config.yaml 155 | - name: model-repository 156 | mountPath: /model-repository 157 | - name: ray-conda 158 | mountPath: /ray-conda 159 | {{- with .Values.modelBackend.extraVolumeMounts }} 160 | {{- toYaml . | nindent 12 }} 161 | {{- end }} 162 | - name: model-backend 163 | image: {{ .Values.modelBackend.image.repository }}:{{ .Values.modelBackend.image.tag }} 164 | imagePullPolicy: {{ .Values.modelBackend.image.pullPolicy }} 165 | readinessProbe: 166 | httpGet: 167 | path: /v1alpha/__readiness 168 | scheme: {{ ternary "https" "http" .Values.internalTLS.enabled | upper }} 169 | port: {{ ternary "https" "http" .Values.internalTLS.enabled }}-public 170 | timeoutSeconds: 15 171 | initialDelaySeconds: 15 172 | periodSeconds: 10 173 | livenessProbe: 174 | httpGet: 175 | path: /v1alpha/__liveness 176 | scheme: {{ ternary "https" "http" .Values.internalTLS.enabled | upper }} 177 | port: {{ ternary "https" "http" .Values.internalTLS.enabled }}-public 178 | timeoutSeconds: 15 179 | initialDelaySeconds: 15 180 | periodSeconds: 10 181 | {{- if .Values.modelBackend.resources }} 182 | resources: 183 | {{- toYaml .Values.modelBackend.resources | nindent 12 }} 184 | {{- end }} 185 | command: [./{{ .Values.modelBackend.commandName.main }}] 186 | ports: 187 | - name: {{ ternary "https" "http" .Values.internalTLS.enabled }}-public 188 | containerPort: {{ template "model.modelBackend.publicPort" . }} 189 | protocol: TCP 190 | volumeMounts: 191 | - name: config 192 | mountPath: {{ .Values.modelBackend.configPath }} 193 | subPath: config.yaml 194 | - name: model-repository 195 | mountPath: /model-repository 196 | - name: ray-conda 197 | mountPath: /ray-conda 198 | {{- if .Values.internalTLS.enabled }} 199 | - name: model-internal-certs 200 | mountPath: "/etc/instill-ai/model/ssl/model" 201 | {{- end }} 202 | {{- with .Values.modelBackend.extraVolumeMounts }} 203 | {{- toYaml . | nindent 12 }} 204 | {{- end }} 205 | {{- if .Values.modelBackend.extraEnv }} 206 | env: 207 | {{- toYaml .Values.modelBackend.extraEnv | nindent 12 }} 208 | {{- end }} 209 | {{- with .Values.modelBackend.sidecarContainers }} 210 | {{- toYaml . | nindent 8 }} 211 | {{- end }} 212 | volumes: 213 | - name: config 214 | configMap: 215 | name: {{ template "model.modelBackend" . }} 216 | - name: model-repository 217 | {{- if not .Values.persistence.enabled }} 218 | emptyDir: {} 219 | {{- else if $modelRepository.existingClaim }} 220 | persistentVolumeClaim: 221 | claimName: {{ $modelRepository.existingClaim }} 222 | {{- else }} 223 | persistentVolumeClaim: 224 | claimName: model-repository-data-volume 225 | {{- end }} 226 | - name: ray-conda 227 | {{- if not .Values.persistence.enabled }} 228 | emptyDir: {} 229 | {{- else if $rayConda.existingClaim }} 230 | persistentVolumeClaim: 231 | claimName: {{ $rayConda.existingClaim }} 232 | {{- else }} 233 | persistentVolumeClaim: 234 | claimName: ray-conda-data-volume 235 | {{- end }} 236 | {{- if .Values.internalTLS.enabled }} 237 | - name: model-internal-certs 238 | secret: 239 | secretName: {{ template "model.internalTLS.modelBackend.secretName" . }} 240 | {{- end }} 241 | {{- with .Values.modelBackend.extraVolumes }} 242 | {{- toYaml . | nindent 8 }} 243 | {{- end }} 244 | {{- with .Values.modelBackend.nodeSelector }} 245 | nodeSelector: 246 | {{- toYaml . | nindent 8 }} 247 | {{- end }} 248 | {{- with .Values.modelBackend.affinity }} 249 | affinity: 250 | {{- toYaml . | nindent 8 }} 251 | {{- end }} 252 | {{- with .Values.modelBackend.tolerations }} 253 | tolerations: 254 | {{- toYaml . | nindent 8 }} 255 | {{- end }} 256 | -------------------------------------------------------------------------------- /charts/model/values.yaml: -------------------------------------------------------------------------------- 1 | ## -- Provide a name in place of Model 2 | nameOverride: "" 3 | ## -- Override the deployment namespace 4 | namespaceOverride: "" 5 | ## -- Provide a name to substitute for the full names of resources 6 | fullnameOverride: "" 7 | # -- The update strategy for deployments with persistent volumes: "RollingUpdate" or "Recreate" 8 | # Set it as "Recreate" when "RWM" for volumes isn't supported 9 | updateStrategy: 10 | type: RollingUpdate 11 | rollingUpdate: 12 | maxSurge: 1 13 | maxUnavailable: 0 14 | # -- Logging level: debug, info, warning, error or fatal 15 | logLevel: info 16 | # -- Enable development mode 17 | # if edition is "k8s-ce:dev", console will be launched with CODE_ENV=development. Otherwise, CODE_ENV=production 18 | edition: k8s-ce 19 | # -- The maximum data payload to Model cluster (MB) 20 | maxDataSizeMB: 32 21 | # -- Set true to enable integration test mode 22 | # The model-backend will use dummy models 23 | # The mgmt-backend will set a mock up customer_id 24 | itMode: 25 | enabled: false 26 | # -- Use this set to assign a list of default pullSecrets 27 | imagePullSecrets: 28 | # -- The internal TLS used for Model components secure communicating. In order to enable https 29 | # in each components tls cert files need to provided in advance. 30 | internalTLS: 31 | # If internal TLS enabled 32 | enabled: false 33 | # There are three ways to provide tls 34 | # 1) "auto" will generate cert automatically 35 | # 2) "manual" need provide cert file manually in following value 36 | # 3) "secret" internal certificates from secret 37 | certSource: "auto" 38 | # The content of trust ca, only available when `certSource` is "manual" 39 | trustCa: "" 40 | # model-backend related cert configuration 41 | modelBackend: 42 | # secret name for model-backend's tls certs, only available when `certSource` is "secret" 43 | secretName: "" 44 | # Content of model-backend's TLS key file, only available when `certSource` is "manual" 45 | crt: "" 46 | # Content of model-backend's TLS key file, only available when `certSource` is "manual" 47 | key: "" 48 | # controller-model related cert configuration 49 | controllerModel: 50 | # secret name for controller-model's tls certs, only available when `certSource` is "secret" 51 | secretName: "" 52 | # Content of controller-model's TLS key file, only available when `certSource` is "manual" 53 | crt: "" 54 | # Content of controller-model's TLS key file, only available when `certSource` is "manual" 55 | key: "" 56 | # ray related cert configuration 57 | ray: 58 | # secret name for ray's tls certs, only available when `certSource` is "secret" 59 | secretName: "" 60 | # Content of ray's TLS key file, only available when `certSource` is "manual" 61 | crt: "" 62 | # Content of ray's TLS key file, only available when `certSource` is "manual" 63 | key: "" 64 | # -- The persistence is enabled by default and a default StorageClass 65 | # is needed in the k8s cluster to provision volumes dynamically. 66 | # Specify another StorageClass in the "storageClass" or set "existingClaim" 67 | # if you already have existing persistent volumes to use 68 | persistence: 69 | enabled: true 70 | # Setting it to "keep" to avoid removing PVCs during a helm delete 71 | # operation. Leaving it empty will delete PVCs after the chart deleted 72 | # (this does not apply for PVCs that are created for internal database 73 | # and redis components, i.e. they are never deleted automatically) 74 | resourcePolicy: "keep" 75 | persistentVolumeClaim: 76 | modelRepository: 77 | existingClaim: "" 78 | storageClass: "" 79 | subPath: "" 80 | accessMode: ReadWriteOnce 81 | size: 500Gi 82 | annotations: {} 83 | condaPack: 84 | existingClaim: "" 85 | storageClass: "" 86 | subPath: "" 87 | accessMode: ReadWriteOnce 88 | size: 10Gi 89 | annotations: {} 90 | rayConda: 91 | existingClaim: "" 92 | storageClass: "" 93 | subPath: "" 94 | accessMode: ReadWriteOnce 95 | size: 20Gi 96 | annotations: {} 97 | # -- The usage collector configuration 98 | usage: 99 | usageidentifieruid: 100 | enabled: true 101 | tlsenabled: true 102 | host: usage.instill.tech 103 | port: 443 104 | modelBackend: 105 | # -- The image of model-backend 106 | image: 107 | repository: instill/model-backend 108 | tag: 0.23.0-alpha 109 | pullPolicy: IfNotPresent 110 | # -- Annotation for deployment 111 | annotations: {} 112 | # -- The command names to be executed 113 | commandName: 114 | migration: model-backend-migrate 115 | init: model-backend-init 116 | worker: model-backend-worker 117 | main: model-backend 118 | initModel: model-backend-init-model 119 | # -- The path of configuration file for model-backend 120 | configPath: /model-backend/config/config.yaml 121 | # -- The database migration version 122 | dbVersion: 4 123 | # -- The configuration of Temporal Cloud 124 | temporal: 125 | hostPort: 126 | namespace: 127 | retention: 128 | ca: 129 | cert: 130 | key: 131 | serverName: 132 | workflow: 133 | maxWorkflowTimeout: 3600 # in seconds 134 | maxWorkflowRetry: 3 135 | maxActivityRetry: 1 136 | # -- Set the service account to be used, default if left empty 137 | serviceAccountName: "" 138 | # -- Mount the service account token 139 | automountServiceAccountToken: false 140 | # -- The number of replica for model-backend 141 | replicaCount: 1 142 | # -- The model initialization configuration 143 | initModel: 144 | ownertype: users 145 | ownerid: admin 146 | enabled: false 147 | path: https://raw.githubusercontent.com/instill-ai/model/main/model-hub/model_hub_cpu.json 148 | cache: 149 | enabled: false 150 | cache_dir: /model-repository/.cache/models 151 | retentionperiod: 24h 152 | github: 153 | patenabled: false 154 | pat: 155 | # -- Add extra env variables 156 | extraEnv: [] 157 | # -- Mount external volumes 158 | # For example, mount a secret containing Certificate root CA to verify database 159 | # TLS connection. 160 | extraVolumes: [] 161 | # - name: my-volume 162 | # secret: 163 | # secretName: my-secret 164 | extraVolumeMounts: [] 165 | # - name: my-volume 166 | # mountPath: /etc/secrets/my-secret 167 | # readOnly: true 168 | # -- Add extra init containers 169 | extraInitContainers: [] 170 | # extraInitContainers: 171 | # - name: ... 172 | # image: ... 173 | # -- Add extra sidecar containers 174 | sidecarContainers: {} 175 | # -- Additional deployment annotations 176 | podAnnotations: {} 177 | # -- Additional service annotations 178 | serviceAnnotations: {} 179 | resources: {} 180 | autoscaling: 181 | enabled: false 182 | minReplicas: 183 | maxReplicas: 184 | targetCPUUtilizationPercentage: 185 | targetAverageMemoryUtilization: 186 | nodeSelector: {} 187 | tolerations: [] 188 | affinity: {} 189 | podDisruptionBudget: 190 | enabled: false 191 | spec: 192 | minAvailable: 193 | maxUnavailable: 194 | controllerModel: 195 | # -- The image of controller 196 | image: 197 | repository: instill/controller-model 198 | tag: 0.4.0-alpha 199 | pullPolicy: IfNotPresent 200 | # -- The command names to be executed 201 | commandName: 202 | main: controller-model 203 | # -- The path of configuration file for mgmt-backend 204 | configPath: /controller-model/config/config.yaml 205 | # -- Set the service account to be used, default if left empty 206 | serviceAccountName: "" 207 | # -- Mount the service account token 208 | automountServiceAccountToken: false 209 | # -- The number of replica for controller 210 | replicaCount: 1 211 | # -- Add extra env variables 212 | extraEnv: [] 213 | # -- Mount external volumes 214 | # For example, mount a secret containing Certificate root CA to verify database 215 | # TLS connection. 216 | extraVolumes: [] 217 | # - name: my-volume 218 | # secret: 219 | # secretName: my-secret 220 | extraVolumeMounts: [] 221 | # - name: my-volume 222 | # mountPath: /etc/secrets/my-secret 223 | # readOnly: true 224 | # -- Add extra init containers 225 | extraInitContainers: [] 226 | # extraInitContainers: 227 | # - name: ... 228 | # image: ... 229 | # -- Add extra sidecar containers 230 | sidecarContainers: {} 231 | # -- Additional deployment annotations 232 | podAnnotations: {} 233 | # -- Additional service annotations 234 | serviceAnnotations: {} 235 | resources: {} 236 | loopinterval: 3 237 | autoscaling: 238 | enabled: false 239 | minReplicas: 240 | maxReplicas: 241 | targetCPUUtilizationPercentage: 242 | targetAverageMemoryUtilization: 243 | nodeSelector: {} 244 | tolerations: [] 245 | affinity: {} 246 | podDisruptionBudget: 247 | enabled: false 248 | spec: 249 | minAvailable: 250 | maxUnavailable: 251 | kuberay-operator: 252 | fullnameOverride: "" 253 | watchNamespace: 254 | - "instill-ai" 255 | rayService: 256 | vram: 257 | spec: 258 | autoscalerOptions: 259 | resources: 260 | limits: 261 | cpu: "500m" 262 | memory: "512Mi" 263 | requests: 264 | cpu: "500m" 265 | memory: "512Mi" 266 | image: 267 | repository: instill/ray 268 | version: "2.9.3" 269 | tag: 0.3.0-alpha 270 | headGroupSpec: 271 | resources: 272 | limits: 273 | cpu: "2" 274 | memory: "4Gi" 275 | requests: 276 | cpu: "2" 277 | memory: "4Gi" 278 | affinity: {} 279 | nodeSelector: {} 280 | workerGroupSpecs: 281 | - replicas: 1 282 | minReplicas: 1 283 | maxReplicas: 1 284 | groupName: "cpu-group" 285 | gpuWorkerGroup: 286 | enabled: false 287 | resources: 288 | limits: 289 | cpu: "2" 290 | memory: "8Gi" 291 | nvidia.com/gpu: 1 292 | requests: 293 | cpu: "2" 294 | memory: "8Gi" 295 | nvidia.com/gpu: 1 296 | resources: 297 | limits: 298 | cpu: "2" 299 | memory: "8Gi" 300 | requests: 301 | cpu: "2" 302 | memory: "8Gi" 303 | affinity: {} 304 | nodeSelector: {} 305 | # add more worker groups under here 306 | database: 307 | # -- The host of database 308 | host: 309 | # -- The port of database 310 | port: 311 | # -- The user name 312 | username: 313 | # -- The user password 314 | password: 315 | # -- The maximum number of connections in the idle connection pool per pod. 316 | # If it <=0, no idle connections are retained. 317 | maxIdleConns: 5 318 | # -- The maximum number of open connections to the database per pod. 319 | # If it <= 0, then there is no limit on the number of open connections. 320 | maxOpenConns: 10 321 | # -- The maximum amount of time in minutes a connection may be reused. 322 | # Expired connections may be closed lazily before reuse. 323 | # If it <= 0, connections are not closed due to a connection's age. 324 | maxConnLifeTime: 30m 325 | etcd: 326 | persistence: 327 | enabled: false 328 | auth: 329 | rbac: 330 | create: false 331 | autoCompactionMode: revision 332 | autoCompactionRetention: 1 333 | redis: 334 | addr: 335 | temporal: 336 | admintools: 337 | # -- Enable Temporal admin-tools 338 | enabled: true 339 | # -- The image of Temporal admin-tools 340 | image: 341 | repository: temporalio/admin-tools 342 | tag: 1.22.3 343 | pullPolicy: IfNotPresent 344 | # -- Set the service account to be used, default if left empty 345 | serviceAccountName: "" 346 | # -- Mount the service account token 347 | automountServiceAccountToken: false 348 | # -- The number of replica for temporal admin-tools 349 | replicaCount: 1 350 | # -- The pod resource 351 | resources: {} 352 | ## -- The priority class to run the pod as 353 | priorityClassName: 354 | # -- Additional deployment annotations 355 | podAnnotations: {} 356 | # -- Additional service annotations 357 | serviceAnnotations: {} 358 | nodeSelector: {} 359 | tolerations: [] 360 | affinity: {} 361 | tags: 362 | observability: false 363 | prometheusStack: false 364 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!IMPORTANT] 2 | > This repository has been deprecated and is only intended for launching Instill Core projects up to version `v0.12.0-beta`, where the Instill Model version corresponds to `v0.9.0-alpha` in this deprecated repository. Check the latest Instill Core project in the [instill-ai/instill-core](https://github.com/instill-ai/instill-core) repository. 3 | 4 | # Instill Model (Deprecated) 5 | 6 | [![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/instill-ai/model?&label=Release&color=blue&include_prereleases&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQgOEg3VjRIMjNWMTdIMjFDMjEgMTguNjYgMTkuNjYgMjAgMTggMjBDMTYuMzQgMjAgMTUgMTguNjYgMTUgMTdIOUM5IDE4LjY2IDcuNjYgMjAgNiAyMEM0LjM0IDIwIDMgMTguNjYgMyAxN0gxVjEyTDQgOFpNMTggMThDMTguNTUgMTggMTkgMTcuNTUgMTkgMTdDMTkgMTYuNDUgMTguNTUgMTYgMTggMTZDMTcuNDUgMTYgMTcgMTYuNDUgMTcgMTdDMTcgMTcuNTUgMTcuNDUgMTggMTggMThaTTQuNSA5LjVMMi41NCAxMkg3VjkuNUg0LjVaTTYgMThDNi41NSAxOCA3IDE3LjU1IDcgMTdDNyAxNi40NSA2LjU1IDE2IDYgMTZDNS40NSAxNiA1IDE2LjQ1IDUgMTdDNSAxNy41NSA1LjQ1IDE4IDYgMThaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)](https://github.com/instill-ai/deprecated-model/releases) 7 | [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/instill-ai)](https://artifacthub.io/packages/helm/instill-ai/model) 8 | [![Discord](https://img.shields.io/discord/928991293856681984?color=blue&label=Discord&logo=discord&logoColor=fff)](https://discord.gg/sevxWsqpGh) 9 | [![Integration Test](https://img.shields.io/github/actions/workflow/status/instill-ai/deprecated-model/integration-test-latest.yml?branch=main&label=Integration%20Test&logoColor=fff&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wIDEuNzVDMCAwLjc4NCAwLjc4NCAwIDEuNzUgMEg1LjI1QzYuMjE2IDAgNyAwLjc4NCA3IDEuNzVWNS4yNUM3IDUuNzE0MTMgNi44MTU2MyA2LjE1OTI1IDYuNDg3NDQgNi40ODc0NEM2LjE1OTI1IDYuODE1NjMgNS43MTQxMyA3IDUuMjUgN0g0VjExQzQgMTEuMjY1MiA0LjEwNTM2IDExLjUxOTYgNC4yOTI4OSAxMS43MDcxQzQuNDgwNDMgMTEuODk0NiA0LjczNDc4IDEyIDUgMTJIOVYxMC43NUM5IDkuNzg0IDkuNzg0IDkgMTAuNzUgOUgxNC4yNUMxNS4yMTYgOSAxNiA5Ljc4NCAxNiAxMC43NVYxNC4yNUMxNiAxNC43MTQxIDE1LjgxNTYgMTUuMTU5MiAxNS40ODc0IDE1LjQ4NzRDMTUuMTU5MiAxNS44MTU2IDE0LjcxNDEgMTYgMTQuMjUgMTZIMTAuNzVDMTAuMjg1OSAxNiA5Ljg0MDc1IDE1LjgxNTYgOS41MTI1NiAxNS40ODc0QzkuMTg0MzcgMTUuMTU5MiA5IDE0LjcxNDEgOSAxNC4yNVYxMy41SDVDNC4zMzY5NiAxMy41IDMuNzAxMDcgMTMuMjM2NiAzLjIzMjIzIDEyLjc2NzhDMi43NjMzOSAxMi4yOTg5IDIuNSAxMS42NjMgMi41IDExVjdIMS43NUMxLjI4NTg3IDcgMC44NDA3NTIgNi44MTU2MyAwLjUxMjU2MyA2LjQ4NzQ0QzAuMTg0Mzc0IDYuMTU5MjUgMCA1LjcxNDEzIDAgNS4yNUwwIDEuNzVaTTEuNzUgMS41QzEuNjgzNyAxLjUgMS42MjAxMSAxLjUyNjM0IDEuNTczMjIgMS41NzMyMkMxLjUyNjM0IDEuNjIwMTEgMS41IDEuNjgzNyAxLjUgMS43NVY1LjI1QzEuNSA1LjM4OCAxLjYxMiA1LjUgMS43NSA1LjVINS4yNUM1LjMxNjMgNS41IDUuMzc5ODkgNS40NzM2NiA1LjQyNjc4IDUuNDI2NzhDNS40NzM2NiA1LjM3OTg5IDUuNSA1LjMxNjMgNS41IDUuMjVWMS43NUM1LjUgMS42ODM3IDUuNDczNjYgMS42MjAxMSA1LjQyNjc4IDEuNTczMjJDNS4zNzk4OSAxLjUyNjM0IDUuMzE2MyAxLjUgNS4yNSAxLjVIMS43NVpNMTAuNzUgMTAuNUMxMC42ODM3IDEwLjUgMTAuNjIwMSAxMC41MjYzIDEwLjU3MzIgMTAuNTczMkMxMC41MjYzIDEwLjYyMDEgMTAuNSAxMC42ODM3IDEwLjUgMTAuNzVWMTQuMjVDMTAuNSAxNC4zODggMTAuNjEyIDE0LjUgMTAuNzUgMTQuNUgxNC4yNUMxNC4zMTYzIDE0LjUgMTQuMzc5OSAxNC40NzM3IDE0LjQyNjggMTQuNDI2OEMxNC40NzM3IDE0LjM3OTkgMTQuNSAxNC4zMTYzIDE0LjUgMTQuMjVWMTAuNzVDMTQuNSAxMC42ODM3IDE0LjQ3MzcgMTAuNjIwMSAxNC40MjY4IDEwLjU3MzJDMTQuMzc5OSAxMC41MjYzIDE0LjMxNjMgMTAuNSAxNC4yNSAxMC41SDEwLjc1WiIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==)](https://github.com/instill-ai/deprecated-model/actions/workflows/integration-test-latest.yml?branch=main&event=push) 10 | 11 | ⚗️ **Instill Model**, or simply **Model**, is an integral component of the [Instill Core](https://github.com/instill-ai/core) project. It serves as an advanced ModelOps/LLMOps platform focused on empowering users to seamlessly import, serve, fine-tune, and monitor Machine Learning (ML) models for continuous optimization. 12 | 13 | ## Prerequisites 14 | 15 | - **macOS or Linux** - Instill Model works on macOS or Linux, but does not support Windows yet. 16 | 17 | - **Docker and Docker Compose** - Instill Model uses Docker Compose (specifically, `Compose V2` and `Compose specification`) to run all services at local. Please install the latest stable [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) before using Instill Model. 18 | 19 | - `yq` > `v4.x`. Please follow the installation [guide](https://github.com/mikefarah/yq/#install). 20 | 21 | - **(Optional) NVIDIA Container Toolkit** - To enable GPU support in Instill Model, please refer to [NVIDIA Cloud Native Documentation](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) to install NVIDIA Container Toolkit. If you'd like to specifically allot GPUs to Instill Model, you can set the environment variable `NVIDIA_VISIBLE_DEVICES`. For example, `NVIDIA_VISIBLE_DEVICES=0,1` will make the `triton-server` consume GPU device id `0` and `1` specifically. By default `NVIDIA_VISIBLE_DEVICES` is set to `all` to use all available GPUs on the machine. 22 | 23 | ## Quick start 24 | 25 | > **Note** 26 | > The image of model-backend (~2GB) and Triton Inference Server (~23GB) can take a while to pull, but this should be an one-time effort at the first setup. 27 | 28 | **Use stable release version** 29 | 30 | Execute the following commands to pull pre-built images with all the dependencies to launch: 31 | 32 | 33 | ```bash 34 | $ git clone -b v0.10.0-alpha https://github.com/instill-ai/deprecated-model.git && cd deprecated-model 35 | 36 | # Launch all services 37 | $ make all 38 | ``` 39 | 40 | 41 | 🚀 That's it! Once all the services are up with health status, the UI is ready to go at http://localhost:3000. Please find the default login credentials in the [documentation](https://www.instill.tech/docs/latest/quickstart#self-hosted-instill-core). 42 | 43 | To shut down all running services: 44 | ``` 45 | $ make down 46 | ``` 47 | 48 | Explore the [documentation](https://www.instill.tech/docs/latest/core/deployment) to discover all available deployment options. 49 | 50 | ## Officially supported models 51 | 52 | We curate a list of ready-to-use models. These pre-trained models are from different sources and have been trained and deployed by our team. Want to contribute a new model? Please create an issue, we are happy to add it to the list 👐. 53 | 54 | | Model | Task | Sources | Framework | CPU | GPU | 55 | | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------- | --- | --- | 56 | | [MobileNet v2](https://github.com/onnx/models/tree/main/vision/classification/mobilenet) | Image Classification | [GitHub-DVC](https://github.com/instill-ai/model-mobilenetv2-dvc) | ONNX | ✅ | ✅ | 57 | | [Vision Transformer (ViT)](https://huggingface.co/google/vit-base-patch16-224) | Image Classification | [Hugging Face](https://huggingface.co/google/vit-base-patch16-224) | ONNX | ✅ | ❌ | 58 | | [YOLOv4](https://github.com/AlexeyAB/darknet) | Object Detection | [GitHub-DVC](https://github.com/instill-ai/model-yolov4-dvc) | ONNX | ✅ | ✅ | 59 | | [YOLOv7](https://github.com/WongKinYiu/yolov7) | Object Detection | [GitHub-DVC](https://github.com/instill-ai/model-yolov7-dvc) | ONNX | ✅ | ✅ | 60 | | [YOLOv7 W6 Pose](https://github.com/WongKinYiu/yolov7) | Keypoint Detection | [GitHub-DVC](https://github.com/instill-ai/model-yolov7-pose-dvc) | ONNX | ✅ | ✅ | 61 | | [PSNet](https://github.com/open-mmlab/mmocr/tree/main/configs/textdet/psenet) + [EasyOCR](https://github.com/JaidedAI/EasyOCR) | Optical Character Recognition (OCR) | [GitHub-DVC](https://github.com/instill-ai/model-ocr-dvc) | ONNX | ✅ | ✅ | 62 | | [Mask RCNN](https://github.com/onnx/models/blob/main/vision/object_detection_segmentation/mask-rcnn/model/MaskRCNN-10.onnx) | Instance Segmentation | [GitHub-DVC](https://github.com/instill-ai/model-instance-segmentation-dvc) | PyTorch | ✅ | ✅ | 63 | | [Lite R-ASPP based on MobileNetV3](https://github.com/open-mmlab/mmsegmentation/tree/98dfa1749bac0b5281502f4bb3832379da8feb8c/configs/mobilenet_v3) | Semantic Segmentation | [GitHub-DVC](https://github.com/instill-ai/model-semantic-segmentation-dvc) | ONNX | ✅ | ✅ | 64 | | [Stable Diffusion](https://huggingface.co/runwayml/stable-diffusion-v1-5) | Text to Image | [GitHub-DVC](https://github.com/instill-ai/model-diffusion-dvc), [Local-CPU](https://artifacts.instill.tech/vdp/sample-models/stable-diffusion-1-5-cpu.zip), [Local-GPU](https://artifacts.instill.tech/vdp/sample-models/stable-diffusion-1-5-fp16-gpu.zip) | ONNX | ✅ | ✅ | 65 | | [Stable Diffusion XL](https://huggingface.co/papers/2307.01952) | Text to Image | [GitHub-DVC](https://github.com/instill-ai/model-diffusion-xl-dvc) | PyTorch | ❌ | ✅ | 66 | | [Control Net - Canny](https://huggingface.co/lllyasviel/sd-controlnet-canny) | Image to Image | [GitHub-DVC](https://github.com/instill-ai/model-controlnet-dvc) | PyTorch | ❌ | ✅ | 67 | | [Megatron GPT2](https://catalog.ngc.nvidia.com/orgs/nvidia/models/megatron_lm_345m) | Text Generation | [GitHub-DVC](https://github.com/instill-ai/model-gpt2-megatron-dvc) | FasterTransformer | ❌ | ✅ | 68 | | [Llama2](https://huggingface.co/meta-llama/Llama-2-7b) | Text Generation | [GitHub-DVC](https://github.com/instill-ai/model-llama2-7b-dvc) | vLLM, PyTorch | ✅ | ✅ | 69 | | [Code Llama](https://github.com/facebookresearch/codellama) | Text Generation | [GitHub-DVC](https://github.com/instill-ai/model-codellama-7b-dvc) | vLLM | ❌ | ✅ | 70 | | [Llama2 Chat](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf) | Text Generation Chat | [GitHub-DVC](https://github.com/instill-ai/model-llama2-7b-chat-dvc) | vLLM | ❌ | ✅ | 71 | | [MosaicML MPT](https://huggingface.co/mosaicml/mpt-7b) | Text Generation Chat | [GitHub-DVC](https://github.com/instill-ai/model-mpt-7b-dvc) | vLLM | ❌ | ✅ | 72 | | [Mistral](https://huggingface.co/mistralai/Mistral-7B-v0.1) | Text Generation Chat | [GitHub-DVC](https://github.com/instill-ai/model-mistral-7b-dvc) | vLLM | ❌ | ✅ | 73 | | [Zephyr-7b](https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha) | Text Generation Chat | [GitHub-DVC](https://github.com/instill-ai/model-zephyr-7b-dvc) | PyTorch | ✅ | ✅ | 74 | | [Llava](https://huggingface.co/liuhaotian/llava-v1.5-13b) | Visual Question Answering | [GitHub-DVC](https://github.com/instill-ai/model-llava-7b-dvc) | PyTorch | ❌ | ✅ | 75 | 76 | Note: The `GitHub-DVC` source in the table means importing a model into Instill Model from a GitHub repository that uses [DVC](https://dvc.org) to manage large files. 77 | 78 | ## License 79 | 80 | See the [LICENSE](./LICENSE) file for licensing information. 81 | -------------------------------------------------------------------------------- /.github/workflows/integration-test-backend.yml: -------------------------------------------------------------------------------- 1 | name: Integration Test Reusable (backend) 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | component: 7 | required: true 8 | type: string 9 | target: 10 | required: true 11 | type: string 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | integration-test-latest-linux: 19 | if: inputs.target == 'latest' 20 | runs-on: ubuntu-latest 21 | timeout-minutes: 30 22 | steps: 23 | # mono occupies port 8084 which conflicts with mgmt-backend 24 | - name: Stop mono service 25 | run: | 26 | sudo kill -9 `sudo lsof -t -i:8084` 27 | sudo lsof -i -P -n | grep LISTEN 28 | 29 | - name: Checkout repo 30 | uses: actions/checkout@v4 31 | with: 32 | repository: instill-ai/model 33 | 34 | - name: Load .env file 35 | uses: cardinalby/export-env-action@v2 36 | with: 37 | envFile: .env 38 | 39 | - name: Install k6 40 | run: | 41 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 42 | 43 | - name: Pre Free Disk Space (Ubuntu) 44 | run: | 45 | df --human-readable 46 | sudo apt clean 47 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 48 | 49 | - name: Free Disk Space (Ubuntu) 50 | uses: jlumbroso/free-disk-space@main 51 | with: 52 | tool-cache: false 53 | android: true 54 | dotnet: true 55 | haskell: true 56 | large-packages: false 57 | docker-images: true 58 | swap-storage: true 59 | 60 | - name: Checkout repo (core) 61 | uses: actions/checkout@v4 62 | with: 63 | repository: instill-ai/core 64 | 65 | - name: Load .env file (core) 66 | uses: cardinalby/export-env-action@v2 67 | with: 68 | envFile: .env 69 | 70 | - name: Launch Instill Core (latest) 71 | run: | 72 | COMPOSE_PROFILES=all \ 73 | EDITION=local-ce:test \ 74 | docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull 75 | COMPOSE_PROFILES=all \ 76 | EDITION=local-ce:test \ 77 | docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f 78 | 79 | - name: Checkout repo (model) 80 | uses: actions/checkout@v4 81 | with: 82 | repository: instill-ai/model 83 | 84 | - name: Load .env file (model) 85 | uses: cardinalby/export-env-action@v2 86 | with: 87 | envFile: .env 88 | 89 | - name: Launch Instill Model (latest) 90 | run: | 91 | EDITION=local-ce:test \ 92 | ITMODE_ENABLED=true \ 93 | RAY_LATEST_TAG=latest \ 94 | COMPOSE_PROFILES=all \ 95 | docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull 96 | EDITION=local-ce:test \ 97 | RAY_LATEST_TAG=latest \ 98 | docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f 99 | 100 | - name: Run ${{ inputs.component }} integration test (latest) 101 | if: inputs.target == 'latest' 102 | run: | 103 | git clone https://github.com/instill-ai/${{ inputs.component }}.git 104 | cd ${{ inputs.component }} 105 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 106 | 107 | integration-test-latest-mac: 108 | if: false 109 | # if: inputs.target == 'latest' && github.ref == 'refs/heads/main' 110 | runs-on: [self-hosted, macOS, model] 111 | timeout-minutes: 20 112 | steps: 113 | - name: remove existing docker container 114 | run: | 115 | docker rm -f $(docker ps -a -q) 116 | 117 | - name: Set up environment 118 | run: | 119 | brew install make 120 | 121 | - name: Checkout repo 122 | uses: actions/checkout@v4 123 | with: 124 | repository: instill-ai/model 125 | 126 | - name: Load .env file 127 | uses: cardinalby/export-env-action@v2 128 | with: 129 | envFile: .env 130 | 131 | - name: Make down model 132 | run: | 133 | docker rm -f model-build-latest >/dev/null 2>&1 134 | docker rm -f model-backend-integration-test-latest >/dev/null 2>&1 135 | docker rm -f model-backend-integration-test-helm-latest >/dev/null 2>&1 136 | docker rm -f model-dind-latest >/dev/null 2>&1 137 | EDITION=NULL docker compose down -v 138 | 139 | - name: Install k6 140 | run: | 141 | brew install k6 142 | 143 | - name: Checkout repo 144 | uses: actions/checkout@v4 145 | with: 146 | repository: instill-ai/core 147 | 148 | - name: Load .env file 149 | uses: cardinalby/export-env-action@v2 150 | with: 151 | envFile: .env 152 | 153 | - name: Make down core 154 | run: | 155 | docker rm -f core-build-latest >/dev/null 2>&1 156 | docker rm -f core-backend-integration-test-latest >/dev/null 2>&1 157 | docker rm -f core-console-integration-test-latest >/dev/null 2>&1 158 | docker rm -f core-backend-integration-test-helm-latest >/dev/null 2>&1 159 | docker rm -f core-console-integration-test-helm-latest >/dev/null 2>&1 160 | docker rm -f core-dind-latest >/dev/null 2>&1 161 | EDITION=NULL docker compose -f docker-compose.yml -f docker-compose.observe.yml down -v 162 | sleep 60 163 | 164 | - name: Launch Instill Core (latest) 165 | run: | 166 | COMPOSE_PROFILES=all \ 167 | EDITION=local-ce:test \ 168 | docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull 169 | COMPOSE_PROFILES=all \ 170 | EDITION=local-ce:test \ 171 | docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f 172 | 173 | - name: Checkout repo (model) 174 | uses: actions/checkout@v4 175 | with: 176 | repository: instill-ai/model 177 | 178 | - name: Load .env file (model) 179 | uses: cardinalby/export-env-action@v2 180 | with: 181 | envFile: .env 182 | 183 | - name: Launch Instill Model (latest) 184 | run: | 185 | EDITION=local-ce:test \ 186 | ITMODE_ENABLED=true \ 187 | RAY_LATEST_TAG=latest \ 188 | COMPOSE_PROFILES=all \ 189 | docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull 190 | EDITION=local-ce:test \ 191 | RAY_LATEST_TAG=latest \ 192 | docker compose -f docker-compose.yml -f docker-compose.latest.yml rm -f 193 | 194 | - name: Run ${{ inputs.component }} integration test (latest) 195 | if: inputs.target == 'latest' 196 | run: | 197 | git clone https://github.com/instill-ai/${{ inputs.component }}.git 198 | cd ${{ inputs.component }} 199 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 200 | 201 | - name: Make down model 202 | run: | 203 | docker rm -f model-build-latest >/dev/null 2>&1 204 | docker rm -f model-backend-integration-test-latest >/dev/null 2>&1 205 | docker rm -f model-backend-integration-test-helm-latest >/dev/null 2>&1 206 | docker rm -f model-dind-latest >/dev/null 2>&1 207 | EDITION=NULL docker compose down -v 208 | 209 | - name: Checkout repo 210 | uses: actions/checkout@v4 211 | with: 212 | repository: instill-ai/core 213 | 214 | - name: Make down core 215 | run: | 216 | docker rm -f core-build-latest >/dev/null 2>&1 217 | docker rm -f core-backend-integration-test-latest >/dev/null 2>&1 218 | docker rm -f core-console-integration-test-latest >/dev/null 2>&1 219 | docker rm -f core-backend-integration-test-helm-latest >/dev/null 2>&1 220 | docker rm -f core-console-integration-test-helm-latest >/dev/null 2>&1 221 | docker rm -f core-dind-latest >/dev/null 2>&1 222 | EDITION=NULL docker compose -f docker-compose.yml -f docker-compose.observe.yml down -v 223 | sleep 60 224 | 225 | integration-test-release-linux: 226 | if: inputs.target == 'release' 227 | runs-on: ubuntu-latest 228 | timeout-minutes: 30 229 | steps: 230 | # mono occupies port 8084 which conflicts with mgmt-backend 231 | - name: Stop mono service 232 | run: | 233 | sudo kill -9 `sudo lsof -t -i:8084` 234 | sudo lsof -i -P -n | grep LISTEN 235 | 236 | - name: Checkout repo 237 | uses: actions/checkout@v4 238 | with: 239 | repository: instill-ai/model 240 | 241 | - name: Load .env file 242 | uses: cardinalby/export-env-action@v2 243 | with: 244 | envFile: .env 245 | 246 | - name: Install k6 247 | run: | 248 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 249 | 250 | - name: Pre Free Disk Space (Ubuntu) 251 | run: | 252 | df --human-readable 253 | sudo apt clean 254 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 255 | 256 | - name: Free Disk Space (Ubuntu) 257 | uses: jlumbroso/free-disk-space@main 258 | with: 259 | # this might remove tools that are actually needed, 260 | # if set to "true" but frees about 6 GB 261 | tool-cache: false 262 | 263 | # all of these default to true, but feel free to set to 264 | # "false" if necessary for your workflow 265 | android: true 266 | dotnet: true 267 | haskell: true 268 | large-packages: false 269 | docker-images: true 270 | swap-storage: true 271 | 272 | - name: Checkout repo (core) 273 | uses: actions/checkout@v4 274 | with: 275 | repository: instill-ai/core 276 | 277 | - name: Load .env file (core) 278 | uses: cardinalby/export-env-action@v2 279 | with: 280 | envFile: .env 281 | 282 | - name: Launch Instill Core (release) 283 | run: | 284 | EDITION=local-ce:test \ 285 | docker compose up -d --quiet-pull 286 | EDITION=local-ce:test \ 287 | docker compose rm -f 288 | 289 | - name: Checkout repo (model) 290 | uses: actions/checkout@v4 291 | with: 292 | repository: instill-ai/model 293 | 294 | - name: Load .env file (model) 295 | uses: cardinalby/export-env-action@v2 296 | with: 297 | envFile: .env 298 | 299 | - name: Uppercase component name 300 | id: uppercase 301 | run: | 302 | echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT 303 | 304 | - name: Launch Instill Model (release) 305 | run: | 306 | EDITION=local-ce:test \ 307 | ITMODE_ENABLED=true \ 308 | RAY_RELEASE_TAG=${RAY_SERVER_VERSION} \ 309 | docker compose up -d --quiet-pull 310 | EDITION=local-ce:test \ 311 | RAY_RELEASE_TAG=${RAY_SERVER_VERSION} \ 312 | docker compose rm -f 313 | 314 | - name: Run ${{ inputs.component }} integration test (release) 315 | env: 316 | COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }} 317 | run: | 318 | git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git 319 | cd ${{ inputs.component }} 320 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 321 | 322 | integration-test-release-mac: 323 | if: false 324 | # if: inputs.target == 'release' 325 | runs-on: [self-hosted, macOS, model] 326 | timeout-minutes: 20 327 | steps: 328 | - name: Set up environment 329 | run: | 330 | brew install make 331 | 332 | - name: Checkout repo 333 | uses: actions/checkout@v4 334 | with: 335 | repository: instill-ai/model 336 | 337 | - name: Load .env file 338 | uses: cardinalby/export-env-action@v2 339 | with: 340 | envFile: .env 341 | 342 | - name: Make down model 343 | run: | 344 | docker rm -f model-build-latest >/dev/null 2>&1 345 | docker rm -f model-backend-integration-test-latest >/dev/null 2>&1 346 | docker rm -f model-backend-integration-test-helm-latest >/dev/null 2>&1 347 | docker rm -f model-dind-latest >/dev/null 2>&1 348 | EDITION=NULL docker compose down -v 349 | 350 | - name: Install k6 351 | run: | 352 | brew install k6 353 | 354 | - name: Checkout repo 355 | uses: actions/checkout@v4 356 | with: 357 | repository: instill-ai/core 358 | 359 | - name: Load .env file 360 | uses: cardinalby/export-env-action@v2 361 | with: 362 | envFile: .env 363 | 364 | - name: Make down core 365 | run: | 366 | docker rm -f core-build-latest >/dev/null 2>&1 367 | docker rm -f core-backend-integration-test-latest >/dev/null 2>&1 368 | docker rm -f core-console-integration-test-latest >/dev/null 2>&1 369 | docker rm -f core-backend-integration-test-helm-latest >/dev/null 2>&1 370 | docker rm -f core-console-integration-test-helm-latest >/dev/null 2>&1 371 | docker rm -f core-dind-latest >/dev/null 2>&1 372 | EDITION=NULL docker compose -f docker-compose.yml -f docker-compose.observe.yml down -v 373 | sleep 60 374 | 375 | - name: Launch Instill Core (release) 376 | run: | 377 | EDITION=local-ce:test \ 378 | docker compose up -d --quiet-pull 379 | EDITION=local-ce:test \ 380 | docker compose rm -f 381 | 382 | - name: Checkout repo (model) 383 | uses: actions/checkout@v4 384 | with: 385 | repository: instill-ai/model 386 | 387 | - name: Load .env file (model) 388 | uses: cardinalby/export-env-action@v2 389 | with: 390 | envFile: .env 391 | 392 | - name: Uppercase component name 393 | id: uppercase 394 | run: | 395 | echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT 396 | 397 | - name: Launch Instill Model (release) 398 | run: | 399 | EDITION=local-ce:test \ 400 | ITMODE_ENABLED=true \ 401 | RAY_RELEASE_TAG=${RAY_SERVER_VERSION} \ 402 | docker compose up -d --quiet-pull 403 | EDITION=local-ce:test \ 404 | RAY_RELEASE_TAG=${RAY_SERVER_VERSION} \ 405 | docker compose rm -f 406 | 407 | - name: Run ${{ inputs.component }} integration test (release) 408 | env: 409 | COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }} 410 | run: | 411 | git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git 412 | cd ${{ inputs.component }} 413 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 414 | 415 | - name: Make down model 416 | run: | 417 | docker rm -f model-build-latest >/dev/null 2>&1 418 | docker rm -f model-backend-integration-test-latest >/dev/null 2>&1 419 | docker rm -f model-backend-integration-test-helm-latest >/dev/null 2>&1 420 | docker rm -f model-dind-latest >/dev/null 2>&1 421 | EDITION=NULL docker compose down -v 422 | 423 | - name: Checkout repo 424 | uses: actions/checkout@v4 425 | with: 426 | repository: instill-ai/core 427 | 428 | - name: Make down core 429 | run: | 430 | docker rm -f core-build-latest >/dev/null 2>&1 431 | docker rm -f core-backend-integration-test-latest >/dev/null 2>&1 432 | docker rm -f core-console-integration-test-latest >/dev/null 2>&1 433 | docker rm -f core-backend-integration-test-helm-latest >/dev/null 2>&1 434 | docker rm -f core-console-integration-test-helm-latest >/dev/null 2>&1 435 | docker rm -f core-dind-latest >/dev/null 2>&1 436 | EDITION=NULL docker compose -f docker-compose.yml -f docker-compose.observe.yml down -v 437 | sleep 60 438 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL:=help 2 | 3 | #============================================================================ 4 | 5 | # load environment variables 6 | include .env 7 | export 8 | 9 | # NVIDIA_GPU_AVAILABLE: 10 | # The env variable NVIDIA_GPU_AVAILABLE is set to true if NVIDIA GPU is available. Otherwise, it will be set to false. 11 | # NVIDIA_VISIBLE_DEVICES: 12 | # By default, the env variable NVIDIA_VISIBLE_DEVICES is set to all if NVIDIA GPU is available. Otherwise, it is unset. 13 | # Specify the env variable NVIDIA_VISIBLE_DEVICES to override the default value. 14 | NVIDIA_VISIBLE_DEVICES := ${NVIDIA_VISIBLE_DEVICES} 15 | ifeq ($(shell nvidia-smi 2>/dev/null 1>&2; echo $$?),0) 16 | NVIDIA_GPU_AVAILABLE := true 17 | ifndef NVIDIA_VISIBLE_DEVICES 18 | NVIDIA_VISIBLE_DEVICES := all 19 | endif 20 | RAY_LATEST_TAG := latest-gpu 21 | RAY_RELEASE_TAG := ${RAY_SERVER_VERSION}-gpu 22 | else 23 | NVIDIA_GPU_AVAILABLE := false 24 | RAY_LATEST_TAG := latest 25 | RAY_RELEASE_TAG := ${RAY_SERVER_VERSION} 26 | endif 27 | 28 | UNAME_S := $(shell uname -s) 29 | 30 | INSTILL_MODEL_VERSION := $(shell git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | cut -b 2-) 31 | 32 | CONTAINER_BUILD_NAME := model-build 33 | CONTAINER_COMPOSE_NAME := model-dind 34 | CONTAINER_COMPOSE_IMAGE_NAME := instill/model-compose 35 | CONTAINER_BACKEND_INTEGRATION_TEST_NAME := model-backend-integration-test 36 | 37 | HELM_NAMESPACE := instill-ai 38 | HELM_RELEASE_NAME := model 39 | 40 | #============================================================================ 41 | 42 | .PHONY: all 43 | all: ## Launch all services with their up-to-date release version 44 | @if [ "${BUILD}" = "true" ]; then make build-release; fi 45 | @if [ ! "$$(docker image inspect ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} --format='yes' 2> /dev/null)" = "yes" ]; then \ 46 | docker build --progress plain \ 47 | --build-arg INSTILL_CORE_VERSION=${INSTILL_CORE_VERSION} \ 48 | --build-arg ALPINE_VERSION=${ALPINE_VERSION} \ 49 | --build-arg GOLANG_VERSION=${GOLANG_VERSION} \ 50 | --build-arg K6_VERSION=${K6_VERSION} \ 51 | --build-arg CACHE_DATE="$(shell date)" \ 52 | --build-arg MODEL_BACKEND_VERSION=${MODEL_BACKEND_VERSION} \ 53 | --build-arg CONTROLLER_MODEL_VERSION=${CONTROLLER_MODEL_VERSION} \ 54 | --target release \ 55 | -t ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} .; \ 56 | fi 57 | @if ! docker compose ls -q | grep -q "instill-core"; then \ 58 | export TMP_CONFIG_DIR=$(shell mktemp -d) && \ 59 | export SYSTEM_CONFIG_PATH=$(shell eval echo ${SYSTEM_CONFIG_PATH}) && \ 60 | docker run --rm \ 61 | -v /var/run/docker.sock:/var/run/docker.sock \ 62 | -v $${TMP_CONFIG_DIR}:$${TMP_CONFIG_DIR} \ 63 | -v $${SYSTEM_CONFIG_PATH}:$${SYSTEM_CONFIG_PATH} \ 64 | --name ${CONTAINER_COMPOSE_NAME}-release \ 65 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 66 | cp /instill-ai/core/.env $${TMP_CONFIG_DIR}/.env && \ 67 | cp /instill-ai/core/docker-compose.build.yml $${TMP_CONFIG_DIR}/docker-compose.build.yml && \ 68 | cp -r /instill-ai/core/configs/influxdb $${TMP_CONFIG_DIR} && \ 69 | /bin/sh -c 'cd /instill-ai/core && make all BUILD=${BUILD} PROJECT=core EDITION=$${EDITION:=local-ce} INSTILL_CORE_HOST=$${INSTILL_CORE_HOST} SYSTEM_CONFIG_PATH=$${SYSTEM_CONFIG_PATH} BUILD_CONFIG_DIR_PATH=$${TMP_CONFIG_DIR} OBSERVE_CONFIG_DIR_PATH=$${TMP_CONFIG_DIR}' && \ 70 | rm -rf $${TMP_CONFIG_DIR}/* \ 71 | " && rm -rf $${TMP_CONFIG_DIR}; \ 72 | fi 73 | ifeq (${NVIDIA_GPU_AVAILABLE}, true) 74 | @docker inspect --type=image instill/ray:${RAY_SERVER_VERSION} >/dev/null 2>&1 || printf "\033[1;33mINFO:\033[0m This may take a while due to the enormous size of the Ray server image, but the image pulling process should be just a one-time effort.\n" && sleep 5 75 | @cat docker-compose.nvidia.yml | yq '.services.ray_server.deploy.resources.reservations.devices[0].device_ids |= (strenv(NVIDIA_VISIBLE_DEVICES) | split(",")) | ..style="double"' | \ 76 | EDITION=$${EDITION:=local-ce} RAY_RELEASE_TAG=${RAY_RELEASE_TAG} docker compose -f docker-compose.yml -f - up -d --quiet-pull 77 | else 78 | @EDITION=$${EDITION:=local-ce} RAY_RELEASE_TAG=${RAY_RELEASE_TAG} docker compose -f docker-compose.yml up -d --quiet-pull 79 | endif 80 | 81 | .PHONY: latest 82 | latest: ## Lunch all dependent services with their latest codebase 83 | @make build-latest PROFILE=${PROFILE} 84 | @if ! docker compose ls -q | grep -q "instill-core"; then \ 85 | export TMP_CONFIG_DIR=$(shell mktemp -d) && \ 86 | export SYSTEM_CONFIG_PATH=$(shell eval echo ${SYSTEM_CONFIG_PATH}) && \ 87 | docker run --rm \ 88 | -v /var/run/docker.sock:/var/run/docker.sock \ 89 | -v $${TMP_CONFIG_DIR}:$${TMP_CONFIG_DIR} \ 90 | -v $${SYSTEM_CONFIG_PATH}:$${SYSTEM_CONFIG_PATH} \ 91 | --name ${CONTAINER_COMPOSE_NAME}-latest \ 92 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 93 | cp /instill-ai/core/.env $${TMP_CONFIG_DIR}/.env && \ 94 | cp /instill-ai/core/docker-compose.build.yml $${TMP_CONFIG_DIR}/docker-compose.build.yml && \ 95 | cp -r /instill-ai/core/configs/influxdb $${TMP_CONFIG_DIR} && \ 96 | /bin/sh -c 'cd /instill-ai/core && make latest PROFILE=${PROFILE} PROJECT=core EDITION=$${EDITION:=local-ce:latest} INSTILL_CORE_HOST=$${INSTILL_CORE_HOST} SYSTEM_CONFIG_PATH=$${SYSTEM_CONFIG_PATH} BUILD_CONFIG_DIR_PATH=$${TMP_CONFIG_DIR} OBSERVE_CONFIG_DIR_PATH=$${TMP_CONFIG_DIR}' && \ 97 | rm -rf $${TMP_CONFIG_DIR}/* \ 98 | " && rm -rf $${TMP_CONFIG_DIR}; \ 99 | fi 100 | ifeq (${NVIDIA_GPU_AVAILABLE}, true) 101 | @docker inspect --type=image instill/ray:${RAY_SERVER_VERSION} >/dev/null 2>&1 || printf "\033[1;33mINFO:\033[0m This may take a while due to the enormous size of the Ray server image, but the image pulling process should be just a one-time effort.\n" && sleep 5 102 | @cat docker-compose.nvidia.yml | yq '.services.ray_server.deploy.resources.reservations.devices[0].device_ids |= (strenv(NVIDIA_VISIBLE_DEVICES) | split(",")) | ..style="double"' | \ 103 | COMPOSE_PROFILES=${PROFILE} EDITION=$${EDITION:=local-ce:latest} RAY_LATEST_TAG=${RAY_LATEST_TAG} docker compose -f docker-compose.yml -f docker-compose.latest.yml -f - up -d --quiet-pull 104 | else 105 | @COMPOSE_PROFILES=${PROFILE} EDITION=$${EDITION:=local-ce:latest} RAY_LATEST_TAG=${RAY_LATEST_TAG} docker compose -f docker-compose.yml -f docker-compose.latest.yml up -d --quiet-pull 106 | endif 107 | 108 | .PHONY: logs 109 | logs: ## Tail all logs with -n 10 110 | @EDITION= docker compose logs --follow --tail=10 111 | 112 | .PHONY: pull 113 | pull: ## Pull all service images 114 | @docker inspect --type=image instill/ray:${RAY_SERVER_VERSION} >/dev/null 2>&1 || printf "\033[1;33mINFO:\033[0m This may take a while due to the enormous size of the Ray server image, but the image pulling process should be just a one-time effort.\n" && sleep 5 115 | @EDITION= docker compose pull 116 | 117 | .PHONY: stop 118 | stop: ## Stop all components 119 | @EDITION= docker compose stop 120 | @docker run --rm \ 121 | -v /var/run/docker.sock:/var/run/docker.sock \ 122 | --name ${CONTAINER_COMPOSE_NAME}-latest \ 123 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 124 | /bin/sh -c 'cd /instill-ai/core && make stop' \ 125 | " 126 | 127 | .PHONY: start 128 | start: ## Start all stopped components 129 | @docker run --rm \ 130 | -v /var/run/docker.sock:/var/run/docker.sock \ 131 | --name ${CONTAINER_COMPOSE_NAME}-latest \ 132 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 133 | /bin/sh -c 'cd /instill-ai/core && make start' \ 134 | " 135 | @EDITION= docker compose start 136 | 137 | .PHONY: down 138 | down: ## Stop all services and remove all service containers and volumes 139 | @docker rm -f ${CONTAINER_BUILD_NAME}-latest >/dev/null 2>&1 140 | @docker rm -f ${CONTAINER_BUILD_NAME}-release >/dev/null 2>&1 141 | @docker rm -f ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-latest >/dev/null 2>&1 142 | @docker rm -f ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-release >/dev/null 2>&1 143 | @docker rm -f ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-latest >/dev/null 2>&1 144 | @docker rm -f ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-release >/dev/null 2>&1 145 | @docker rm -f ${CONTAINER_COMPOSE_NAME}-latest >/dev/null 2>&1 146 | @docker rm -f ${CONTAINER_COMPOSE_NAME}-release >/dev/null 2>&1 147 | @EDITION= docker compose down -v 148 | @if [ "$$(docker image inspect ${CONTAINER_COMPOSE_IMAGE_NAME}:latest --format='yes' 2> /dev/null)" = "yes" ]; then \ 149 | docker run --rm \ 150 | -v /var/run/docker.sock:/var/run/docker.sock \ 151 | --name ${CONTAINER_COMPOSE_NAME} \ 152 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 153 | if [ \"$$( docker container inspect -f '{{.State.Status}}' core-dind 2>/dev/null)\" != \"running\" ]; then \ 154 | /bin/sh -c 'cd /instill-ai/core && make down'; \ 155 | fi \ 156 | "; \ 157 | elif [ "$$(docker image inspect ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} --format='yes' 2> /dev/null)" = "yes" ]; then \ 158 | docker run --rm \ 159 | -v /var/run/docker.sock:/var/run/docker.sock \ 160 | --name ${CONTAINER_COMPOSE_NAME} \ 161 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 162 | if [ \"$$( docker container inspect -f '{{.State.Status}}' core-dind 2>/dev/null)\" != \"running\" ]; then \ 163 | /bin/sh -c 'cd /instill-ai/core && make down'; \ 164 | fi \ 165 | "; \ 166 | fi 167 | 168 | .PHONY: images 169 | images: ## List all container images 170 | @docker compose images 171 | 172 | .PHONY: ps 173 | ps: ## List all service containers 174 | @EDITION= docker compose ps 175 | 176 | .PHONY: top 177 | top: ## Display all running service processes 178 | @EDITION= docker compose top 179 | 180 | .PHONY: build-latest 181 | build-latest: ## Build latest images for all model components 182 | @docker build --progress plain \ 183 | --build-arg ALPINE_VERSION=${ALPINE_VERSION} \ 184 | --build-arg GOLANG_VERSION=${GOLANG_VERSION} \ 185 | --build-arg K6_VERSION=${K6_VERSION} \ 186 | --build-arg CACHE_DATE="$(shell date)" \ 187 | --target latest \ 188 | -t ${CONTAINER_COMPOSE_IMAGE_NAME}:latest . 189 | @docker run --rm \ 190 | -v /var/run/docker.sock:/var/run/docker.sock \ 191 | -v ${BUILD_CONFIG_DIR_PATH}/.env:/instill-ai/model/.env \ 192 | -v ${BUILD_CONFIG_DIR_PATH}/docker-compose.build.yml:/instill-ai/model/docker-compose.build.yml \ 193 | --name ${CONTAINER_BUILD_NAME}-latest \ 194 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 195 | MODEL_BACKEND_VERSION=latest \ 196 | CONTROLLER_MODEL_VERSION=latest \ 197 | COMPOSE_PROFILES=${PROFILE} docker compose -f docker-compose.build.yml build --progress plain \ 198 | " 199 | 200 | .PHONY: build-release 201 | build-release: ## Build release images for all model components 202 | @docker build --progress plain \ 203 | --build-arg INSTILL_CORE_VERSION=${INSTILL_CORE_VERSION} \ 204 | --build-arg ALPINE_VERSION=${ALPINE_VERSION} \ 205 | --build-arg GOLANG_VERSION=${GOLANG_VERSION} \ 206 | --build-arg K6_VERSION=${K6_VERSION} \ 207 | --build-arg CACHE_DATE="$(shell date)" \ 208 | --build-arg MODEL_BACKEND_VERSION=${MODEL_BACKEND_VERSION} \ 209 | --build-arg CONTROLLER_MODEL_VERSION=${CONTROLLER_MODEL_VERSION} \ 210 | --target release \ 211 | -t ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} . 212 | @docker run --rm \ 213 | -v /var/run/docker.sock:/var/run/docker.sock \ 214 | -v ${BUILD_CONFIG_DIR_PATH}/.env:/instill-ai/model/.env \ 215 | -v ${BUILD_CONFIG_DIR_PATH}/docker-compose.build.yml:/instill-ai/model/docker-compose.build.yml \ 216 | --name ${CONTAINER_BUILD_NAME}-release \ 217 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 218 | MODEL_BACKEND_VERSION=${MODEL_BACKEND_VERSION} \ 219 | CONTROLLER_MODEL_VERSION=${CONTROLLER_MODEL_VERSION} \ 220 | COMPOSE_PROFILES=${PROFILE} docker compose -f docker-compose.build.yml build --progress plain \ 221 | " 222 | 223 | .PHONY: integration-test-latest 224 | integration-test-latest: ## Run integration test on the latest model 225 | @make latest EDITION=local-ce:test ITMODE_ENABLED=true 226 | @docker run --rm \ 227 | --network instill-network \ 228 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-latest \ 229 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 230 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' && \ 231 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' \ 232 | " 233 | @make down 234 | 235 | .PHONY: integration-test-release 236 | integration-test-release: ## Run integration test on the release model 237 | @make all BUILD=true EDITION=local-ce:test ITMODE_ENABLED=true 238 | @docker run --rm \ 239 | --network instill-network \ 240 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-release \ 241 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 242 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' && \ 243 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=${API_GATEWAY_HOST}:${API_GATEWAY_PORT}' \ 244 | " 245 | @make down 246 | 247 | .PHONY: helm-integration-test-latest 248 | helm-integration-test-latest: ## Run integration test on the Helm latest for model 249 | @make build-latest 250 | @export TMP_CONFIG_DIR=$(shell mktemp -d) && docker run --rm \ 251 | -v ${HOME}/.kube/config:/root/.kube/config \ 252 | -v /var/run/docker.sock:/var/run/docker.sock \ 253 | -v $${TMP_CONFIG_DIR}:$${TMP_CONFIG_DIR} \ 254 | ${DOCKER_HELM_IT_EXTRA_PARAMS} \ 255 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-latest \ 256 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 257 | cp /instill-ai/core/.env $${TMP_CONFIG_DIR}/.env && \ 258 | cp /instill-ai/core/docker-compose.build.yml $${TMP_CONFIG_DIR}/docker-compose.build.yml && \ 259 | /bin/sh -c 'cd /instill-ai/core && make build-latest BUILD_CONFIG_DIR_PATH=$${TMP_CONFIG_DIR}' && \ 260 | /bin/sh -c 'cd /instill-ai/core && \ 261 | helm install core charts/core \ 262 | --namespace ${HELM_NAMESPACE} --create-namespace \ 263 | --set edition=k8s-ce:test \ 264 | --set apiGateway.image.tag=latest \ 265 | --set mgmtBackend.image.tag=latest \ 266 | --set console.image.tag=latest \ 267 | --set tags.observability=false \ 268 | --set tags.prometheusStack=false' \ 269 | /bin/sh -c 'rm -rf $${TMP_CONFIG_DIR}/*' \ 270 | " && rm -rf $${TMP_CONFIG_DIR} 271 | @kubectl rollout status deployment core-api-gateway --namespace ${HELM_NAMESPACE} --timeout=360s 272 | @export API_GATEWAY_POD_NAME=$$(kubectl get pods --namespace ${HELM_NAMESPACE} -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o jsonpath="{.items[0].metadata.name}") && \ 273 | kubectl --namespace ${HELM_NAMESPACE} port-forward $${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 274 | @while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 275 | @helm install ${HELM_RELEASE_NAME} charts/model --namespace ${HELM_NAMESPACE} --create-namespace \ 276 | --set itMode.enabled=true \ 277 | --set edition=k8s-ce:test \ 278 | --set modelBackend.image.tag=latest \ 279 | --set controllerModel.image.tag=latest \ 280 | --set rayService.image.tag=${RAY_LATEST_TAG} \ 281 | --set tags.observability=false 282 | @kubectl rollout status deployment model-model-backend --namespace instill-ai --timeout=360s 283 | @kubectl rollout status deployment model-controller-model --namespace instill-ai --timeout=360s 284 | @sleep 10 285 | ifeq ($(UNAME_S),Darwin) 286 | @docker run --rm --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-latest ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 287 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}' && \ 288 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}' \ 289 | " 290 | else ifeq ($(UNAME_S),Linux) 291 | @docker run --rm --network host --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-latest ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 292 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}' && \ 293 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}' \ 294 | " 295 | endif 296 | @helm uninstall ${HELM_RELEASE_NAME} --namespace ${HELM_NAMESPACE} 297 | @docker run --rm \ 298 | -v ${HOME}/.kube/config:/root/.kube/config \ 299 | ${DOCKER_HELM_IT_EXTRA_PARAMS} \ 300 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-latest \ 301 | ${CONTAINER_COMPOSE_IMAGE_NAME}:latest /bin/sh -c " \ 302 | /bin/sh -c 'cd /instill-ai/core && helm uninstall core --namespace ${HELM_NAMESPACE}' \ 303 | " 304 | @kubectl delete namespace ${HELM_NAMESPACE} 305 | @pkill -f "port-forward" 306 | @make down 307 | 308 | .PHONY: helm-integration-test-release 309 | helm-integration-test-release: ## Run integration test on the Helm release for model) 310 | @make build-release 311 | @docker run --rm \ 312 | -v ${HOME}/.kube/config:/root/.kube/config \ 313 | ${DOCKER_HELM_IT_EXTRA_PARAMS} \ 314 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-release \ 315 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 316 | /bin/sh -c 'cd /instill-ai/core && \ 317 | export $(grep -v '^#' .env | xargs) && \ 318 | helm install core charts/core \ 319 | --namespace ${HELM_NAMESPACE} --create-namespace \ 320 | --set edition=k8s-ce:test \ 321 | --set apiGateway.image.tag=${API_GATEWAY_VERSION} \ 322 | --set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \ 323 | --set tags.observability=false \ 324 | --set tags.prometheusStack=false' \ 325 | " 326 | @kubectl rollout status deployment core-api-gateway --namespace ${HELM_NAMESPACE} --timeout=360s 327 | @export API_GATEWAY_POD_NAME=$$(kubectl get pods --namespace ${HELM_NAMESPACE} -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o jsonpath="{.items[0].metadata.name}") && \ 328 | kubectl --namespace ${HELM_NAMESPACE} port-forward $${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 329 | @while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 330 | @helm install ${HELM_RELEASE_NAME} charts/model --namespace ${HELM_NAMESPACE} --create-namespace \ 331 | --set itMode.enabled=true \ 332 | --set edition=k8s-ce:test \ 333 | --set modelBackend.image.tag=${MODEL_BACKEND_VERSION} \ 334 | --set controllerModel.image.tag=${CONTROLLER_MODEL_VERSION} \ 335 | --set rayService.image.tag=${RAY_RELEASE_TAG} \ 336 | --set tags.observability=false 337 | @kubectl rollout status deployment model-model-backend --namespace instill-ai --timeout=360s 338 | @kubectl rollout status deployment model-controller-model --namespace instill-ai --timeout=360s 339 | @sleep 10 340 | ifeq ($(UNAME_S),Darwin) 341 | @docker run --rm --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-release ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 342 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}' && \ 343 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}' \ 344 | " 345 | else ifeq ($(UNAME_S),Linux) 346 | @docker run --rm --network host --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-helm-release ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 347 | /bin/sh -c 'cd model-backend && make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}' && \ 348 | /bin/sh -c 'cd controller-model && make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}' \ 349 | " 350 | endif 351 | @helm uninstall ${HELM_RELEASE_NAME} --namespace ${HELM_NAMESPACE} 352 | @docker run --rm \ 353 | -v ${HOME}/.kube/config:/root/.kube/config \ 354 | ${DOCKER_HELM_IT_EXTRA_PARAMS} \ 355 | --name ${CONTAINER_BACKEND_INTEGRATION_TEST_NAME}-release \ 356 | ${CONTAINER_COMPOSE_IMAGE_NAME}:${INSTILL_MODEL_VERSION} /bin/sh -c " \ 357 | /bin/sh -c 'cd /instill-ai/core && helm uninstall core --namespace ${HELM_NAMESPACE}' \ 358 | " 359 | @kubectl delete namespace ${HELM_NAMESPACE} 360 | @pkill -f "port-forward" 361 | @make down 362 | 363 | .PHONY: help 364 | help: ## Show this help 365 | @echo "\nMake Application with Docker Compose" 366 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m (default: help)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-32s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) 367 | -------------------------------------------------------------------------------- /.github/workflows/helm-integration-test-backend.yml: -------------------------------------------------------------------------------- 1 | name: Helm Integration Test Reusable (backend) 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | component: 7 | required: true 8 | type: string 9 | target: 10 | required: true 11 | type: string 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.ref || github.run_id }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | helm-integration-test-latest-linux: 19 | if: inputs.target == 'latest' 20 | runs-on: ubuntu-latest 21 | timeout-minutes: 90 22 | steps: 23 | # mono occupies port 8084 which conflicts with mgmt-backend 24 | - name: Stop mono service 25 | run: | 26 | sudo kill -9 `sudo lsof -t -i:8084` 27 | sudo lsof -i -P -n | grep LISTEN 28 | 29 | - name: Pre Free Disk Space (Ubuntu) 30 | run: | 31 | df --human-readable 32 | sudo apt clean 33 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 34 | 35 | - name: Free Disk Space (Ubuntu) 36 | uses: jlumbroso/free-disk-space@main 37 | with: 38 | tool-cache: false 39 | android: true 40 | dotnet: true 41 | haskell: true 42 | large-packages: false 43 | docker-images: true 44 | swap-storage: true 45 | 46 | - name: Start Minikube 47 | run: minikube start --cpus 4 --memory 12G 48 | 49 | - name: Checkout repo (core) 50 | uses: actions/checkout@v4 51 | with: 52 | repository: instill-ai/core 53 | 54 | - name: Load .env file (core) 55 | uses: cardinalby/export-env-action@v2 56 | with: 57 | envFile: .env 58 | 59 | - name: Launch Helm Instill Core (latest) 60 | run: | 61 | helm install core charts/core --namespace instill-ai --create-namespace \ 62 | --set edition=k8s-ce:test \ 63 | --set apiGateway.image.tag=latest \ 64 | --set mgmtBackend.image.tag=latest \ 65 | --set console.image.tag=latest \ 66 | --set tags.observability=false \ 67 | --set tags.prometheusStack=false 68 | 69 | - name: Wait for core pods up 70 | run: | 71 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 72 | echo "$(kubectl get pods --namespace instill-ai)" 73 | sleep 10 74 | done 75 | 76 | - name: Port-forward of api-gateway 77 | run: | 78 | API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name') 79 | kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 80 | while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 81 | 82 | - name: Checkout repo (model) 83 | uses: actions/checkout@v4 84 | with: 85 | repository: instill-ai/model 86 | 87 | - name: Load .env file (model) 88 | uses: cardinalby/export-env-action@v2 89 | with: 90 | envFile: .env 91 | 92 | - name: Install k6 93 | run: | 94 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 95 | 96 | - name: Launch Helm Instill Model (latest) 97 | run: | 98 | helm install model charts/model --namespace instill-ai \ 99 | --set itMode.enabled=true \ 100 | --set edition=k8s-ce:test \ 101 | --set modelBackend.image.tag=latest \ 102 | --set controllerModel.image.tag=latest \ 103 | --set rayService.image.tag=latest \ 104 | --set rayService.headGroupSpec.resources.limits.cpu=0 \ 105 | --set rayService.headGroupSpec.resources.limits.memory=2Gi \ 106 | --set rayService.headGroupSpec.resources.requests.cpu=0 \ 107 | --set rayService.headGroupSpec.resources.requests.memory=2Gi \ 108 | --set rayService.workerGroupSpecs[0].replicas=1 \ 109 | --set rayService.workerGroupSpecs[0].minReplicas=1 \ 110 | --set rayService.workerGroupSpecs[0].maxReplicas=1 \ 111 | --set rayService.workerGroupSpecs[0].groupName=test-group \ 112 | --set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \ 113 | --set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \ 114 | --set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \ 115 | --set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \ 116 | --set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \ 117 | --set tags.observability=false 118 | 119 | - name: Wait for model deployment 120 | run: | 121 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=controller-model,app.kubernetes.io/instance=model" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 122 | echo "$(kubectl get pods --namespace instill-ai)" 123 | sleep 10 124 | done 125 | 126 | - name: Run ${{ inputs.component }} integration test (latest) 127 | if: inputs.target == 'latest' 128 | run: | 129 | git clone https://github.com/instill-ai/${{ inputs.component }}.git 130 | cd ${{ inputs.component }} 131 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 132 | 133 | helm-integration-test-latest-mac: 134 | if: false 135 | # if: inputs.target == 'latest' && github.ref == 'refs/heads/main' 136 | runs-on: [self-hosted, macOS, model] 137 | timeout-minutes: 30 138 | steps: 139 | - name: Set up environment 140 | run: | 141 | brew install make 142 | 143 | - name: Checkout repo (model) 144 | uses: actions/checkout@v4 145 | with: 146 | repository: instill-ai/model 147 | 148 | - name: Load .env file 149 | uses: cardinalby/export-env-action@v2 150 | with: 151 | envFile: .env 152 | 153 | - name: Check if Model Helm release exists 154 | id: check-model-helm-release 155 | run: | 156 | if helm ls -n instill-ai | grep -q 'model'; then 157 | echo "Helm release 'model' found." 158 | echo "release_exists=true" >> $GITHUB_OUTPUT 159 | else 160 | echo "Helm release 'model' not found." 161 | fi 162 | 163 | - name: Uninstall Model Helm Release 164 | if: steps.check-model-helm-release.outputs.release_exists == 'true' 165 | run: | 166 | helm uninstall model --namespace instill-ai 167 | 168 | - name: Install k6 169 | run: | 170 | brew install k6 171 | 172 | - name: Checkout repo 173 | uses: actions/checkout@v4 174 | with: 175 | repository: instill-ai/core 176 | 177 | - name: Load .env file 178 | uses: cardinalby/export-env-action@v2 179 | with: 180 | envFile: .env 181 | 182 | - name: Check if Core Helm release exists 183 | id: check-core-helm-release 184 | run: | 185 | if helm ls -n instill-ai | grep -q 'core'; then 186 | echo "Helm release 'core' found." 187 | echo "release_exists=true" >> $GITHUB_OUTPUT 188 | else 189 | echo "Helm release 'core' not found." 190 | fi 191 | 192 | - name: Uninstall Core Helm Release 193 | if: steps.check-core-helm-release.outputs.release_exists == 'true' 194 | run: | 195 | helm uninstall core --namespace instill-ai 196 | kubectl delete namespace instill-ai 197 | 198 | - name: Launch Helm Instill Core (latest) 199 | run: | 200 | helm install core charts/core --namespace instill-ai --create-namespace \ 201 | --set edition=k8s-ce:test \ 202 | --set apiGateway.image.tag=latest \ 203 | --set mgmtBackend.image.tag=latest \ 204 | --set console.image.tag=latest \ 205 | --set tags.observability=false 206 | 207 | - name: Wait for core pods up 208 | run: | 209 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 210 | echo "$(kubectl get pods --namespace instill-ai)" 211 | sleep 10 212 | done 213 | 214 | - name: Port-forward of api-gateway 215 | run: | 216 | API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name') 217 | kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 218 | while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 219 | 220 | - name: Checkout repo (model) 221 | uses: actions/checkout@v4 222 | with: 223 | repository: instill-ai/model 224 | 225 | - name: Load .env file (model) 226 | uses: cardinalby/export-env-action@v2 227 | with: 228 | envFile: .env 229 | 230 | - name: Launch Helm Instill Model (latest) 231 | run: | 232 | helm install model charts/model --namespace instill-ai --create-namespace \ 233 | --set itMode.enabled=true \ 234 | --set edition=k8s-ce:test \ 235 | --set modelBackend.image.tag=latest \ 236 | --set controllerModel.image.tag=latest \ 237 | --set rayService.image.tag=latest \ 238 | --set rayService.headGroupSpec.resources.limits.cpu=0 \ 239 | --set rayService.headGroupSpec.resources.limits.memory=2Gi \ 240 | --set rayService.headGroupSpec.resources.requests.cpu=0 \ 241 | --set rayService.headGroupSpec.resources.requests.memory=2Gi \ 242 | --set rayService.workerGroupSpecs[0].replicas=1 \ 243 | --set rayService.workerGroupSpecs[0].minReplicas=1 \ 244 | --set rayService.workerGroupSpecs[0].maxReplicas=1 \ 245 | --set rayService.workerGroupSpecs[0].groupName=test-group \ 246 | --set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \ 247 | --set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \ 248 | --set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \ 249 | --set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \ 250 | --set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \ 251 | --set tags.observability=false 252 | 253 | - name: Wait for model deployment 254 | run: | 255 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=controller-model,app.kubernetes.io/instance=model" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 256 | echo "$(kubectl get pods --namespace instill-ai)" 257 | sleep 10 258 | done 259 | 260 | - name: Run ${{ inputs.component }} integration test (latest) 261 | if: inputs.target == 'latest' 262 | run: | 263 | git clone https://github.com/instill-ai/${{ inputs.component }}.git 264 | cd ${{ inputs.component }} 265 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 266 | 267 | - name: Uninstall Core and Model Helm Release 268 | run: | 269 | helm uninstall model --namespace instill-ai 270 | helm uninstall core --namespace instill-ai 271 | kubectl delete namespace instill-ai 272 | 273 | helm-integration-test-release-linux: 274 | if: inputs.target == 'release' 275 | runs-on: ubuntu-latest 276 | timeout-minutes: 30 277 | steps: 278 | # mono occupies port 8084 which conflicts with mgmt-backend 279 | - name: Stop mono service 280 | run: | 281 | sudo kill -9 `sudo lsof -t -i:8084` 282 | sudo lsof -i -P -n | grep LISTEN 283 | 284 | - name: Pre Free Disk Space (Ubuntu) 285 | run: | 286 | df --human-readable 287 | sudo apt clean 288 | rm --recursive --force "$AGENT_TOOLSDIRECTORY" 289 | 290 | - name: Free Disk Space (Ubuntu) 291 | uses: jlumbroso/free-disk-space@main 292 | with: 293 | tool-cache: false 294 | android: true 295 | dotnet: true 296 | haskell: true 297 | large-packages: false 298 | docker-images: true 299 | swap-storage: true 300 | 301 | - name: Start Minikube 302 | run: minikube start --cpus 4 --memory 12G 303 | 304 | - name: Checkout repo (core) 305 | uses: actions/checkout@v4 306 | with: 307 | repository: instill-ai/core 308 | 309 | - name: Load .env file (core) 310 | uses: cardinalby/export-env-action@v2 311 | with: 312 | envFile: .env 313 | 314 | - name: Launch Helm Instill Core (release) 315 | run: | 316 | helm install core charts/core --namespace instill-ai --create-namespace \ 317 | --set edition=k8s-ce:test \ 318 | --set apiGateway.image.tag=${API_GATEWAY_VERSION} \ 319 | --set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \ 320 | --set console.image.tag=${CONSOLE_VERSION} \ 321 | --set tags.observability=false 322 | 323 | - name: Wait for core pods up 324 | run: | 325 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 326 | echo "$(kubectl get pods --namespace instill-ai)" 327 | sleep 10 328 | done 329 | 330 | - name: Port-forward of api-gateway 331 | run: | 332 | API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name') 333 | kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 334 | while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 335 | 336 | - name: Checkout repo (model) 337 | uses: actions/checkout@v4 338 | with: 339 | repository: instill-ai/model 340 | 341 | - name: Load .env file (model) 342 | uses: cardinalby/export-env-action@v2 343 | with: 344 | envFile: .env 345 | 346 | - name: Install k6 347 | run: | 348 | curl https://github.com/grafana/k6/releases/download/v${{ env.K6_VERSION }}/k6-v${{ env.K6_VERSION }}-linux-amd64.tar.gz -L | tar xvz --strip-components 1 && sudo cp k6 /usr/bin 349 | 350 | - name: Uppercase component name 351 | id: uppercase 352 | run: | 353 | echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT 354 | 355 | - name: Launch Instill Model (release) 356 | run: | 357 | helm install model charts/model --namespace instill-ai --create-namespace \ 358 | --set itMode.enabled=true \ 359 | --set edition=k8s-ce:test \ 360 | --set modelBackend.image.tag=${MODEL_BACKEND_VERSION} \ 361 | --set controllerModel.image.tag=${CONTROLLER_MODEL_VERSION} \ 362 | --set rayService.image.tag=${RAY_SERVER_VERSION} \ 363 | --set rayService.headGroupSpec.resources.limits.cpu=0 \ 364 | --set rayService.headGroupSpec.resources.limits.memory=2Gi \ 365 | --set rayService.headGroupSpec.resources.requests.cpu=0 \ 366 | --set rayService.headGroupSpec.resources.requests.memory=2Gi \ 367 | --set rayService.workerGroupSpecs[0].replicas=1 \ 368 | --set rayService.workerGroupSpecs[0].minReplicas=1 \ 369 | --set rayService.workerGroupSpecs[0].maxReplicas=1 \ 370 | --set rayService.workerGroupSpecs[0].groupName=test-group \ 371 | --set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \ 372 | --set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \ 373 | --set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \ 374 | --set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \ 375 | --set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \ 376 | --set tags.observability=false 377 | 378 | - name: Wait for model deployment 379 | run: | 380 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=controller-model,app.kubernetes.io/instance=model" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 381 | echo "$(kubectl get pods --namespace instill-ai)" 382 | sleep 10 383 | done 384 | 385 | - name: Run ${{ inputs.component }} integration test (release) 386 | env: 387 | COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }} 388 | run: | 389 | git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git 390 | cd ${{ inputs.component }} 391 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 392 | 393 | helm-integration-test-release-mac: 394 | if: false 395 | # if: inputs.target == 'release' 396 | runs-on: [self-hosted, macOS, model] 397 | timeout-minutes: 30 398 | steps: 399 | - name: Set up environment 400 | run: | 401 | brew install make 402 | 403 | - name: Checkout repo (model) 404 | uses: actions/checkout@v4 405 | with: 406 | repository: instill-ai/model 407 | 408 | - name: Load .env file 409 | uses: cardinalby/export-env-action@v2 410 | with: 411 | envFile: .env 412 | 413 | - name: Check if Model Helm release exists 414 | id: check-model-helm-release 415 | run: | 416 | if helm ls -n instill-ai | grep -q 'model'; then 417 | echo "Helm release 'model' found." 418 | echo "release_exists=true" >> $GITHUB_OUTPUT 419 | else 420 | echo "Helm release 'model' not found." 421 | fi 422 | 423 | - name: Uninstall Model Helm Release 424 | if: steps.check-model-helm-release.outputs.release_exists == 'true' 425 | run: | 426 | helm uninstall model --namespace instill-ai 427 | 428 | - name: Install k6 429 | run: | 430 | brew install k6 431 | 432 | - name: Checkout repo 433 | uses: actions/checkout@v4 434 | with: 435 | repository: instill-ai/core 436 | 437 | - name: Load .env file 438 | uses: cardinalby/export-env-action@v2 439 | with: 440 | envFile: .env 441 | 442 | - name: Check if Core Helm release exists 443 | id: check-core-helm-release 444 | run: | 445 | if helm ls -n instill-ai | grep -q 'core'; then 446 | echo "Helm release 'core' found." 447 | echo "release_exists=true" >> $GITHUB_OUTPUT 448 | else 449 | echo "Helm release 'core' not found." 450 | fi 451 | 452 | - name: Uninstall Core Helm Release 453 | if: steps.check-core-helm-release.outputs.release_exists == 'true' 454 | run: | 455 | helm uninstall core --namespace instill-ai 456 | kubectl delete namespace instill-ai 457 | 458 | - name: Launch Helm Instill Core (release) 459 | run: | 460 | helm install core charts/core --namespace instill-ai --create-namespace \ 461 | --set edition=k8s-ce:test \ 462 | --set apiGateway.image.tag=${API_GATEWAY_VERSION} \ 463 | --set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \ 464 | --set console.image.tag=${CONSOLE_VERSION} \ 465 | --set tags.observability=false 466 | 467 | - name: Wait for core pods up 468 | run: | 469 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 470 | echo "$(kubectl get pods --namespace instill-ai)" 471 | sleep 10 472 | done 473 | 474 | - name: Port-forward of core-api-gateway 475 | run: | 476 | API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=core" -o json | jq -r '.items[0].metadata.name') 477 | kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 & 478 | while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done 479 | 480 | - name: Checkout repo (model) 481 | uses: actions/checkout@v4 482 | with: 483 | repository: instill-ai/model 484 | 485 | - name: Load .env file (model) 486 | uses: cardinalby/export-env-action@v2 487 | with: 488 | envFile: .env 489 | 490 | - name: Uppercase component name 491 | id: uppercase 492 | run: | 493 | echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT 494 | 495 | - name: Launch Helm Instill Model (release) 496 | run: | 497 | helm install model charts/model --namespace instill-ai --create-namespace \ 498 | --set itMode.enabled=true \ 499 | --set edition=k8s-ce:test \ 500 | --set modelBackend.image.tag=${MODEL_BACKEND_VERSION} \ 501 | --set controllerModel.image.tag=${CONTROLLER_MODEL_VERSION} \ 502 | --set rayService.image.tag=${RAY_SERVER_VERSION} \ 503 | --set rayService.headGroupSpec.resources.limits.cpu=0 \ 504 | --set rayService.headGroupSpec.resources.limits.memory=2Gi \ 505 | --set rayService.headGroupSpec.resources.requests.cpu=0 \ 506 | --set rayService.headGroupSpec.resources.requests.memory=2Gi \ 507 | --set rayService.workerGroupSpecs[0].replicas=1 \ 508 | --set rayService.workerGroupSpecs[0].minReplicas=1 \ 509 | --set rayService.workerGroupSpecs[0].maxReplicas=1 \ 510 | --set rayService.workerGroupSpecs[0].groupName=test-group \ 511 | --set rayService.workerGroupSpecs[0].gpuWorkerGroup.enabled=false \ 512 | --set rayService.workerGroupSpecs[0].resources.limits.cpu=1 \ 513 | --set rayService.workerGroupSpecs[0].resources.limits.memory=2Gi \ 514 | --set rayService.workerGroupSpecs[0].resources.requests.cpu=1 \ 515 | --set rayService.workerGroupSpecs[0].resources.requests.memory=2Gi \ 516 | --set tags.observability=false 517 | 518 | - name: Wait for model deployment 519 | run: | 520 | while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=controller-model,app.kubernetes.io/instance=model" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do 521 | echo "$(kubectl get pods --namespace instill-ai)" 522 | sleep 10 523 | done 524 | 525 | - name: Run ${{ inputs.component }} integration test (release) 526 | env: 527 | COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }} 528 | run: | 529 | git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git 530 | cd ${{ inputs.component }} 531 | make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT} 532 | 533 | - name: Uninstall Core and Model Helm Release 534 | run: | 535 | helm uninstall model --namespace instill-ai 536 | helm uninstall core --namespace instill-ai 537 | kubectl delete namespace instill-ai 538 | --------------------------------------------------------------------------------