✨ [2025-01-03] 添加yapi部署指南
All checks were successful
Publish to Confluence / confluence (push) Successful in 37s
All checks were successful
Publish to Confluence / confluence (push) Successful in 37s
This commit is contained in:
parent
bb5c415153
commit
474861b075
@ -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
|
||||
```
|
||||
|
||||
## 配置文件
|
Loading…
x
Reference in New Issue
Block a user