Skip to content

Commit

Permalink
修改docker-compose.yml, 晚上文档
Browse files Browse the repository at this point in the history
  • Loading branch information
shuweicloud committed Jun 29, 2020
1 parent 73d2d96 commit 1c6f263
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 4 deletions.
Binary file added doc/start-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/start-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ services:
- ./my-yapi:/my-yapi
ports:
- 9090:9090
- 3000:3000
- 3000:3000
depends_on:
- mongo
86 changes: 83 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ docker-compose up
- 修改管理员邮箱 `ryan.miao@demo.com` (随意, 修改为自己的邮箱)
- 修改数据库地址为 `mongo` 或者修改为自己的mongo实例 (docker-compose配置的mongo服务名称叫mongo)
- 打开数据库认证
- 输入数据库用户名: `yapi`
- 输入密码: `yapi123456`
- 输入数据库用户名: `yapi`(mongo配置的用户名, 见mongo-conf/init-mongo.js)
- 输入密码: `yapi123456`(mongo配置的密码, 见mongo-conf/init-mongo.js)

点击开始部署.

Expand Down Expand Up @@ -53,12 +53,41 @@ docker-compose up

访问 localhost:3000

- 输入用户名ryan.miao@demo.com(自己输入的管理员邮箱)
- 输入密码ymfe.org(默认的初始化密码, 之后可以修改)

然后可以导入一个swagger的接口数据试试:

![](doc/start-1.jpg)
![](doc/start-2.jpg)


3. 后台启动

前台启动确认没问题后, 直接
```
docker-compose stop或者contrl+C
docker-compose up -d
```


## 数据备份

所有数据都在mongo中, 理论上建议使用自己搭建的mongo实例, 这里docker的mongo也可以使用, 只要备份本mongo数据即可.

可以使用mongodb的备份方式, 也可以直接备份mongo/data.


## 版本升级

可以看出, 只要重新找个机器部署一遍, 然后导入mongo数据即可.


## 一些配置

**关于部署路径**
**部署路径**

容器采用的`node:12-alpine` 这个镜像, yapi部署目录默认为`my-yapi`. 这里已经映射到本地磁盘, 也可以自己挂载想要的数据盘.

在docker-compose中配置了, 本地目录映射到容器目录`my-yapi`

Expand All @@ -68,5 +97,56 @@ docker-compose up
```


**Mongo配置**

本方案直接使用docker-compose的mongo. 定义了初始化脚本init-mongo.js. 修改即可修改账号和密码.


**插件等配置**

已经把yapi部署文件给映射到磁盘了, 该怎么安装就怎么安装.

```
.
├── doc
│   ├── init-2.jpg
│   └── init.jpg
├── docker-compose.yml
├── Dockerfile
├── mongo
│   ├── data
│   │   └── db
│   └── etc
├── mongo-conf
│   └── init-mongo.js
├── my-yapi
│   ├── config.json
│   ├── init.lock
│   ├── log
│   │   └── 2020-6.log
│   └── vendors
│   ├── aa.js
│   ├── CHANGELOG.md
│   ├── client
│   ├── common
│   ├── config_example.json
│   ├── exts
│   ├── LICENSE
│   ├── node_modules
│   ├── nodemon.json
│   ├── npm-publish.js
│   ├── package.json
│   ├── package-lock.json
│   ├── plugin.json
│   ├── README.md
│   ├── server
│   ├── static
│   ├── webpack.alias.js
│   ├── yapi-base-flow.jpg
│   └── ykit.config.js
├── readme.md
└── repositories
```



0 comments on commit 1c6f263

Please sign in to comment.