diff --git a/.github/config/applications.json b/.github/config/applications.json new file mode 100644 index 00000000..39d33855 --- /dev/null +++ b/.github/config/applications.json @@ -0,0 +1,14 @@ +{ + "jarvis": { + "eks_cluster_name": "ascending-s-api-cluster", + "aws_deploy_role": "SAAS_AWS_DEPLOY_ROLE_ARN" + }, + "jarvis-demo": { + "eks_cluster_name": "ascending-s-api-cluster", + "aws_deploy_role": "SAAS_AWS_DEPLOY_ROLE_ARN" + }, + "askcto": { + "eks_cluster_name": "ascending-askcto-cluster", + "aws_deploy_role": "AWS_DEPLOY_ROLE_ARN" + } +} diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 00000000..4e097735 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,155 @@ +name: Deploy Admin Panel + +on: + push: + branches: + - main + paths: + - 'src/**' + - 'server.ts' + - 'package.json' + - 'bun.lock' + - 'Dockerfile' + - '.github/workflows/deploy.yaml' + workflow_dispatch: + inputs: + application: + description: 'Application to deploy to' + type: choice + required: true + default: jarvis + options: + - jarvis + - askcto + - jarvis-demo + region: + description: 'AWS Region to deploy to' + type: string + required: true + default: us-east-1 + +permissions: + id-token: write + contents: read + +run-name: Deploy Admin Panel for ${{ inputs.application }} + +jobs: + test: + name: Lint, Type Check & Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: ESLint + run: bunx eslint src/ --max-warnings 0 + + - name: TypeScript + run: bunx tsc --noEmit + + - name: Vitest + run: bun run test + env: + NODE_ENV: development + SESSION_SECRET: ci-test-secret-do-not-use-in-production + + build-and-push: + name: Build & Push to ECR + runs-on: ubuntu-latest + needs: test + outputs: + image: ${{ steps.tags.outputs.ecr_image }} + steps: + - uses: actions/checkout@v6 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Assume IAM role + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.SAAS_AWS_DEPLOY_ROLE_ARN }} + role-session-name: deployment-role-session + aws-region: ${{ inputs.region || 'us-east-1' }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + registries: "897729109735" + + - name: Determine image tags + id: tags + run: | + ECR_IMAGE="${{ steps.login-ecr.outputs.registry }}/jarvis/admin-panel" + echo "ecr_image=${ECR_IMAGE}:${{ github.sha }}" >> $GITHUB_OUTPUT + echo "tags=${ECR_IMAGE}:${{ github.sha }},${ECR_IMAGE}:latest" >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ steps.tags.outputs.tags }} + provenance: false + + deploy: + name: Deploy to EKS + runs-on: ubuntu-latest + needs: build-and-push + if: github.event_name == 'workflow_dispatch' + env: + DEPLOYMENT_NAME: jarvis-admin-panel + steps: + - uses: actions/checkout@v6 + + - name: Load Application Configuration + id: config + run: | + CONFIG=$(cat .github/config/applications.json | jq -r --arg app "${{ inputs.application }}" '.[$app]') + echo "eks_cluster_name=$(echo $CONFIG | jq -r '.eks_cluster_name')" >> $GITHUB_OUTPUT + echo "aws_deploy_role=$(echo $CONFIG | jq -r '.aws_deploy_role')" >> $GITHUB_OUTPUT + + - name: Install kubectl + uses: azure/setup-kubectl@v3 + with: + version: latest + + - name: Set IAM role to assume + id: set-role + run: echo "role=${{ secrets[steps.config.outputs.aws_deploy_role] }}" >> $GITHUB_OUTPUT + + - name: Assume IAM role + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ steps.set-role.outputs.role }} + role-session-name: deployment-role-session + aws-region: ${{ inputs.region }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + registries: "897729109735" + + - name: Update kubeconfig + run: aws eks update-kubeconfig --name ${{ steps.config.outputs.eks_cluster_name }} --region ${{ inputs.region }} + + - name: Update image on EKS + run: | + kubectl set image deploy/${{ env.DEPLOYMENT_NAME }} \ + jarvis-admin-panel=${{ needs.build-and-push.outputs.image }} \ + -n ${{ inputs.application }} + + - name: Restart pods + run: kubectl rollout restart deploy/${{ env.DEPLOYMENT_NAME }} -n ${{ inputs.application }} + + - name: Check pod status + run: kubectl rollout status deploy/${{ env.DEPLOYMENT_NAME }} -n ${{ inputs.application }} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 96a21d1f..00000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Docker Image Publish - -on: - workflow_dispatch: - push: - branches: - - main - paths: - - 'src/**' - - 'server.ts' - - 'package.json' - - 'bun.lock' - - 'Dockerfile' - - '.github/workflows/docker-publish.yml' - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile - push: true - tags: | - ghcr.io/clickhouse/librechat-admin-panel:${{ github.sha }} - ghcr.io/clickhouse/librechat-admin-panel:latest - platforms: linux/amd64,linux/arm64 diff --git a/public/clickhouse-dark.svg b/public/clickhouse-dark.svg deleted file mode 100644 index d3a8e478..00000000 --- a/public/clickhouse-dark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/clickhouse-light.svg b/public/clickhouse-light.svg deleted file mode 100644 index 6543c1d6..00000000 --- a/public/clickhouse-light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 00000000..c55272f0 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index f8fced34..00000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/librechat-logo.svg b/public/librechat-logo.svg deleted file mode 100644 index b455209c..00000000 --- a/public/librechat-logo.svg +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/public/manifest.json b/public/manifest.json index 52708d81..932db358 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "LibreChat Admin", - "name": "LibreChat Admin Panel", + "short_name": "Jarvis Chat Admin", + "name": "Jarvis Chat Admin Panel", "icons": [ { "src": "favicon.ico", diff --git a/src/assets/jarvis.svg b/src/assets/jarvis.svg new file mode 100644 index 00000000..d9879632 --- /dev/null +++ b/src/assets/jarvis.svg @@ -0,0 +1,50 @@ + + \ No newline at end of file diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 98f6d770..b75f7cde 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -3,7 +3,7 @@ import { Icon, Dropdown } from '@clickhouse/click-ui'; import { Link, useRouter } from '@tanstack/react-router'; import type * as t from '@/types'; import { useStripAriaExpanded, useCapabilities, useLocalize } from '@/hooks'; -import libreChatLogo from '@/assets/librechat.svg'; +import jarvisLogo from '@/assets/jarvis.svg'; import { SettingsDialog } from './SettingsDialog'; import { SystemCapabilities } from '@/constants'; import { getInitials, cn } from '@/utils'; @@ -84,7 +84,7 @@ export function Sidebar({ user, collapsed, onToggle }: t.SidebarProps) { >