diff --git a/compose.yml b/compose.yml index 2b3185301..99557a1d8 100644 --- a/compose.yml +++ b/compose.yml @@ -9,10 +9,9 @@ services: restart: always ports: # mappings description: https://github.com/AstrBotDevs/AstrBot/issues/497 - "6185:6185" # 必选,AstrBot WebUI 端口 - - "6195:6195" # 可选, 企业微信 Webhook 端口 - "6199:6199" # 可选, QQ 个人号 WebSocket 端口 - - "6196:6196" # 可选, QQ 官方接口 Webhook 端口 - - "11451:11451" # 可选, 微信个人号 Webhook 端口 + # - "6195:6195" # 可选, 企业微信 Webhook 端口 + # - "6196:6196" # 可选, QQ 官方接口 Webhook 端口 environment: - TZ=Asia/Shanghai volumes: diff --git a/k8s/astrbot/00-namespace.yaml b/k8s/astrbot/00-namespace.yaml new file mode 100644 index 000000000..547118bd8 --- /dev/null +++ b/k8s/astrbot/00-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: astrbot-standalone-ns \ No newline at end of file diff --git a/k8s/astrbot/01-pvc.yaml b/k8s/astrbot/01-pvc.yaml new file mode 100644 index 000000000..a219aa0f6 --- /dev/null +++ b/k8s/astrbot/01-pvc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: astrbot-data-pvc + namespace: astrbot-standalone-ns + labels: + app: astrbot-standalone +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + # storageClassName: standard # uncomment and set proper StorageClass \ No newline at end of file diff --git a/k8s/astrbot/02-deployment.yaml b/k8s/astrbot/02-deployment.yaml new file mode 100644 index 000000000..d2799ab90 --- /dev/null +++ b/k8s/astrbot/02-deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: astrbot-standalone + namespace: astrbot-standalone-ns + labels: + app: astrbot-standalone +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: astrbot-standalone + template: + metadata: + labels: + app: astrbot-standalone + spec: + containers: + - name: astrbot + image: soulter/astrbot:latest + imagePullPolicy: IfNotPresent + env: + - name: TZ + value: "Asia/Shanghai" + ports: + - containerPort: 6185 + name: webui + - containerPort: 6199 + name: qq-ws + # - containerPort: 6195 + # name: wecom-wh + # - containerPort: 6196 + # name: qq-off-wh + volumeMounts: + - name: data + mountPath: /AstrBot/data + - name: localtime + mountPath: /etc/localtime + readOnly: true + volumes: + - name: data + persistentVolumeClaim: + claimName: astrbot-data-pvc + - name: localtime + hostPath: + path: /etc/localtime + type: File \ No newline at end of file diff --git a/k8s/astrbot/03-service-nodeport.yaml b/k8s/astrbot/03-service-nodeport.yaml new file mode 100644 index 000000000..7342bd97a --- /dev/null +++ b/k8s/astrbot/03-service-nodeport.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Service +metadata: + name: astrbot-standalone-nodeport + namespace: astrbot-standalone-ns + labels: + app: astrbot-standalone +spec: + type: NodePort + selector: + app: astrbot-standalone + ports: + - name: webui + port: 6185 + targetPort: 6185 + nodePort: 30185 + - name: qq-ws + port: 6199 + targetPort: 6199 + nodePort: 30199 + # - name: wecom-wh + # port: 6195 + # targetPort: 6195 + # nodePort: 30195 + # - name: qq-off-wh + # port: 6196 + # targetPort: 6196 + # nodePort: 30196 \ No newline at end of file diff --git a/k8s/astrbot/04-service-loadbalancer.yaml b/k8s/astrbot/04-service-loadbalancer.yaml new file mode 100644 index 000000000..f841594d4 --- /dev/null +++ b/k8s/astrbot/04-service-loadbalancer.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: astrbot-standalone-lb + namespace: astrbot-standalone-ns + labels: + app: astrbot-standalone +spec: + type: LoadBalancer + selector: + app: astrbot-standalone + ports: + - name: webui + port: 6185 + targetPort: 6185 + - name: qq-ws + port: 6199 + targetPort: 6199 + # - name: wecom-wh + # port: 6195 + # targetPort: 6195 + # - name: qq-off-wh + # port: 6196 + # targetPort: 6196 \ No newline at end of file diff --git a/k8s/astrbot_with_napcat/00-namespace.yaml b/k8s/astrbot_with_napcat/00-namespace.yaml new file mode 100644 index 000000000..1e6ab5016 --- /dev/null +++ b/k8s/astrbot_with_napcat/00-namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: astrbot-ns \ No newline at end of file diff --git a/k8s/astrbot_with_napcat/01-pvc.yaml b/k8s/astrbot_with_napcat/01-pvc.yaml new file mode 100644 index 000000000..8efd67f9a --- /dev/null +++ b/k8s/astrbot_with_napcat/01-pvc.yaml @@ -0,0 +1,46 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: astrbot-data-shared-pvc + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Gi + # storageClassName: nfs-client # Uncomment and set your RWX storage class if needed + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: napcat-config-pvc + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi + # storageClassName: standard + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: napcat-qq-pvc + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi + # storageClassName: standard \ No newline at end of file diff --git a/k8s/astrbot_with_napcat/02-deployment.yaml b/k8s/astrbot_with_napcat/02-deployment.yaml new file mode 100644 index 000000000..53bf98db2 --- /dev/null +++ b/k8s/astrbot_with_napcat/02-deployment.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: astrbot-stack + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + replicas: 1 + strategy: + type: Recreate # Use Recreate strategy for stateful applications + selector: + matchLabels: + app: astrbot-stack + template: + metadata: + labels: + app: astrbot-stack + spec: + containers: + - name: napcat + image: mlikiowa/napcat-docker:latest + imagePullPolicy: IfNotPresent + env: + - name: NAPCAT_UID + value: "1000" + - name: NAPCAT_GID + value: "1000" + - name: MODE + value: "astrbot" + ports: + - containerPort: 6099 + name: napcat-web + volumeMounts: + - name: shared-data + mountPath: /AstrBot/data + - name: napcat-config + mountPath: /app/napcat/config + - name: napcat-qq + mountPath: /app/.config/QQ + + - name: astrbot + image: soulter/astrbot:latest + imagePullPolicy: IfNotPresent + env: + - name: TZ + value: "Asia/Shanghai" + ports: + - containerPort: 6185 + name: astrbot-web + volumeMounts: + - name: shared-data + mountPath: /AstrBot/data + + volumes: + - name: shared-data + persistentVolumeClaim: + claimName: astrbot-data-shared-pvc + - name: napcat-config + persistentVolumeClaim: + claimName: napcat-config-pvc + - name: napcat-qq + persistentVolumeClaim: + claimName: napcat-qq-pvc \ No newline at end of file diff --git a/k8s/astrbot_with_napcat/03-service-nodeport.yaml b/k8s/astrbot_with_napcat/03-service-nodeport.yaml new file mode 100644 index 000000000..2bd2f333c --- /dev/null +++ b/k8s/astrbot_with_napcat/03-service-nodeport.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: astrbot-service-nodeport + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + type: NodePort + selector: + app: astrbot-stack + ports: + - name: napcat-web + port: 6099 + targetPort: 6099 + # nodePort: 30099 # Optional: Specify a fixed NodePort if needed, otherwise remove this line + - name: astrbot-web + port: 6185 + targetPort: 6185 + # nodePort: 30185 # Optional: Specify a fixed NodePort if needed, otherwise remove this line \ No newline at end of file diff --git a/k8s/astrbot_with_napcat/04-service-loadbalancer.yaml b/k8s/astrbot_with_napcat/04-service-loadbalancer.yaml new file mode 100644 index 000000000..b519b3c9b --- /dev/null +++ b/k8s/astrbot_with_napcat/04-service-loadbalancer.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: astrbot-service-lb + namespace: astrbot-ns + labels: + app: astrbot-stack +spec: + type: LoadBalancer + selector: + app: astrbot-stack + ports: + - name: napcat-web + port: 6099 + targetPort: 6099 + - name: astrbot-web + port: 6185 + targetPort: 6185 \ No newline at end of file