sudo apt install npm
sudo docker pull mongo
sudo docker run \
-p 27017:27017 \
-v /home/xindaqi/software/mongodb/config:/data/configdb/ \
-v /home/xindaqi/software/mongodb/data:/data/db/ \
-d mongo --auth
sudo docker ps
sudo docker exec -it e2bccd98ac83 mongo admin
db.createUser({ user: 'admin', pwd: 'admin123456', roles: [ { role: "root", db: "admin" } ] });
db.auth("admin", "admin123456")
作为config.json中MongoDB的配置。
db.createUser({
user: 'yapi',
pwd: 'test123456',
roles: [
{ role: "dbAdmin", db: "yapi" },
{ role: "readWrite", db: "yapi" }
]
});
https://github.com/YMFE/yapi.git
(1)文件夹名称为yapi-master,修改名称为vendors;
(2)删除package-lock.json。
新建:/home/xindaqi/software/yapi
将vendors放在yapi文件夹下。
从vendors文件夹下复制:config-example.json
到yapi文件夹下,修改名称为:config.json
修改后的文件结构为:
yapi
├── config.json
└── vendors
├── CHANGELOG.md
├── client
├── common
├── config_example.json
├── config_run.json
├── docs
├── exts
├── LICENSE
├── nodemon.json
├── npm-publish.js
├── package.json
├── plugin.json
├── README.md
├── SECURITY.md
├── server
├── static
├── test
├── webpack.alias.js
├── yapi-base-flow.jpg
├── ydocfile.js
├── ydoc.js
└── ykit.config.js
配置文件:config.json
{
"port": "3000",
"adminAccount": "[email protected]",
"timeout":120000,
"db": {
"servername": "127.0.0.1",
"DATABASE": "yapi",
"port": 27017,
"user": "yapi",
"pass": "test123456",
"authSource": "admin"
},
"mail": {
"enable": false,
"host": "smtp.163.com",
"port": 465,
"from": "***@163.com",
"auth": {
"user": "***@163.com",
"pass": "*****"
}
}
}
进入yapi-run。
cd vendors
npm install --production --registry https://registry.npm.taobao.org
npm run install-server
默认用户名和密码:
序号 | 属性 | 描述 |
---|---|---|
1 | 用户名 | [email protected] |
2 | 密码 | ymfe.org |
node server/app.js
默认用户名和密码:
序号 | 属性 | 描述 |
---|---|---|
1 | 用户名 | [email protected] |
2 | 密码 | ymfe.org |
待完善
【参考文献】
[1]https://hellosean1025.github.io/yapi/devops/index.html
[2]https://www.cnblogs.com/ylty/p/13073126.html