Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置YAPI_DB_USER、YAPI_DB_PASS之后,yapi-web运行报错 #103

Open
zippenwang opened this issue Jul 21, 2022 · 2 comments
Open

设置YAPI_DB_USER、YAPI_DB_PASS之后,yapi-web运行报错 #103

zippenwang opened this issue Jul 21, 2022 · 2 comments

Comments

@zippenwang
Copy link

设置了YAPI_DB_USER、YAPI_DB_PASS之后,yapi-web容器貌似无法正常连接上MongoDB,打印如下日志:
error: MongoNetworkError: Authentication failed., mongodb Authentication failed

@xc2f
Copy link

xc2f commented Feb 2, 2023

YAPI_DB_AUTH_SOURCE: admin 这行配置必须要有

version: '3'

services:
  yapi-web:
    image: jayfong/yapi:latest
    container_name: yapi-web
    ports:
      - 9400:3000
    environment:
      YAPI_ADMIN_ACCOUNT: admin@docker.yapi
      YAPI_ADMIN_PASSWORD: adm1n
      YAPI_CLOSE_REGISTER: 'true'
      YAPI_DB_SERVERNAME: yapi-mongo
      YAPI_DB_PORT: 27017
      YAPI_DB_DATABASE: yapi
      YAPI_MAIL_ENABLE: 'false'
      YAPI_LDAP_LOGIN_ENABLE: 'false'
      YAPI_PLUGINS: '[]'
      YAPI_DB_AUTH_SOURCE: admin
      YAPI_DB_USER: root
      YAPI_DB_PASS: 123456
    depends_on:
      - yapi-mongo
    links:
      - yapi-mongo
    restart: unless-stopped
  yapi-mongo:
    image: mongo:latest
    container_name: yapi-mongo
    environment:
      MONGO_INITDB_DATABASE: yapi
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: 123456
    volumes:
      - ./data/db:/data/db
    expose:
      - 27017
    restart: unless-stopped

@eaglepie
Copy link

YAPI_DB_AUTH_SOURCE: admin 这行配置必须要有

version: '3'

services:
  yapi-web:
    image: jayfong/yapi:latest
    container_name: yapi-web
    ports:
      - 9400:3000
    environment:
      YAPI_ADMIN_ACCOUNT: admin@docker.yapi
      YAPI_ADMIN_PASSWORD: adm1n
      YAPI_CLOSE_REGISTER: 'true'
      YAPI_DB_SERVERNAME: yapi-mongo
      YAPI_DB_PORT: 27017
      YAPI_DB_DATABASE: yapi
      YAPI_MAIL_ENABLE: 'false'
      YAPI_LDAP_LOGIN_ENABLE: 'false'
      YAPI_PLUGINS: '[]'
      YAPI_DB_AUTH_SOURCE: admin
      YAPI_DB_USER: root
      YAPI_DB_PASS: 123456
    depends_on:
      - yapi-mongo
    links:
      - yapi-mongo
    restart: unless-stopped
  yapi-mongo:
    image: mongo:latest
    container_name: yapi-mongo
    environment:
      MONGO_INITDB_DATABASE: yapi
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: 123456
    volumes:
      - ./data/db:/data/db
    expose:
      - 27017
    restart: unless-stopped

按照这个来是可以的,谢谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants