From 474861b07517d34f8e70e1763ea7941b00f7480c Mon Sep 17 00:00:00 2001 From: liuxiaohua Date: Fri, 3 Jan 2025 14:53:33 +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 --- ...YAPI安装教程.md => 20250103-YApi部署指南.md} | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) rename 教程/{20241231-YAPI安装教程.md => 20250103-YApi部署指南.md} (75%) diff --git a/教程/20241231-YAPI安装教程.md b/教程/20250103-YApi部署指南.md similarity index 75% rename from 教程/20241231-YAPI安装教程.md rename to 教程/20250103-YApi部署指南.md index 025dc39..e04b249 100644 --- a/教程/20241231-YAPI安装教程.md +++ b/教程/20250103-YApi部署指南.md @@ -59,7 +59,7 @@ cp vendors/config_cp.json ./config.json ```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/ @@ -68,10 +68,10 @@ RUN mv /yapi/vendors/config_cp.json /yapi/config.json RUN npm config set registry https://registry.npmmirror.com - # 构建 yapi +#-构建 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 @@ -107,7 +107,7 @@ docker run -d --rm \ -v $PWD/config.json:/yapi/config.json \ qifu-base-yapi:1.0.0 \ server/install.js - # 初始化管理员账号在上面的 config.json 配置中 hexiaohei1024@gmail.com,初始密码是 ymfe.org,可以登录后进入个人中心修改 +#-初始化管理员账号在上面的 config.json 配置中 hexiaohei1024@gmail.com,初始密码是 ymfe.org,可以登录后进入个人中心修改 ``` ### 启动 YApi @@ -148,26 +148,26 @@ docker run -d \ ### YAPI 安装启动 ```shell - # 配置淘宝镜像 +#-配置淘宝镜像 npm config set registry https://registry.npmmirror.com - # 安装windows构建工具, windows 才需要 - ##npm install --g --production windows-build-tools +#-安装windows构建工具, windows 才需要 +##-npm install --g --production windows-build-tools - # 构建 yapi +#-构建 yapi mkdir yapi - # 进入文件夹 +#-进入文件夹 cd yapi - # 或者下载 zip 包解压到 vendors 目录(clone 整个仓库大概 140+ M,可以通过 `git clone --depth=1 https://github.com/YMFE/yapi.git vendors` 命令减少,大概 10+ M) +#-或者下载 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 install --production --unsafe-perm=true --allow-root --registry https://registry.npmmirror.com +#-安装程序会初始化数据库索引和管理员账号,管理员账号名可在 config.json 配置 npm run install-server - # 启动服务器后,请访问 127.0.0.1:{config.json配置的端口},初次运行会有个编译的过程,请耐心等候 +#-启动服务器后,请访问 127.0.0.1:{config.json配置的端口},初次运行会有个编译的过程,请耐心等候 node server/app.js ``` @@ -182,30 +182,30 @@ node server/app.js - 执行编译 ```shell - # 2.0 进入工作目录 +#-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 +#-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工具 +#-2.2 安装ykit工具 npm install -g ykit --registry https://registry.npmmirror.com - # 2.3 安装yapi-plugin-kc-oidc +#-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 +##-或者不用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 +#-2.4 开始编译 +##-cd yapi/vendors +##-linux npm run build-client - ## windows - ### set NODE_ENV=production - ### ykit pack -m +##-windows +###-set NODE_ENV=production +###-ykit pack -m ``` ## 配置文件