From c72ce1196eb788b83fcf6dfc0412e9789d2a79c5 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 7 Jul 2023 17:06:03 +0800 Subject: [PATCH 1/2] add cfg.yml --- etc/cfg.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 etc/cfg.yml diff --git a/etc/cfg.yml b/etc/cfg.yml new file mode 100644 index 0000000..b88e2f5 --- /dev/null +++ b/etc/cfg.yml @@ -0,0 +1,38 @@ +# 当前域名 +debug: true +curldebug: true +prd: false +local: true +# 服务器参数 +srv_addr: ':5001' +# 缓存 +redis_addr: '47.108.198.174:6379' + +app_comm: + # 本模块外网地址 + outer_url: http://127.0.0.1:5003 + +# 连接官网数据库获取db mapping +db: + host: '47.108.198.174:3306' + name: 'one_item_one_code' + user: 'root' + psw: 'sanhu' + show_log: true + max_lifetime: 30 + max_open_conns: 100 + max_idle_conns: 100 + path: 'tmp/%s.log' + +# 日志 +log: + app_name: 'applet' + level: 'debug' # 普通日志级别 #debug, info, warn, fatal, panic + is_stdout: true + time_format: 'standard' # sec, second, milli, nano, standard, iso + encoding: 'console' + is_file_out: true + file_dir: './tmp/' + file_max_size: 256 + file_max_age: 1 + file_name: 'debug.log' From 69dddc5120c7fdbf6e59fe7aaaf63592d6922eee Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sat, 8 Jul 2023 00:00:54 +0800 Subject: [PATCH 2/2] add k8s ... yaml --- etc/cfg.yml | 2 +- k8s/ingress-dev.yaml | 17 +++++++ k8s/zhimeng-configmap_dev.yaml | 83 ++++++++++++++++++++++++++++++ k8s/zhimeng-deployment_dev.yaml | 90 +++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 k8s/ingress-dev.yaml create mode 100644 k8s/zhimeng-configmap_dev.yaml create mode 100644 k8s/zhimeng-deployment_dev.yaml diff --git a/etc/cfg.yml b/etc/cfg.yml index b88e2f5..5dadd9f 100644 --- a/etc/cfg.yml +++ b/etc/cfg.yml @@ -4,7 +4,7 @@ curldebug: true prd: false local: true # 服务器参数 -srv_addr: ':5001' +srv_addr: ':5600' # 缓存 redis_addr: '47.108.198.174:6379' diff --git a/k8s/ingress-dev.yaml b/k8s/ingress-dev.yaml new file mode 100644 index 0000000..8bef21f --- /dev/null +++ b/k8s/ingress-dev.yaml @@ -0,0 +1,17 @@ +kind: Ingress +apiVersion: extensions/v1beta1 +metadata: + name: zhimeng # ingress名称 + namespace: develop + annotations: + kubesphere.io/creator: dengbiao +spec: + rules: + - host: zhimeng.izhyin.com # 使用的域名 + http: + paths: + - path: / + pathType: ImplementationSpecific + backend: + serviceName: zhimeng # 流量转发到的服务 + servicePort: 80 \ No newline at end of file diff --git a/k8s/zhimeng-configmap_dev.yaml b/k8s/zhimeng-configmap_dev.yaml new file mode 100644 index 0000000..785441b --- /dev/null +++ b/k8s/zhimeng-configmap_dev.yaml @@ -0,0 +1,83 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: zhimeng-cfg + namespace: zhios + annotations: + kubesphere.io/creator: dengbiao + kubesphere.io/description: 智盟 +data: + cfg.yml: |- + # 当前域名 + debug: true + curldebug: true + prd: true + local: false + # 服务器参数 + srv_addr: ':5600' + # 缓存 + redis_addr: 'redis:6379' + + admin: + url: http://zhios-admin + iurl: http://zhios-admin + api_aes_key: e{&[^Ft(.~g]1eR-]VO + api_aes_iv: ZV`7<5X]/2brS@sz + + zhios_open: + url: http://zhios-open:5006 + + supply: + url: http://supply-chain-admin:5500 + + official: + url: http://zhios-official + + wxapplet_filepath: + url: '/etc/zyos-admin/wx_check_file' + + app_comm: + url: http://zhios-app-comm:5003 + + website_backend: + url: http://zhios-super-admin + + zhios_pay: + url: http://pay.zhios.cn + + db: + host: 'polardb' + name: 'zyos_website' + user: 'zhios' + psw: 'ZHIoscnfnuo123@' + show_log: true + max_lifetime: 30 + max_open_conns: 100 + max_idle_conns: 100 + path: 'tmp/%s.log' + + # 日志 + log: + app_name: 'applet' + level: 'debug' # 普通日志级别 #debug, info, warn, fatal, panic + is_stdout: true + time_format: 'standard' # sec, second, milli, nano, standard, iso + encoding: 'console' + is_file_out: true + file_dir: './tmp/' + file_max_size: 256 + file_max_age: 1 + file_name: 'debug.log' + + # 连接RabbitMq + mq: + host: '116.62.62.35' + port: '5672' + user: 'zhios' + pwd: 'ZHIoscnfnuo123' + + # 连接ElasticSearch + es: + url: 'http://120.55.48.175:9200' + user: 'elastic' + pwd: 'fnuo123' \ No newline at end of file diff --git a/k8s/zhimeng-deployment_dev.yaml b/k8s/zhimeng-deployment_dev.yaml new file mode 100644 index 0000000..db166f1 --- /dev/null +++ b/k8s/zhimeng-deployment_dev.yaml @@ -0,0 +1,90 @@ +kind: Deployment +apiVersion: apps/v1 +# 元数据 +metadata: + name: zhimeng + namespace: develop + labels: + app: zhimeng + annotations: + kubesphere.io/creator: dengbiao + kubesphere.io/description: 智盟 +# deployment主要部分 +spec: + replicas: 1 + selector: + matchLabels: + # 名称与上面的labels对应 + app: zhimeng + template: + metadata: + labels: + # 名称与上面的matchLabels对应 + app: zhimeng + spec: + # 声明挂载卷(将外部已存在的pvc、config等挂载进来) + volumes: + # 用于时区校正 + - name: host-time + hostPath: + path: /etc/localtime + type: '' + # 将前面创建的configMap也挂载进来 + - name: zhimeng-cfg + configMap: + # 这里的名字就是前面创建的configMap的名字 + name: zhimeng-cfg + defaultMode: 420 + # pvc + - name: zhimeng # 在该部署中的名称,后面使用改名称挂载 + persistentVolumeClaim: + claimName: zhimeng # pvc的名称 + # Nginx配置 + - name: zhimeng-nginx + configMap: + name: zhimeng-nginx # 外部configMap的名称 + items: + - key: go.conf + path: default.conf + containers: + # 主容器 + - name: zhios-zhimeng-container + # 镜像地址(提前打包好并推送的镜像仓库) + image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/zhimeng:0.0.1' + ports: + - name: tcp-5600 + # 容器端口号(注意与golang web server启动的端口一致) + containerPort: 5600 + protocol: TCP + # 将前面volume声明的需要用到的pvc、config挂载上来 + volumeMounts: + - name: host-time + readOnly: true + mountPath: /etc/localtime + - name: zhimeng-cfg # 该名字对应前面volumes声明的名字 + readOnly: true + # 挂载到容器的哪个路径 + mountPath: /var/zyos + imagePullPolicy: Always + # Nginx 容器 + - name: container-nginx + image: nginx + ports: + - name: http-80 + containerPort: 80 + protocol: TCP + volumeMounts: + # 时区校正 + - name: host-time + readOnly: true + mountPath: /etc/localtime + # 存储卷 用于存放前端代码 + - name: zhimeng # 前面volumes声明的名称 + mountPath: /usr/share/nginx/html + - name: zhimeng-nginx # Nginx 配置 + readOnly: true + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + restartPolicy: Always + terminationGracePeriodSeconds: 30 + dnsPolicy: ClusterFirst \ No newline at end of file