kind: ConfigMap apiVersion: v1 metadata: name: archery-config namespace: tools labels: app.kubernetes.io/name: archery data: init-archery.sh: |- #!/bin/bash mkdir -p /opt/archery/downloads/{binlog2sql,log,schemasync} cd /opt/archery echo 切换python运行环境 source /opt/venv4archery/bin/activate python3 manage.py makemigrations sql python3 manage.py migrate -v 3 #数据初始化 python3 manage.py dbshell{client}=\$event->{ip} " \ $slowquery_file > /tmp/analysis_slow_query.log echo `date +"%Y-%m-%d %H:%M:%S"`>last_analysis_time_$hostname local_settings.py: |- # -*- coding: UTF-8 -*- # override your configs here soar.yaml: |- # 是否允许测试环境与线上环境配置相同 allow-online-as-test: false # 是否清理测试时产生的临时文件 drop-test-temporary: true # 语法检查小工具 only-syntax-check: false sampling-data-factor: 100 sampling: false sampling-statistic-target: 100 profiling: false trace: false # 日志级别,[0:Emergency, 1:Alert, 2:Critical, 3:Error, 4:Warning, 5:Notice, 6:Informational, 7:Debug] log-level: 3 log-output: /opt/archery/logs/soar.log # 优化建议输出格式 report-type: markdown ignore-rules: - "" # 启发式算法相关配置 max-join-table-count: 5 max-group-by-cols-count: 5 max-distinct-count: 5 max-index-cols-count: 5 max-total-rows: 9999999 spaghetti-query-length: 2048 allow-drop-index: false # EXPLAIN相关配置 explain-sql-report-type: pretty explain-type: extended explain-format: traditional explain-warn-select-type: - "" explain-warn-access-type: - ALL explain-max-keys: 3 explain-min-keys: 0 explain-max-rows: 10000 explain-warn-extra: - "" explain-max-filtered: 100 explain-warn-scalability: - O(n) query: "" list-heuristic-rules: false list-test-sqls: false verbose: true --- apiVersion: v1 kind: Service metadata: name: archery namespace: tools labels: app.kubernetes.io/name: archery spec: type: ClusterIP ports: - port: 9123 targetPort: 9123 protocol: TCP name: archery selector: app.kubernetes.io/name: archery app.kubernetes.io/instance: archery --- apiVersion: apps/v1 kind: Deployment metadata: name: archery namespace: tools labels: app.kubernetes.io/name: archery spec: replicas: 1 selector: matchLabels: app.kubernetes.io/name: archery app.kubernetes.io/instance: archery template: metadata: labels: app.kubernetes.io/name: archery app.kubernetes.io/instance: archery spec: initContainers: - name: init-archery #image: "harbor.uenpay.com/base/archery:1.9.1-liushuai" image: "registry.cn-hangzhou.aliyuncs.com/zhengyu1992/archery:1.9.1-zy" imagePullPolicy: IfNotPresent env: - name: DATABASE_URL value: mysql://root:Blala008!@mysql-archery:3306/archery - name: CACHE_URL value: redis://redis-archery:6379/0 - name: DINGDING_CACHE_URL value: redis://redis-archery:6379/1 command: ['/bin/bash','/opt/archery/src/docker/init-archery.sh'] volumeMounts: - mountPath: /opt/archery/local_settings.py name: archery-settings subPath: local_settings.py - mountPath: /etc/soar.yaml name: archery-settings subPath: soar.yaml - mountPath: /opt/archery/src/script/analysis_slow_query.sh name: archery-settings subPath: analysis_slow_query.sh - mountPath: /opt/archery/src/docker/startup.sh name: archery-settings subPath: startup.sh - mountPath: /opt/archery/src/docker/init-archery.sh name: archery-settings subPath: init-archery.sh - mountPath: /opt/archery/src/docker/createsuperuser.py name: archery-settings subPath: createsuperuser.py containers: - name: archery #image: "harbor.uenpay.com/base/archery:1.9.1-liushuai" image: "registry.cn-hangzhou.aliyuncs.com/zhengyu1992/archery:1.9.1-zy" imagePullPolicy: IfNotPresent env: - name: DATABASE_URL value: mysql://root:Blala008!@mysql-archery/archery - name: CACHE_URL value: redis://redis-archery:6379/0 - name: DINGDING_CACHE_URL value: redis://redis-archery:6379/1 ports: - name: archery containerPort: 9123 protocol: TCP livenessProbe: httpGet: path: / port: archery initialDelaySeconds: 180 periodSeconds: 60 timeoutSeconds: 5 successThreshold: 1 failureThreshold: 3 resources: {} volumeMounts: - mountPath: /opt/archery/local_settings.py name: archery-settings subPath: local_settings.py - mountPath: /etc/soar.yaml name: archery-settings subPath: soar.yaml - mountPath: /opt/archery/src/script/analysis_slow_query.sh name: archery-settings subPath: analysis_slow_query.sh - mountPath: /opt/archery/src/docker/startup.sh name: archery-settings subPath: startup.sh - mountPath: /opt/archery/src/docker/init-archery.sh name: archery-settings subPath: init-archery.sh - mountPath: /opt/archery/src/docker/createsuperuser.py name: archery-settings subPath: createsuperuser.py volumes: - configMap: defaultMode: 420 name: archery-config name: archery-settings - hostPath: path: /data/archery/downloads name: archery-download - hostPath: path: /data/archery/scripts name: archery-script --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/proxy-body-size: 1024m nginx.ingress.kubernetes.io/proxy-connect-timeout: '300' nginx.ingress.kubernetes.io/proxy-read-timeout: '300' nginx.ingress.kubernetes.io/proxy-send-timeout: '300' nginx.ingress.kubernetes.io/ssl-redirect: 'false' name: archery.uenpay.com-ingress namespace: tools spec: ingressClassName: nginx rules: - host: archery.uenpay.com http: paths: - backend: service: name: archery port: number: 9123 path: / pathType: Prefix tls: - hosts: - archery.uenpay.com-ingress secretName: uenpay.com