-
Notifications
You must be signed in to change notification settings - Fork 0
feat: create k8s deploy #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 +1,5 @@ | ||
| # Ethereum JSON-RPC endpoint (default: https://ethereum-rpc.publicnode.com) | ||
| ETH_RPC_URL= | ||
|
|
||
| # CoinGecko API key (optional, raises rate limits for token discovery) | ||
| COINGECKO_API_KEY= | ||
|
|
||
| # Blockchair proxy base URL (default: https://api.vultisig.com/blockchair) | ||
| BLOCKCHAIR_API_URL= |
This file contains hidden or 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,75 @@ | ||
| name: Build and Push Docker Image | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| service: | ||
| required: true | ||
| type: string | ||
| description: Service name (e.g., mcp-server) | ||
| registry: | ||
| required: true | ||
| type: string | ||
| description: Container registry URL | ||
| image_name: | ||
| required: true | ||
| type: string | ||
| description: Image name (repository) | ||
| tag: | ||
| required: true | ||
| type: string | ||
| description: Image tag | ||
| additional_tag: | ||
| required: false | ||
| type: string | ||
| description: Additional tag (e.g., latest, dev-latest) | ||
| default: "" | ||
| platforms: | ||
| required: false | ||
| type: string | ||
| description: Target platforms (e.g., linux/amd64,linux/arm64) | ||
| default: "linux/amd64" | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| 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 Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ inputs.registry }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Prepare tags | ||
| id: prep | ||
| run: | | ||
| TAGS="${{ inputs.registry }}/${{ inputs.image_name }}/${{ inputs.service }}:${{ inputs.tag }}" | ||
| if [ -n "${{ inputs.additional_tag }}" ]; then | ||
| TAGS="${TAGS},${{ inputs.registry }}/${{ inputs.image_name }}/${{ inputs.service }}:${{ inputs.additional_tag }}" | ||
| fi | ||
| echo "tags=${TAGS}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build and push image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: true | ||
| platforms: ${{ inputs.platforms }} | ||
| tags: ${{ steps.prep.outputs.tags }} | ||
| build-args: | | ||
| SERVICE=${{ inputs.service }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| provenance: false | ||
This file contains hidden or 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,55 @@ | ||
| name: Build and Deploy to Dev | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - dev | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '.gitignore' | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
| NS: agent | ||
|
|
||
| jobs: | ||
| build-server: | ||
| uses: ./.github/workflows/build-push-image.yaml | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| with: | ||
| service: mcp-server | ||
| registry: ghcr.io | ||
| image_name: ${{ github.repository }} | ||
| tag: dev-${{ github.sha }} | ||
| additional_tag: dev-latest | ||
|
|
||
| deploy: | ||
| needs: [build-server] | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up kubeconfig | ||
| run: | | ||
| mkdir -p ~/.kube | ||
| echo "${{ secrets.KUBECONFIG_DEV }}" > ~/.kube/config | ||
| chmod 600 ~/.kube/config | ||
|
|
||
| - name: Update deployment files | ||
| run: | | ||
| TAG="dev-${{ github.sha }}" | ||
| sed -i "s|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:.*|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:${TAG}|" deploy/01_server.yaml | ||
|
|
||
| - name: Deploy to Kubernetes | ||
| run: | | ||
| kubectl -n ${{ env.NS }} apply -f deploy/dev | ||
| kubectl -n ${{ env.NS }} apply -f deploy/01_server.yaml | ||
| kubectl -n ${{ env.NS }} rollout status deployment/server --timeout=300s |
This file contains hidden or 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,90 @@ | ||
| name: Build and Push Images | ||
4others marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
| NS: agent | ||
|
|
||
| jobs: | ||
| build-server: | ||
| uses: ./.github/workflows/build-push-image.yaml | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| with: | ||
| service: mcp-server | ||
| registry: ghcr.io | ||
| image_name: ${{ github.repository }} | ||
| tag: ${{ github.event.release.tag_name }} | ||
| additional_tag: latest | ||
|
|
||
| set-public: | ||
| needs: [build-server] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| packages: write | ||
| steps: | ||
| - name: Set GHCR packages public | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| owner="${{ github.repository_owner }}" | ||
| repo="${{ github.event.repository.name }}" | ||
| gh api -X PATCH "/orgs/${owner}/packages/container/${repo}%2Fmcp-server/visibility" -f visibility=public || true | ||
4others marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| update-manifests: | ||
| needs: [build-server, set-public] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
|
|
||
| - name: Update deployment files with new image tags | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| sed -i "s|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:.*|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:${TAG}|" deploy/01_server.yaml | ||
|
|
||
| - name: Commit and push updated manifests | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add deploy/ | ||
| git commit -m "chore: update image tags to ${{ github.event.release.tag_name }}" || echo "No changes to commit" | ||
| git push origin main | ||
|
|
||
| deploy: | ||
| needs: [update-manifests] | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
|
|
||
| - name: Set up kubeconfig | ||
| run: | | ||
| mkdir -p ~/.kube | ||
| echo "${{ secrets.KUBECONFIG_PROD }}" > ~/.kube/config | ||
| chmod 600 ~/.kube/config | ||
|
|
||
| - name: Update deployment files | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| sed -i "s|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:.*|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:${TAG}|" deploy/01_server.yaml | ||
|
|
||
| - name: Deploy to Kubernetes | ||
| run: | | ||
| kubectl -n ${{ env.NS }} apply -f deploy/prod | ||
| kubectl -n ${{ env.NS }} apply -f deploy/01_server.yaml | ||
| kubectl -n ${{ env.NS }} rollout status deployment/server --timeout=300s | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,26 @@ | ||
| name: Sync main to dev | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| sync-main-to-dev: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Sync main to dev | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git fetch origin dev:dev | ||
| git checkout dev | ||
| git merge origin/main --no-edit | ||
| git push origin dev |
This file contains hidden or 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 hidden or 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,37 @@ | ||
| FROM golang:1.25.5 AS builder | ||
|
|
||
| ARG TARGETARCH=amd64 | ||
|
|
||
| RUN apt-get update && apt-get install -y clang lld wget | ||
|
|
||
| RUN wget https://github.com/vultisig/go-wrappers/archive/refs/heads/master.tar.gz && \ | ||
| tar -xzf master.tar.gz && \ | ||
| cd go-wrappers-master && \ | ||
| mkdir -p /usr/local/lib/dkls/includes && \ | ||
| cp includes/go-dkls.h includes/go-schnorr.h /usr/local/lib/dkls/includes/ && \ | ||
| if [ ! -d "includes/linux-${TARGETARCH}" ]; then echo "Error: includes/linux-${TARGETARCH} not found" && exit 1; fi && \ | ||
| cp -r includes/linux-${TARGETARCH} /usr/local/lib/dkls/includes/linux | ||
4others marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ARG SERVICE | ||
| WORKDIR /app | ||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
| COPY . . | ||
|
|
||
| ENV CGO_ENABLED=1 | ||
| ENV CC=clang | ||
| ENV CGO_LDFLAGS=-fuse-ld=lld | ||
| ENV LD_LIBRARY_PATH=/usr/local/lib/dkls/includes/linux:$LD_LIBRARY_PATH | ||
| RUN go build -o main cmd/${SERVICE}/main.go | ||
4others marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FROM ubuntu:22.04 | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /app/main . | ||
| COPY --from=builder /usr/local/lib/dkls /usr/local/lib/dkls | ||
| ENV LD_LIBRARY_PATH=/usr/local/lib/dkls/includes/linux:$LD_LIBRARY_PATH | ||
4others marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.