1、Yapi 服务已启动

[root@Tseng-HW ~]# docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED        STATUS          PORTS                                                  NAMES
bec094e7ec66   registry.cn-hangzhou.aliyuncs.com/anoy/yapi   "node server/app.js"     6 weeks ago    Up 13 minutes   0.0.0.0:3001->3000/tcp, :::3001->3000/tcp              yapi
f2348ddaafe9   mongo                                         "docker-entrypoint.s…"   6 weeks ago    Up 29 minutes   27017/tcp                                              yapimongo
[root@Tseng-HW ~]#

2、进入服务

[root@Tseng-HW ~]# docker exec -it yapi sh
/api/vendors #

3、修改config.json文件,创建新的管理员账户

/api/vendors # cd ..
/api # ls
config.json  init.lock    log          vendors
/api # cat config.json 
{
  "port": "3000",
  "adminAccount": "admin@admin.com",
  "db": {
    "servername": "mongo",
    "DATABASE": "yapi",
    "port": 27017
  }
}
/api # vi config.json
/api # cat config.json 
{
  "port": "3000",
  "adminAccount": "tsengadmin@vryuedu.com",
  "db": {
    "servername": "mongo",
    "DATABASE": "yapi",
    "port": 27017
  }
}

4、使新账户生效,并生成初始密码

/api # cd vendors/
/api/vendors # ls
CHANGELOG.md         config_example.json  package-lock.json    webpack.alias.js
LICENSE              docs                 package.json         yapi-base-flow.jpg
README.md            exts                 plugin.json          ydoc.js
X64                  node_modules         server               ydocfile.js
client               nodemon.json         static               ykit.config.js
common               npm-publish.js       test
/api/vendors # npm run install-server

> yapi-vendor@1.8.5 install-server /api/vendors
>  node server/install.js

log: mongodb load success...
初始化管理员账号成功,账号名:"tsengadmin@vryuedu.com",密码:"ymfe.org"
/api/vendors # 

5、重启Yapi Docker 服务

[root@Tseng-HW ~]# docker restart bec094e7ec66
bec094e7ec66
[root@Tseng-HW ~]#

6、重新登录新管理员账户并修改初始密码

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐