This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: control loop for model state monitoring (#1)
Because - monitor the states of model resources continuously This commit - add production/development dockerfile - implement control loop - add service methods between model-backend according to protobufs
- Loading branch information
Showing
19 changed files
with
2,121 additions
and
299 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Build and Push Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
docker-hub: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.botGitHubToken }} | ||
|
||
- name: Load .env file | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: .env | ||
expand: true | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: dropletbot | ||
password: ${{ secrets.botDockerHubPassword }} | ||
|
||
- name: Build and push (latest) | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
push: true | ||
build-args: | | ||
SERVICE_NAME=controller | ||
GOLANG_VERSION=${{ env.GOLANG_VERSION }} | ||
tags: instill/controller:latest | ||
cache-from: type=registry,ref=instill/controller:buildcache | ||
cache-to: type=registry,ref=instill/controller:buildcache,mode=max | ||
|
||
- name: Set Versions | ||
if: github.event_name == 'release' | ||
uses: actions/github-script@v6 | ||
id: set_version | ||
with: | ||
script: | | ||
const tag = '${{ github.ref_name }}' | ||
const no_v_tag = tag.replace('v', '') | ||
core.setOutput('tag', tag) | ||
core.setOutput('no_v_tag', no_v_tag) | ||
- name: Build and push (release) | ||
if: github.event_name == 'release' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
push: true | ||
build-args: | | ||
SERVICE_NAME=controller | ||
GOLANG_VERSION=${{ env.GOLANG_VERSION }} | ||
tags: instill/controller:${{steps.set_version.outputs.no_v_tag}} | ||
cache-from: type=registry,ref=instill/controller:buildcache | ||
cache-to: type=registry,ref=instill/controller:buildcache,mode=max |
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,45 @@ | ||
name: Release Please | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RELEASE_CREATED: ${{ steps.release.outputs.release_created }} | ||
TAG_NAME: ${{ steps.release.outputs.tag_name }} | ||
SHA: ${{ steps.release.outputs.sha }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
token: ${{ secrets.botGitHubToken }} | ||
release-type: go | ||
command: manifest | ||
config-file: release-please/config.json | ||
manifest-file: release-please/manifest.json | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.botGitHubToken }} | ||
- name: Import GPG Key | ||
uses: crazy-max/ghaction-import-gpg@v4 | ||
with: | ||
gpg_private_key: ${{ secrets.botGPGPrivateKey }} | ||
passphrase: ${{ secrets.botGPGPassphrase }} | ||
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
git_tag_gpgsign: true | ||
- name: Tag major and minor versions | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: | | ||
git tag -d v${{ steps.release.outputs.major }} || true | ||
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | ||
git push origin :v${{ steps.release.outputs.major }} || true | ||
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true | ||
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }} pointing to tag ${{ steps.release.outputs.tag_name }}" | ||
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 }}" | ||
git push origin v${{ steps.release.outputs.major }} | ||
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} |
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,43 @@ | ||
ARG GOLANG_VERSION | ||
ARG UBUNTU_VERSION | ||
|
||
FROM --platform=$BUILDPLATFORM golang:${GOLANG_VERSION} AS build | ||
|
||
ARG SERVICE_NAME | ||
|
||
WORKDIR /src | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . . | ||
|
||
ARG TARGETOS TARGETARCH | ||
RUN --mount=target=. --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /${SERVICE_NAME} ./cmd/main | ||
|
||
# Mounting points | ||
RUN mkdir /etc/vdp | ||
RUN mkdir /vdp | ||
|
||
FROM --platform=$BUILDPLATFORM ubuntu:${UBUNTU_VERSION} | ||
|
||
# Need permission of /tmp folder for internal process such as store temporary files. | ||
RUN chown -R nobody:nogroup /tmp | ||
# Need permission of /nonexistent folder for HuggingFace internal process. | ||
RUN mkdir /nonexistent > /dev/null && chown -R nobody:nogroup /nonexistent | ||
|
||
USER nobody:nogroup | ||
|
||
ARG SERVICE_NAME | ||
|
||
WORKDIR /${SERVICE_NAME} | ||
|
||
COPY --from=docker:dind-rootless --chown=nobody:nogroup /usr/local/bin/docker /usr/local/bin | ||
|
||
COPY --from=build --chown=nobody:nogroup /src/config ./config | ||
COPY --from=build --chown=nobody:nogroup /src/assets ./assets | ||
COPY --from=build --chown=nobody:nogroup /src/release-please ./release-please | ||
|
||
COPY --from=build --chown=nobody:nogroup /${SERVICE_NAME} ./ | ||
|
||
COPY --from=build --chown=nobody:nogroup /etc/vdp /etc/vdp | ||
COPY --from=build --chown=nobody:nogroup /vdp /vdp |
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
Oops, something went wrong.