-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (137 loc) · 4.89 KB
/
Copy pathdeploy-deepwiki.yml
File metadata and controls
148 lines (137 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Deploy DeepWiki
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'dev'
type: choice
options:
- dev
- prod
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup kubectl
uses: azure/setup-kubectl@v4
with:
version: 'latest'
- name: Configure kubectl
run: |
# You'll need to add KUBE_CONFIG as a secret containing your kubeconfig
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ${HOME}/.kube/config
- name: Create namespace if not exists
run: |
kubectl create namespace codequal-${{ github.event.inputs.environment }} --dry-run=client -o yaml | kubectl apply -f -
- name: Create DeepWiki secrets
run: |
kubectl create secret generic deepwiki-secrets \
--namespace=codequal-${{ github.event.inputs.environment }} \
--from-literal=openai-api-key="${{ secrets.OPENAI_API_KEY }}" \
--from-literal=openrouter-api-key="${{ secrets.OPENROUTER_API_KEY }}" \
--from-literal=github-token="${{ secrets.GITHUB_TOKEN }}" \
--from-literal=google-api-key="${{ secrets.GOOGLE_API_KEY }}" \
--from-literal=voyage-api-key="${{ secrets.VOYAGE_API_KEY }}" \
--dry-run=client -o yaml | kubectl apply -f -
- name: Update deployment file with secrets
run: |
# Create a temporary deployment file that uses secrets
cat > /tmp/deepwiki-deployment.yaml << 'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: deepwiki
namespace: codequal-${{ github.event.inputs.environment }}
spec:
replicas: 1
selector:
matchLabels:
app: deepwiki
template:
metadata:
labels:
app: deepwiki
spec:
containers:
- name: deepwiki
image: mrdiplomatic/deepwiki:v2.0
env:
- name: SERVER_BASE_URL
value: http://deepwiki-api:8001
- name: NEXT_PUBLIC_SERVER_BASE_URL
value: http://deepwiki-api:8001
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: deepwiki-secrets
key: openai-api-key
- name: OPENROUTER_API_KEY
valueFrom:
secretKeyRef:
name: deepwiki-secrets
key: openrouter-api-key
- name: OPENROUTER_BASE_URL
value: https://openrouter.ai/api/v1
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: deepwiki-secrets
key: github-token
- name: GOOGLE_API_KEY
valueFrom:
secretKeyRef:
name: deepwiki-secrets
key: google-api-key
- name: VOYAGE_API_KEY
valueFrom:
secretKeyRef:
name: deepwiki-secrets
key: voyage-api-key
- name: LLM_MODEL
value: openai/gpt-4-turbo-preview
- name: EMBEDDING_MODEL
value: text-embedding-3-large
resources:
requests:
memory: "1Gi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "1000m"
volumeMounts:
- name: deepwiki-storage
mountPath: /app/storage
volumes:
- name: deepwiki-storage
persistentVolumeClaim:
claimName: deepwiki-pvc
---
apiVersion: v1
kind: Service
metadata:
name: deepwiki-api
namespace: codequal-${{ github.event.inputs.environment }}
spec:
selector:
app: deepwiki
ports:
- protocol: TCP
port: 8001
targetPort: 8001
EOF
- name: Apply deployment
run: |
kubectl apply -f /tmp/deepwiki-deployment.yaml
- name: Wait for deployment
run: |
kubectl rollout status deployment/deepwiki \
--namespace=codequal-${{ github.event.inputs.environment }} \
--timeout=300s
- name: Check deployment status
run: |
echo "🚀 DeepWiki deployed to ${{ github.event.inputs.environment }} environment"
kubectl get pods --namespace=codequal-${{ github.event.inputs.environment }} -l app=deepwiki
kubectl get svc --namespace=codequal-${{ github.event.inputs.environment }} -l app=deepwiki