-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cd: workflow for deploying ml pipeline (#64)
* cd: workflow for deploying ml pipeline * reset database on every run * remove gpu usage for now because we do not have quota * pass correct chromadb host to pipeline
- Loading branch information
1 parent
91bb3ce
commit efca2b0
Showing
33 changed files
with
828 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Deploy ChromaDB | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy-chromadb: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Google authentication | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | ||
|
||
- name: Set up gcloud CLI | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Configure Docker client | ||
run: gcloud auth configure-docker | ||
|
||
- name: Build deployment container | ||
run: cd deploy && make build | ||
|
||
# Redeploying the ChromaDB instance would require redeploying the pipeline | ||
# and the app as well | ||
- name: Deploy ChromaDB | ||
env: | ||
VERITAS_TRIAL_SERVICE_CREDENTIALS: /tmp/veritas-trial-service.json | ||
run: | | ||
cd deploy | ||
printf "%s" "${{ secrets.VERITAS_TRIAL_SERVICE_KEY }}" > /tmp/veritas-trial-service.json | ||
make gh-actions command=./deploy-chromadb.sh | ||
make gh-actions command=./deploy-pipeline.sh | ||
make gh-actions command=./deploy-app.sh | ||
rm /tmp/veritas-trial-service.json | ||
- name: Create PR | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.CHARLIE_XIAO_PAT }} | ||
labels: app, ci/cd | ||
title: "cd: updates of chromadb deployment" | ||
commit-message: "cd: updates of chromadb deployment" | ||
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||
body: | | ||
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}. | ||
Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- name: Enable auto-merge | ||
run: gh pr merge --squash --auto "$PR_NUMBER" | ||
env: | ||
GH_TOKEN: ${{ secrets.CHARLIE_XIAO_PAT }} | ||
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Deploy pipeline | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy-pipeline: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Google authentication | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | ||
|
||
- name: Set up gcloud CLI | ||
uses: google-github-actions/setup-gcloud@v2 | ||
|
||
- name: Configure Docker client | ||
run: gcloud auth configure-docker | ||
|
||
- name: Build deployment container | ||
run: cd deploy && make build | ||
|
||
- name: Deploy pipeline | ||
env: | ||
VERITAS_TRIAL_SERVICE_CREDENTIALS: /tmp/veritas-trial-service.json | ||
run: | | ||
cd deploy | ||
printf "%s" "${{ secrets.VERITAS_TRIAL_SERVICE_KEY }}" > /tmp/veritas-trial-service.json | ||
make gh-actions command=./deploy-pipeline.sh | ||
rm /tmp/veritas-trial-service.json | ||
- name: Create PR | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.CHARLIE_XIAO_PAT }} | ||
labels: ci/cd | ||
title: "cd: updates of pipeline deployment" | ||
commit-message: "cd: updates of pipeline deployment" | ||
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||
committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" | ||
body: | | ||
This PR was triggered by @${{ github.actor }} in ${{ github.workflow }}. | ||
Check the workflow run at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- name: Enable auto-merge | ||
run: gh pr merge --squash --auto "$PR_NUMBER" | ||
env: | ||
GH_TOKEN: ${{ secrets.CHARLIE_XIAO_PAT }} | ||
PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20241206223116 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
35.226.13.117 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
|
||
ansible-playbook app/deploy-images.yaml -i inventory.yaml | ||
ansible-playbook app/deploy-k8s.yaml -i inventory.yaml --extra-vars cluster_state=present | ||
CHROMADB_HOST=$(cat chromadb/.instance-ip) ansible-playbook app/deploy-k8s.yaml -i inventory.yaml --extra-vars cluster_state=present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
ansible-playbook pipeline/deploy-images.yaml -i inventory.yaml | ||
./pipeline/pipeline.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
CHROMADB_HOST=$(cat chromadb/.instance-ip) | ||
|
||
ansible-playbook app/deploy-k8s.yaml -i inventory.yaml --extra-vars cluster_state=absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
- name: Build and push Docker images to Artifact Registry | ||
hosts: localhost | ||
gather_facts: false | ||
|
||
vars: | ||
registry_base: "{{ gcp_region }}-docker.pkg.dev/{{ gcp_project_id }}/docker" | ||
|
||
tasks: | ||
- name: Set timestamp as Docker image tag | ||
shell: date +%Y%m%d%H%M%S | ||
register: docker_tag | ||
|
||
- name: Build data pipeline image | ||
community.docker.docker_image: | ||
build: | ||
path: /src/data-pipeline | ||
platform: linux/amd64/v2 | ||
name: "{{ registry_base }}/veritas-trial-data-pipeline:{{ docker_tag.stdout }}" | ||
source: build | ||
|
||
- name: Push data pipeline image | ||
community.docker.docker_image: | ||
name: "{{ registry_base }}/veritas-trial-data-pipeline:{{ docker_tag.stdout }}" | ||
repository: "{{ registry_base }}/veritas-trial-data-pipeline:{{ docker_tag.stdout }}" | ||
push: true | ||
source: local | ||
|
||
- name: Remove data pipeline image locally | ||
community.docker.docker_image: | ||
name: "{{ registry_base }}/veritas-trial-data-pipeline:{{ docker_tag.stdout }}" | ||
source: local | ||
state: absent | ||
force_absent: true | ||
|
||
- name: Build embedding model image | ||
community.docker.docker_image: | ||
build: | ||
path: /src/embedding-model | ||
platform: linux/amd64/v2 | ||
name: "{{ registry_base }}/veritas-trial-embedding-model:{{ docker_tag.stdout }}" | ||
source: build | ||
|
||
- name: Push embedding model image | ||
community.docker.docker_image: | ||
name: "{{ registry_base }}/veritas-trial-embedding-model:{{ docker_tag.stdout }}" | ||
repository: "{{ registry_base }}/veritas-trial-embedding-model:{{ docker_tag.stdout }}" | ||
push: true | ||
source: local | ||
|
||
- name: Remove embedding model image locally | ||
community.docker.docker_image: | ||
name: "{{ registry_base }}/veritas-trial-embedding-model:{{ docker_tag.stdout }}" | ||
source: local | ||
state: absent | ||
force_absent: true | ||
|
||
- name: Save Docker tag | ||
shell: echo {{ docker_tag.stdout }} > ../.docker-tag-pipeline |
Oops, something went wrong.