Skip to content

Commit

Permalink
Kubernetes infra (huggingface#1088)
Browse files Browse the repository at this point in the history
* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): create kube infra

* feat(chart): add hpa

* feat(chart): add service monitor

* feat(chart): test

* feat(chart): fix lint

* feat(chart): remove pm2

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* feat(chart): fix

* update replicas count

* json logs

* use internal image for prod env

* Add LOG_LEVEL in prod yaml

* Get rid of unused staging env

* add an image build for internal registry

---------

Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
  • Loading branch information
rtrompier and nsarrazin authored May 3, 2024
1 parent 4c26efb commit bc187da
Show file tree
Hide file tree
Showing 15 changed files with 672 additions and 25 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Deploy to k8s
on:
# run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-and-publish-huggingchat-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Tailscale
uses: huggingface/tailscale-action@main
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}

- name: Extract package version
id: package-version
run: |
VERSION=$(jq -r .version package.json)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
MAJOR=$(echo $VERSION | cut -d '.' -f1)
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/huggingface/chat-ui
tags: |
type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Registry
uses: docker/login-action@v2
with:
registry: registry.internal.huggingface.tech
username: ${{ secrets.DOCKER_INTERNAL_USERNAME }}
password: ${{ secrets.DOCKER_INTERNAL_PASSWORD }}

- name: Build and Publish Docker Image without DB
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-to: type=gha,mode=max,scope=amd64
cache-from: type=gha,scope=amd64
provenance: false
build-args: |
INCLUDE_DB=false
APP_BASE=/chat
PUBLIC_APP_COLOR=yellow
2 changes: 1 addition & 1 deletion .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to production
name: Deploy to production spaces
on:
# run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/deploy-staging.yml

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
/build
/.svelte-kit
/package
/chart
.env
.env.*
!.env.example
Expand Down
5 changes: 5 additions & 0 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: chat-ui
version: 0.0.0-latest
type: application
icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
Loading

0 comments on commit bc187da

Please sign in to comment.