97 lines
1.9 KiB
Markdown
97 lines
1.9 KiB
Markdown
|
[![MIT Licence](https://img.shields.io/github/license/jinfeijie/yapi.svg?style=flat-square)](https://opensource.org/licenses/mit-license.php)
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## ⚠️注意
|
|||
|
|
|||
|
本仓库目前只支持安装,暂不支持升级,请知晓。如需升级请自行备份mongoDB内的数据。
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## 构建镜像
|
|||
|
|
|||
|
克隆本仓库到本地。
|
|||
|
|
|||
|
```
|
|||
|
git clone --depth 1 https://code.simaek.com/xueye/yapi-docker.git
|
|||
|
```
|
|||
|
|
|||
|
执行构建脚本。
|
|||
|
|
|||
|
```
|
|||
|
chmod +x build.sh && ./build.sh
|
|||
|
```
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## docker-compose 部署
|
|||
|
|
|||
|
修改`docker-compose.yml`文件中的相关参数,以下是变量的一些说明。
|
|||
|
|
|||
|
| 环境变量 | 默认值 | 建议 |
|
|||
|
| ------------- |:-------------:|:-----------:|
|
|||
|
| YAPI_PORT | 3000 | 可修改 |
|
|||
|
| ADMIN_EMAIL | master@simaek.com | 建议修改 |
|
|||
|
| DB_HOST | mongo | 不建议修改 |
|
|||
|
| DB_NAME | yapi | 不建议修改 |
|
|||
|
| DB_PORT | 27017 | 不建议修改|
|
|||
|
| MAIL_ENABLE | false | 是否启用邮件功能 |
|
|||
|
| MAIL_HOST | 127.0.0.1 | 邮件服务器地址 |
|
|||
|
| MAIL_PORT | 465 | 邮件服务器端口 |
|
|||
|
| MAIL_FROM | master@simaek.com | 发件人 |
|
|||
|
| MAIL_USER | user | 邮件服务器用户名 |
|
|||
|
| MAIL_PWD | password | 邮件服务器密码 |
|
|||
|
|
|||
|
使用`docker-compose`启动服务。
|
|||
|
|
|||
|
````
|
|||
|
docker-compose up -d
|
|||
|
````
|
|||
|
|
|||
|
访问地址为:`YOU_SERVER_IP:YAPI_PORT`,用户名为`#{ADMIN_EMAIL}`,默认密码为:`ymfe.org`。
|
|||
|
|
|||
|
也可通过Docker的日志查看。
|
|||
|
|
|||
|
```
|
|||
|
docker logs yapi
|
|||
|
```
|
|||
|
|
|||
|
信息如下:
|
|||
|
|
|||
|
```
|
|||
|
> yapi-vendor@1.9.2 install-server /yapi/vendors
|
|||
|
> node server/install.js
|
|||
|
|
|||
|
log: mongodb load success...
|
|||
|
初始化管理员账号成功,账号名:"master@simaek.com",密码:"ymfe.org"
|
|||
|
```
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## Nginx 配置
|
|||
|
|
|||
|
在配置域名访问的时候将很有用。
|
|||
|
|
|||
|
```
|
|||
|
server {
|
|||
|
listen 80;
|
|||
|
server_name domain.com;
|
|||
|
keepalive_timeout 70;
|
|||
|
|
|||
|
location / {
|
|||
|
proxy_pass http://YOU_SERVER_IP:YAPI_PORT;
|
|||
|
}
|
|||
|
location ~ /\. {
|
|||
|
deny all;
|
|||
|
}
|
|||
|
}
|
|||
|
```
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## 支持
|
|||
|
|
|||
|
📧联系[@xueye](xueye404@qq.com)
|
|||
|
|
|||
|
✨欢迎 Star && Fork
|