From bb5c415153f90e6ad1bea52da7decdbab607e989 Mon Sep 17 00:00:00 2001 From: liuxiaohua Date: Fri, 3 Jan 2025 14:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[2025-01-03]=20=E6=B7=BB=E5=8A=A0ya?= =?UTF-8?q?pi=E9=83=A8=E7=BD=B2=E6=8C=87=E5=8D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 任务/今日任务.md | 43 +++-- 任务/周报.md | 24 +++ 教程/20241231-YAPI安装教程.md | 259 ++++++++++++++++++++++++++++ 教程/20250102-YEARNING安装.md | 21 +++ 教程/20250103-Docker配置镜像加速.md | 76 ++++++++ 杂项/test.http | 17 ++ 杂项/test.json | 84 ++++----- 7 files changed, 459 insertions(+), 65 deletions(-) create mode 100644 教程/20241231-YAPI安装教程.md create mode 100644 教程/20250102-YEARNING安装.md create mode 100644 教程/20250103-Docker配置镜像加速.md create mode 100644 杂项/test.http diff --git a/任务/今日任务.md b/任务/今日任务.md index e589bf5..a972dab 100644 --- a/任务/今日任务.md +++ b/任务/今日任务.md @@ -11,9 +11,16 @@ - [ ] 错误映射 - [ ] 对接流程图 - [X] github ci/cd 文档发布 +- [ ] 日志格式强化 ## 20241230 - 20250103 - [ ] ocr识别名片、语音转文字 这些先调研一下。后面会有相关的开发任务。 +- [ ] 开源支持SSO的管理后台 +- [ ] 企赋网关 + - [ ] 公司映射管理 + - 导入模板 + - 导入接口 + - 查询接口 ## 20241219 - 20241227 - [X] Soular 平台部署 @@ -26,22 +33,28 @@ - Affine - [zyplayer-doc](https://gitee.com/dromara/zyplayer-doc) - [ ] 开源支持SSO的管理后台 -- [ ] 开源 IAM +- [X] 开源 IAM - [keycloak](https://blog.csdn.net/qq_31532979/article/details/140794828) - [Keycloak Doc](https://keycloak.java.net.cn/guides) - [X] Keycloak 集成 LDAP - [X] jenkins 整合 Keycloak 实现 SSO -- [X] 企业微信登录集成(产研平台) - [X] SSO 技术方案编写 -- [ ] Gitlab webhook merge 集成企业微信推送 + - [元盟全域SSO方案](http://confluence.qifu.com/pages/viewpage.action?pageId=38507359) +- [X] Gitlab webhook merge 集成企业微信推送 + - [Gitlab地址](http://git.keyfil.com/saas-back-end/cloud-webhook-gitlab) + - [使用说明](http://confluence.qifu.com/pages/viewpage.action?pageId=38507650) - [X] Keycloak 集成企微登录可能性调研 - [使用企业微信登录Keycloak](https://www.kkzxak47.com/2019/07/30/%E4%BD%BF%E7%94%A8%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E7%99%BB%E5%BD%95keycloak/) - [Keycloak开发](https://wener.me/notes/service/auth/keycloak/dev) +- [X] Keycloak 集成企微IDP + - [Gitlab地址](http://git.keyfil.com/qifu-gateway/keycloak-justauth) - [X] 企微作为首选登录项(管理后台配置) - [X] 企微主题自定义(Icon图标) -- [ ] 企赋网关重构(模块划分) -- [ ] 完善对接文档 +- [X] 企业微信登录集成(企赋网关) +- [X] 企赋网关重构(模块划分) +- [X] 产研协同平台企微登录方案 + - [产研协同平台企微登录方案](http://confluence.qifu.com/pages/viewpage.action?pageId=38507582) ## 20241216 - 20241220 - [X] Track123 对接 @@ -60,23 +73,23 @@ - 强制远程同步更新接口 ## 20241120 -- [ ] Canal 搭建 -- [ ] Kafka 搭建 +- [X] Canal 搭建 +- [X] Kafka 搭建 ## 20241119 -- [ ] Dolphinscheduler 整合 Datax 实现数据同步 -- [ ] 了解数仓相关 +- [X] Dolphinscheduler 整合 Datax 实现数据同步 +- [X] 了解数仓相关 ## 20241118 -- [ ] 数仓方案 -- [ ] Dolphinscheduler 伪集群搭建 -- [ ] Dolphinscheduler 体验 +- [X] 数仓方案 +- [X] Dolphinscheduler 伪集群搭建 +- [X] Dolphinscheduler 体验 ## 20241115 -- [ ] 实现追踪注册功能 -- [ ] 实现内部物流追踪查询功能 -- [ ] 梳理 Aspect 到 Manager +- [X] 实现追踪注册功能 +- [X] 实现内部物流追踪查询功能 +- [X] 梳理 Aspect 到 Manager - [X] 物流供应商映射表(快递100,17TRACK等) ## 20241114 diff --git a/任务/周报.md b/任务/周报.md index e2b1733..2dfc72f 100644 --- a/任务/周报.md +++ b/任务/周报.md @@ -1,3 +1,27 @@ +## 20241230 - 20250103 + +- [X] 完成 yapi oidc 验证 + - [ ] [YAPI-OIDC文档]() + +## 20241223 - 20241227 + +- [X] SSO 技术方案编写 + - [元盟全域SSO方案](http://confluence.qifu.com/pages/viewpage.action?pageId=38507359) +- [X] Gitlab webhook merge 集成企业微信推送 + - [Gitlab地址](http://git.keyfil.com/saas-back-end/cloud-webhook-gitlab) + - [使用说明](http://confluence.qifu.com/pages/viewpage.action?pageId=38507650) +- [X] Keycloak 集成企微登录可能性调研 + - [使用企业微信登录Keycloak](https://www.kkzxak47.com/2019/07/30/%E4%BD%BF%E7%94%A8%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E7%99%BB%E5%BD%95keycloak/) + - [Keycloak开发](https://wener.me/notes/service/auth/keycloak/dev) +- [X] Keycloak 集成企微IDP + - [Gitlab地址](http://git.keyfil.com/qifu-gateway/keycloak-justauth) +- [X] 企微作为首选登录项(管理后台配置) +- [X] 企微主题自定义(Icon图标) +- [X] 企业微信登录集成(企赋网关) +- [X] 企赋网关重构(模块划分) +- [X] 产研协同平台企微登录方案 + - [产研协同平台企微登录方案](http://confluence.qifu.com/pages/viewpage.action?pageId=38507582) + ## 20241216-20241220 - [X] 能效平台调研 diff --git a/教程/20241231-YAPI安装教程.md b/教程/20241231-YAPI安装教程.md new file mode 100644 index 0000000..025dc39 --- /dev/null +++ b/教程/20241231-YAPI安装教程.md @@ -0,0 +1,259 @@ + + + + + + + + + + + + + +# YApi 部署指南 + +## Docker 安装 + +### 项目准备 + +#### 拉取项目 + +```shell +mkdir yapi + +cd yapi + +git clone https://xxxx.xxxx.xx/yapi.git vendors + +cp vendors/config_cp.json ./config.json +``` + +#### 准备配置文件 `yapi/config.json` + +- [配置文件](#配置文件) + +### 项目结构 + +```dockerfile +- yapi +--- vendors +----- package.json +----- config_cp.json +----- server +----- Dockerfile +--- config.json +``` + +### Dockerfile + +```dockerfile +FROM node:12-alpine3.15 +ENV TZ="Asia/Shanghai" + # 使用阿里云镜像 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories +WORKDIR /yapi/vendors +COPY . /yapi/vendors/ + +RUN mv /yapi/vendors/config_cp.json /yapi/config.json + +RUN npm config set registry https://registry.npmmirror.com + + # 构建 yapi +RUN apk add --no-cache wget python2 make g++ && cd /yapi/vendors && npm set strict-ssl false && npm install --production --registry https://registry.npmmirror.com + + # 插件安装 +RUN npm install -g ykit --registry https://registry.npmmirror.com + +RUN npm install yapi-plugin-kc-oidc --registry https://registry.npmmirror.com + +RUN npm rebuild node-sass --registry https://registry.npmmirror.com + +RUN npm run build-client + +EXPOSE 3000 +ENTRYPOINT ["node"] + +``` + +### 构建镜像 `yapi/vendors` + +```shell +docker build -t qifu-base-yapi:1.0.0 . +``` + +### 启动 YApi + +#### 初始化数据库(可选,这边已有,不需要再执行) + +- **由于之前已经有 YApi 了,所以这一步不需要** +- config.json 在 `yapi` 下 +- 指令跟着实际情况改改 + +```shell +docker run -d --rm \ + --name yapi-init \ + --link mongodb:mongo \ + --net=yapi \ + -v $PWD/config.json:/yapi/config.json \ + qifu-base-yapi:1.0.0 \ + server/install.js + # 初始化管理员账号在上面的 config.json 配置中 hexiaohei1024@gmail.com,初始密码是 ymfe.org,可以登录后进入个人中心修改 +``` + +### 启动 YApi + +- 指令跟着实际情况改改 + +```shell +docker run -d \ + --name yapi \ + --link mongodb:mongo \ + --restart always \ + --net=yapi \ + -p 3000:3000 \ + -v $PWD/config.json:/yapi/config.json \ + qifu-base-yapi:1.0.0 \ + server/app.js +``` + +## 宿主机安装 + +### Nodejs 安装 `版本12` + +- 下载 Nodejs:[下载地址](https://nodejs.org/zh-cn/download) +- 解压 +- 配置环境变量 `/etc/profile` +- 使环境变量生效 `source /etc/profile` + +### Python 安装 + +- python 版本 2.7.18 +- python 安装:https://blog.csdn.net/lsqtzj/article/details/114298091 +- pip 安装:https://www.cnblogs.com/shenfeng/p/install_pip_offline.html + +#### 可能遇到的问题 + +- 可能用得上:https://blog.csdn.net/loovelj/article/details/90274059 + +### YAPI 安装启动 + +```shell + # 配置淘宝镜像 +npm config set registry https://registry.npmmirror.com + # 安装windows构建工具, windows 才需要 + ##npm install --g --production windows-build-tools + + # 构建 yapi +mkdir yapi + # 进入文件夹 +cd yapi + # 或者下载 zip 包解压到 vendors 目录(clone 整个仓库大概 140+ M,可以通过 `git clone --depth=1 https://github.com/YMFE/yapi.git vendors` 命令减少,大概 10+ M) +git clone https://github.com/YMFE/yapi.git vendors + # 复制完成后请修改相关配置 +cp vendors/config_example.json ./config.json +cd vendors + +npm install --production --registry https://registry.npmmirror.com + # npm install --production --unsafe-perm=true --allow-root --registry https://registry.npmmirror.com + # 安装程序会初始化数据库索引和管理员账号,管理员账号名可在 config.json 配置 +npm run install-server + # 启动服务器后,请访问 127.0.0.1:{config.json配置的端口},初次运行会有个编译的过程,请耐心等候 +node server/app.js +``` + +### YAPI OIDC 配置 + +可以参考:https://www.npmjs.com/package/yapi-plugin-kc-oidc?activeTab=readme + +- config.json 添加配置 `plugins` 节点 + +- [配置文件](#配置文件) + +- 执行编译 + +```shell + # 2.0 进入工作目录 +cd yapi/vendors + + # 2.1 安装所有依赖包 + ## 安装过程中可能出现node-sass报错,替换到新的版本就可解决,比如我将"node-sass": "^4.9.0" 替换成了 "node-sass": "^4.14.0" + ## sed -i s/'"node-sass": "^4.9.0"'/'"node-sass": "^4.14.0"'/ package.json +npm install --registry https://registry.npmmirror.com + + # 2.2 安装ykit工具 +npm install -g ykit --registry https://registry.npmmirror.com + + # 2.3 安装yapi-plugin-kc-oidc +npm install yapi-plugin-kc-oidc --registry https://registry.npmmirror.com + ## 或者不用npm安装,自己去git clone代码 + ## cd node_modules && git clone --depth 1 https://gitee.com/joshu/yapi-plugin-kc-oidc.git + + # 2.4 开始编译 + ## cd yapi/vendors + ## linux +npm run build-client + + ## windows + ### set NODE_ENV=production + ### ykit pack -m +``` + +## 配置文件 + +```json +{ + "port": "3000", + "adminAccount": "admin@admin.com", + "timeout": 120000, + "db": { + "servername": "127.0.0.1", + "DATABASE": "yapi", + "port": 27017, + "user": "test", + "pass": "test" + }, + "mail": { + "enable": true, + "host": "smtp.163.com", + "port": 465, + "from": "***@163.com", + "auth": { + "user": "***@163.com", + "pass": "*****" + } + }, + "plugins": [ + { + "name": "kc-oidc", + "options": { + "authUrl": "", + "tokenUrl": "", + "userUrl": "", + "callbackUrl": "${host}/api/user/login_by_token", + "clientId": "", + "clientSecret": "", + "scope": "openid email profile phone ", + "userKey": "preferred_username", + "emailPostfix": "@xxx.com" + } + } + ] +} +``` + +- mongodb 没有开启鉴权则删除 `user` 及 `pass` 字段 + +## 参考 + +- [YAPI安装教程](https://blog.csdn.net/IT_ZRS/article/details/118642997) +- [踩坑可查](https://juejin.cn/post/7246596616694317114) \ No newline at end of file diff --git a/教程/20250102-YEARNING安装.md b/教程/20250102-YEARNING安装.md new file mode 100644 index 0000000..c1efe25 --- /dev/null +++ b/教程/20250102-YEARNING安装.md @@ -0,0 +1,21 @@ +## YEARNING + +### YEARNING 安装启动 + +可以参考:https://next.yearning.io/zh/usage/ixah25xr/ + +```shell + +``` + +### YEARNING OIDC 配置 + +可以参考:https://next.yearning.io/zh/usage/boccobus/ + +```shell + +``` + +## 参考 + +- [YAPI安装教程](https://blog.csdn.net/IT_ZRS/article/details/118642997) \ No newline at end of file diff --git a/教程/20250103-Docker配置镜像加速.md b/教程/20250103-Docker配置镜像加速.md new file mode 100644 index 0000000..4f17b3e --- /dev/null +++ b/教程/20250103-Docker配置镜像加速.md @@ -0,0 +1,76 @@ +# Docker 配置镜像加速 + +## Docker-CE 安装配置加速 +- 加速站地址:https://gitee.com/sdlsgitee/open-source-mirror-sites/blob/master/%E5%9B%BD%E5%86%85%E5%BC%80%E6%BA%90%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E9%9B%86%E5%90%88-2023%E5%B9%B42%E6%9C%8812%E6%97%A5%E5%8F%AF%E7%94%A8.md +- 阿里云地址:https://developer.aliyun.com/mirror/?serviceType=&tag=&keyword=docker-ce +```shell +# Add Docker's official GPG key: +sudo apt-get update +sudo apt-get install ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL http://mirrors.163.com/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc + +# Add the repository to Apt sources: +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update + + +# step 1: 安装必要的一些系统工具 +sudo apt-get update +sudo apt-get install ca-certificates curl gnupg + +# step 2: 信任 Docker 的 GPG 公钥 +sudo install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg + +# Step 3: 写入软件源信息 +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +# Step 4: 安装Docker +sudo apt-get update +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +# 安装指定版本的Docker-CE: +# Step 1: 查找Docker-CE的版本: +# apt-cache madison docker-ce +# docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages +# docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages +# Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial) +# sudo apt-get -y install docker-ce=[VERSION] +``` + +## 添加加速镜像地址 `/etc/docker/daemon.json` +```json +{ + "registry-mirrors": [ + "https://docker.zhai.cm", + "https://docker.fxxk.dedyn.io", + "https://docker.5z5f.com", + "https://a.ussh.net", + "https://hub.geekery.cn/", + "https://ghcr.geekery.cn", + "https://registry.dockermirror.com" + ], + "runtimes": { + "nvidia": { + "path": "nvidia-container-runtime", + "runtimeArgs": [] + } + } +} +``` + +## 重启 Docker +```shell +systemctl daemon-reload + +systemctl restart docker +``` \ No newline at end of file diff --git a/杂项/test.http b/杂项/test.http new file mode 100644 index 0000000..debc12f --- /dev/null +++ b/杂项/test.http @@ -0,0 +1,17 @@ +### 忘记密码 +POST http://linkwarden.texous.cn/api/v1/auth/forgot-password +Content-Type: application/json + +{ + "token": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..J40YqKzue9W0DhH5.ujXtU3MRZB3ALYN1LRhTvB4eOYyl41wfO5uw4ca3CpWTxbeB4xgLHivTIYTnsJkXB_3caXgcXT1Iirt4vcMrfo8RDBW9iPEFxjlwJ7ntlToRp1QXnOe2.NtukWgE-EoaoCuJOLGvPQQ", + "password": "liu@Texous.com" +} + +### 重置密码 +POST http://linkwarden.texous.cn/api/v1/auth/reset-password +Content-Type: application/json + +{ + "token": "8e07fe4a315366f5f67c45da8d3acadffbd6e216168e015da41ad8ee5b9a36ba%7C393ac3b0565395f36ec279f453aa460a7e530c504dc69fa3c2c055ce118e0175", + "password": "liu@Texous.com" +} \ No newline at end of file diff --git a/杂项/test.json b/杂项/test.json index a041b00..ad4e617 100644 --- a/杂项/test.json +++ b/杂项/test.json @@ -1,51 +1,35 @@ { - "id": 11511967, - "createUserId": 1383666, - "createTime": 1734343259, - "createBy": "lijinfeng", - "deleted": 0, - "indexCode": "scm_agency_order", - "tenantId": 7, - "customerId": 1373084, - "customerName": "客户3", - "code": "A2024121600001", - "status": "PLACED_ORDER", - "splitStatus": 0, - "vouchingStatus": 0, - "transportAcceptStatus": 0, - "intoWarehouseStatus": 0, - "customsClearanceStatus": 50, - "customsLiquidationStatus": 50, - "accountReceivableStatus": 0, - "accountPayableStatus": 0, - "taxInclusiveStatus": 0, - "needTransport": 1, - "needCheckGoods": 1, - "needInspectionGoods": 1, - "supplierSupportDelivery": 0, - "orderingGoodsTime": 1734342996, - "currency": "CNY", - "transportPrecondition": 0, - "deposit": 0.01, - "depositRatio": 1.0, - "depositCalType": 0, - "depositType": 1, - "balancePayment": 0.99, - "balancePaymentCalType": 0, - "balancePaymentRatio": 99.0, - "balancePaymentType": 1, - "brokerage": 0.01, - "brokerageRatio": 1.0, - "brokerageType": 0, - "creatorOrgId": 1188409, - "creatorOrgName": "美丽无线公司", - "trackerList": "[{\"trackerId\":1383666,\"trackerName\":\"lijinfeng\"}]", - "bizUnitId": 1188412, - "shipmentStatus": 0, - "exceptionFlag": 0, - "addressInputType": 2, - "settleStatus": 0, - "packSkuRelated": 0, - "region": "{\"regionCountryId\": null, \"regionCountryName\": null}", - "draftTag": 0 -} + "port": "3000", + "adminAccount": "admin@admin.com", + "timeout": 120000, + "db": { + "servername": "127.0.0.1", + "DATABASE": "yapi", + "port": 27017 + }, + "mail": { + "enable": true, + "host": "smtp.163.com", + "port": 465, + "from": "***@163.com", + "auth": { + "user": "***@163.com", + "pass": "*****" + } + }, + "plugins": [ + { + "name": "kc-oidc", + "options": { + "authUrl": "http://keycloak.qifu.com/realms/keyfil/protocol/openid-connect/auth", + "tokenUrl": "http://keycloak.qifu.com/realms/keyfil/protocol/openid-connect/token", + "userUrl": "http://keycloak.qifu.com/realms/keyfil/protocol/openid-connect/userinfo", + "callbackUrl": "http://127.0.0.1:3000/api/user/login_by_token", + "clientId": "local-yapi", + "clientSecret": "el90jCvGjFupwQ6jE778odKRorFrlnhe", + "scope": "openid email profile phone ", + "emailPostfix": "@keyfil.com" + } + } + ] +} \ No newline at end of file