Add CICD
This commit is contained in:
29
.drone.yml
Normal file
29
.drone.yml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: build-and-push
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- custom
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build-and-push
|
||||||
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
|
commands:
|
||||||
|
- >
|
||||||
|
/kaniko/executor
|
||||||
|
--context=/drone/src
|
||||||
|
--dockerfile=Dockerfile
|
||||||
|
--destination=192.168.68.11:30500/xiaohongshu-mcp:${DRONE_COMMIT_SHA:0:8}
|
||||||
|
--destination=192.168.68.11:30500/xiaohongshu-mcp:latest
|
||||||
|
--insecure
|
||||||
|
--skip-tls-verify
|
||||||
|
|
||||||
|
- name: restart-deployment
|
||||||
|
image: bitnami/kubectl:latest
|
||||||
|
commands:
|
||||||
|
- kubectl rollout restart deploy/xiaohongshu-mcp -n xiaohongshu-mcp
|
||||||
20
k8s/argocd-app.yaml
Normal file
20
k8s/argocd-app.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://git.colacoder.com/kai/xiaohongshu-mcp.git
|
||||||
|
targetRevision: main
|
||||||
|
path: k8s/base
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
70
k8s/base/deployment.yaml
Normal file
70
k8s/base/deployment.yaml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
labels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: xiaohongshu-mcp
|
||||||
|
image: 192.168.68.11:30500/xiaohongshu-mcp:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 18060
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: ROD_BROWSER_BIN
|
||||||
|
value: "/usr/bin/google-chrome"
|
||||||
|
- name: COOKIES_PATH
|
||||||
|
value: "/app/data/cookies.json"
|
||||||
|
- name: TZ
|
||||||
|
value: "Asia/Shanghai"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 512Mi
|
||||||
|
limits:
|
||||||
|
cpu: "1"
|
||||||
|
memory: 2Gi
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /app/data
|
||||||
|
- name: images
|
||||||
|
mountPath: /app/images
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 18060
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 30
|
||||||
|
timeoutSeconds: 5
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 18060
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
periodSeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: xiaohongshu-mcp-data
|
||||||
|
- name: images
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: xiaohongshu-mcp-images
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 256Mi
|
||||||
29
k8s/base/drone-rbac.yaml
Normal file
29
k8s/base/drone-rbac.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: drone-deploy
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
rules:
|
||||||
|
- apiGroups: ["apps"]
|
||||||
|
resources: ["deployments"]
|
||||||
|
verbs: ["get", "list", "patch", "update"]
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: drone-deploy
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: default
|
||||||
|
namespace: drone
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: drone
|
||||||
|
namespace: drone
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: drone-runner-drone-runner-kube
|
||||||
|
namespace: drone
|
||||||
|
roleRef:
|
||||||
|
kind: Role
|
||||||
|
name: drone-deploy
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
26
k8s/base/ingress.yaml
Normal file
26
k8s/base/ingress.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
|
||||||
|
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
|
||||||
|
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
|
||||||
|
spec:
|
||||||
|
ingressClassName: nginx
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- xiaohongshu-mcp.k8s.home
|
||||||
|
secretName: xiaohongshu-mcp-tls
|
||||||
|
rules:
|
||||||
|
- host: xiaohongshu-mcp.k8s.home
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
|
port:
|
||||||
|
number: 18060
|
||||||
12
k8s/base/kustomization.yaml
Normal file
12
k8s/base/kustomization.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- pvc.yaml
|
||||||
|
- deployment.yaml
|
||||||
|
- service.yaml
|
||||||
|
- ingress.yaml
|
||||||
|
- drone-rbac.yaml
|
||||||
4
k8s/base/namespace.yaml
Normal file
4
k8s/base/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
27
k8s/base/pvc.yaml
Normal file
27
k8s/base/pvc.yaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp-data
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
labels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp-images
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
labels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 5Gi
|
||||||
15
k8s/base/service.yaml
Normal file
15
k8s/base/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: xiaohongshu-mcp
|
||||||
|
namespace: xiaohongshu-mcp
|
||||||
|
labels:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
selector:
|
||||||
|
app: xiaohongshu-mcp
|
||||||
|
ports:
|
||||||
|
- port: 18060
|
||||||
|
targetPort: 18060
|
||||||
|
protocol: TCP
|
||||||
Reference in New Issue
Block a user