Giter Site home page Giter Site logo

docker-yapi's People

Contributors

ryan-miao avatar shuweicloud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-yapi's Issues

如何安装插件?

问题:

请问如何安装插件?(例如:钉钉)

环境:

  • Yapi 1.9.1
  • 这个仓库的 Dockerfile
  • 插件 钉钉

taobao 镜像是过期了吗,无法安装,如何修改

当前安装版本: 1.12.0
连接数据库成功!
开始下载平台文件压缩包...
http://registry.npm.taobao.org/yapi-vendor/download/yapi-vendor-1.12.0.tgz
部署文件完成,正在安装依赖库...
npm ERR! code CERT_HAS_EXPIRED npm ERR!
errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/ajv failed, reason: certificate has expired
npm
ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2024-03-05T18_22_18_520Z-debug.log
依赖库安装完成,正在初始化数据库mongodb...

[email protected] install-server /my-yapi/vendors > node server/install.js
Error: internal/modules/cjs/loader.js:818 throw err; ^ Error: Cannot find module 'fs-extra' Require stack: - /my-yapi/vendors/server/install.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15) at Function.Module._load (internal/modules/cjs/loader.js:667:27) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/my-yapi/vendors/server/install.js:1:12) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/my-yapi/vendors/server/install.js' ] }

初始化yapi报错

16:32:02 /usr/local/docker-yapi # docker-compose up
WARNING: Found orphan containers (docker-yapi_mongo_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Recreating docker-yapi_yapi_1 ... done
Attaching to docker-yapi_yapi_1
yapi_1 | internal/modules/cjs/loader.js:818
yapi_1 | throw err;
yapi_1 | ^
yapi_1 |
yapi_1 | Error: Cannot find module '/my-yapi/vendors/server/app.js'
yapi_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
yapi_1 | at Function.Module._load (internal/modules/cjs/loader.js:667:27)
yapi_1 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
yapi_1 | at internal/main/run_main_module.js:17:47 {
yapi_1 | code: 'MODULE_NOT_FOUND',
yapi_1 | requireStack: []
yapi_1 | }
docker-yapi_yapi_1 exited with code 1

镜像build了好多次, 模块找不到

internal/modules/cjs/loader.js:818
throw err;
^

Error: Cannot find module '/my-yapi/vendors/server/app.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

镜像build了好多次, 模块找不到

部署yapi v1.7.0,Nginx配置后,仍有问题.

如题,查看日志 报

error: MongoError: Authentication failed., mongodb Authentication failed
log: mongodb load success...
(node:6) UnhandledPromiseRejectionWarning: Error: Cannot read property 'collection' of undefined
    at /api/vendors/server/install.js:151:13
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
(node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

登录一直pending,日志也没有任何反应。

下面是yapi的全部日志
$ docker logs -f 54459a7fc202
log: -------------------------------------swaggerSyncUtils constructor-----------------------------------------------
log: 服务已启动,请打开下面链接访问:
http://127.0.0.1:3000/
error: MongoNetworkError: connect ECONNREFUSED 172.19.0.2:27017, mongodb Authentication failed
log: mongodb load success...
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-advanced-mock/server.js:24:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-statistics/server.js:12:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-wiki/server.js:7:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:1) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

可能存在安全风险

在公司测试服务器部署了大概两年时间,期间被公司安全管理人员两次告知,这个容器启动syscfg系统程序,疯狂占用CPU,并有连接境外IP的行为。
而且在应用的用户管理,有大量自动创建的用户登录凭证。
企业微信截图_1d17161c-f748-43e4-b1d5-851912391eea(1)
企业微信截图_6c46db25-60fc-44eb-aa86-dd144c2acf6a(1)

如何升级

请问需要怎么样升级yapi呢,更换了version似乎不起作用,1.10.2的version还是配置到了1.9.1

数据库链接失败

Error: 连接数据库失败,failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
想问下这个是为什么?

部署失败,报错两个错误,一个错误是yapi.demo.qunar.com失效,一个是无效连接数据库

yapi_1 | 在浏览器打开 http://0.0.0.0:9090 访问。非本地服务器,请将 0.0.0.0 替换成指定的域名或ip
yapi_1 | (node:1) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND yapi.demo.qunar.com
yapi_1 | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
yapi_1 | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
yapi_1 | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
yapi_1 | 当前安装版本: 1.9.2
yapi_1 | Error: 连接数据库失败, failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
yapi_1 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16) {
yapi_1 | name: 'MongoError'
yapi_1 | }]

第一次部署失败,在mongo数据库初始化的时候

`依赖库安装完成,正在初始化数据库mongodb...

[email protected] install-server /my-yapi/vendors > node server/install.js
Error: /my-yapi/vendors/server/utils/commons.js:25 jsf.extend('mock', function () { ^ TypeError: jsf.extend is not a function at Object. (/my-yapi/vendors/server/utils/commons.js:25:5) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/my-yapi/vendors/server/install.js:3:17) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47
`

发现一个使用问题,这两个容器接连重启间隔太短,yapi-web可能会报错连不上mongo

如果用docker-compose重启时会报错
log: -------------------------------------swaggerSyncUtils constructor-----------------------------------------------
log: 服务已启动,请打开下面链接访问:
http://127.0.0.1:3000/
error: MongoNetworkError: connect ECONNREFUSED 172.20.0.2:27017, mongodb Authentication failed
log: mongodb load success...
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-advanced-mock/server.js:24:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-statistics/server.js:12:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'collection' of undefined
at /my-yapi/vendors/exts/yapi-plugin-wiki/server.js:7:38
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:1) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

这个报错,是因为mongo并未启动完成, yapi连接太快, 连接不上.
解决办法:
等几分钟后等mongo启动完成后,再次重启yapi-web容器即可

readme中打开数据库认证 输入数据库用户名: yapi(mongo配置的用户名, 见mongo-conf/init-mongo.js) 输入密码: yapi123456(mongo配置的密码, 见mongo-conf/init-mongo.js)

打开localhost:9090后,没看到有地方可以配置
1、打开数据库认证
2、输入数据库用户名: yapi(mongo配置的用户名, 见mongo-conf/init-mongo.js)
3、输入密码: yapi123456(mongo配置的密码, 见mongo-conf/init-mongo.js)

没有做以上步骤,导致部署失败,看报错是mongodb认证失败
依赖库安装完成,正在初始化数据库mongodb...

[email protected] install-server /my-yapi/vendors > node server/install.js
log: mongodb load success...
Error: (node:209) UnhandledPromiseRejectionWarning: MongoError: command createIndexes requires authentication at Connection. (/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/pool.js:466:61) at Connection.emit (events.js:314:20) at processMessage (/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connection.js:364:10) at Socket. (/my-yapi/vendors/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connection.js:533:15) at Socket.emit (events.js:314:20) at addChunk (_stream_readable.js:298:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) (node:209) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:209) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.