You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
dustoair 1834fe628e
add mysql record
3 years ago
global add mysql record 3 years ago
handle add mysql record 3 years ago
third_part RandMapValue 3 years ago
utils random file 3 years ago
.gitignore wechat gateway 3 years ago
Dockerfile wechat gateway 3 years ago
application-dev.yaml add mysql record 3 years ago
go.mod add mysql record 3 years ago
main.go add mysql record 3 years ago
readme.md yaml upgrade 3 years ago

readme.md

接收消息与事件

https://developer.work.weixin.qq.com/document/10514

微信消息加解密库 https://github.com/go-laoji/wxbizmsgcrypt

https://github.com/easychen/wecomchan/blob/main/go-wecomchan/wecomchan.go

build arm64 on oracle k8s

cd /root
rm -rf WechatGateWay
git clone https://git.sre.ink/go/WechatGateWay.git
cd WechatGateWay
/bin/cp -arf /root/wx.yaml application.yaml
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on  go mod tidy
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on  go build -v -a -o wechat.bin main.go
/bin/cp -arf /usr/bin/kubectl .
/bin/cp -arf /root/.kube/config .
docker build -t sre/wechatgateway:arm64 .
kubectl rollout restart deployment -n sre wehcat-gateway

k8s

---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations: {}
  labels:
    app/name: wehcat-gateway
  name: wehcat-gateway
  namespace: sre
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app/name: wehcat-gateway
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app/name: wehcat-gateway
    spec:
      containers:
        - image: 'sre/wechatgateway:arm64'
          imagePullPolicy: IfNotPresent
          name: wehcat-gateway
          ports:
            - containerPort: 8080
              name: http
              protocol: TCP
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /app/data
              name: volume-x6hei
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
        - hostPath:
            path: /data/wx-data
            type: Directory
          name: volume-x6hei

---
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  labels:
    app/name: wehcat-gateway
  name: wehcat-gateway
  namespace: sre
spec:
  ports:
    - name: http
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app/name: wehcat-gateway
  sessionAffinity: None
  type: ClusterIP


ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-ip2region
  namespace: sre
  annotations:
    kubernetes.io/ingress.class: "nginx" # 自动签发开关
    cert-manager.io/cluster-issuer: "letsencrypt-prod-http01"   # 自动签发开关
spec:
  tls:
  - hosts:
    - test.com
    secretName: ingress-tls-test-com # 需要修改
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        backend:
          service:
            name: ipregion
            port: 
              number: 8080
        pathType: ImplementationSpecific