zoukankan      html  css  js  c++  java
  • Docker-compose部署yapi

    参考文档:https://github.com/Ryan-Miao/docker-yapi

    1. 安装docker环境

    2. 安装docker-compose工具

    2.1.下载地址

    https://github.com/docker/compose/releases
    

    2.2.上传到虚拟机的/home/testuser/tmp目录并进入

    [root@localhost tmp]# pwd
    /home/testuser/tmp
    [root@localhost tmp]# ls
    docker-compose-Linux-x86_64  docker-yapi
    [root@localhost tmp]# 
    
    

    2.3.授权使用

    [root@localhost tmp]# cp docker-compose-Linux-x86_64  /usr/local/bin/docker-compose
    [root@localhost tmp]# chmod +x /usr/local/bin/docker-compose
    [root@localhost tmp]# docker-compose 
    Define and run multi-container applications with Docker.
    
    Usage:
      docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
      docker-compose -h|--help
    
    Options:
      -f, --file FILE             Specify an alternate compose file
                                  (default: docker-compose.yml)
      -p, --project-name NAME     Specify an alternate project name
                                  (default: directory name)
      -c, --context NAME          Specify a context name
      --verbose                   Show more output
      --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
      --no-ansi                   Do not print ANSI control characters
      -v, --version               Print version and exit
      -H, --host HOST             Daemon socket to connect to
    
      --tls                       Use TLS; implied by --tlsverify
      --tlscacert CA_PATH         Trust certs signed only by this CA
      --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
      --tlskey TLS_KEY_PATH       Path to TLS key file
      --tlsverify                 Use TLS and verify the remote
      --skip-hostname-check       Don't check the daemon's hostname against the
                                  name specified in the client certificate
      --project-directory PATH    Specify an alternate working directory
                                  (default: the path of the Compose file)
      --compatibility             If set, Compose will attempt to convert keys
                                  in v3 files to their non-Swarm equivalent
      --env-file PATH             Specify an alternate environment file
    
    Commands:
      build              Build or rebuild services
      config             Validate and view the Compose file
      create             Create services
      down               Stop and remove containers, networks, images, and volumes
      events             Receive real time events from containers
      exec               Execute a command in a running container
      help               Get help on a command
      images             List images
      kill               Kill containers
      logs               View output from containers
      pause              Pause services
      port               Print the public port for a port binding
      ps                 List containers
      pull               Pull service images
      push               Push service images
      restart            Restart services
      rm                 Remove stopped containers
      run                Run a one-off command
      scale              Set number of containers for a service
      start              Start services
      stop               Stop services
      top                Display the running processes
      unpause            Unpause services
      up                 Create and start containers
      version            Show the Docker-Compose version information
    [root@localhost tmp]# 
    

    3.yapi docker镜像安装

    参考:https://github.com/Ryan-Miao/docker-yapi

    3.1.初始化db, 开启自定义配置

    [root@localhost tmp]# git clone https://github.com/Ryan-Miao/docker-yapi.git
    Cloning into 'docker-yapi'...
    remote: Enumerating objects: 19, done.
    remote: Counting objects: 100% (19/19), done.
    remote: Compressing objects: 100% (15/15), done.
    remote: Total 65 (delta 4), reused 17 (delta 2), pack-reused 46
    Unpacking objects: 100% (65/65), done.
    [root@localhost tmp]# pwd
    /home/testuser/tmp
    [root@localhost tmp]# ls
    docker-compose-Linux-x86_64  docker-yapi
    [root@localhost tmp]# 
    [root@localhost tmp]# cd docker-yapi/
    [root@localhost docker-yapi]# ls
    doc  docker-compose.yml  Dockerfile  mongo-conf  readme.md  repositories
    
    [root@localhost docker-yapi]#  docker-compose up
    Creating network "docker-yapi_default" with the default driver
    Pulling mongo (mongo:4)...
    4: Pulling from library/mongo
    7595c8c21622: Pulling fs layer
    7595c8c21622: Pull complete
    d13af8ca898f: Pull complete
    70799171ddba: Pull complete
    b6c12202c5ef: Pull complete
    f8718c532d71: Pull complete
    9035443a91bc: Pull complete
    93ca553166d9: Pull complete
    bc866a5c284c: Pull complete
    6faca936e7b3: Pull complete
    1dc2a767b81f: Pull complete
    56dee77e3145: Pull complete
    b967fd908de0: Pull complete
    7cd9ac470a46: Pull complete
    Digest: sha256:f8c327278bd1a37a5900b2e1ac529221ade80eb54e818e0c3bf04804094c7729
    Status: Downloaded newer image for mongo:4
    Building yapi
    Step 1/4 : FROM node:12-alpine
    12-alpine: Pulling from library/node
    cbdbe7a5bc2a: Downloading
    cbdbe7a5bc2a: Pull complete
    091983d60f65: Pull complete
    7bacc183740f: Pull complete
    c4a5a5d270d4: Pull complete
    Digest: sha256:9623cd396644f9b2e595d833dc0188a880333674488d939338ab5fde10ef7c43
    Status: Downloaded newer image for node:12-alpine
     ---> 18f4bc975732
    Step 2/4 : COPY repositories /etc/apk/repositories
     ---> 03f1899faba3
    Step 3/4 : RUN npm install -g yapi-cli --registry https://registry.npm.taobao.org
     ---> Running in de2d3a4dd359
    
    /usr/local/bin/yapi -> /usr/local/lib/node_modules/yapi-cli/bin/yapi-cli
    /usr/local/bin/yapi-cli -> /usr/local/lib/node_modules/yapi-cli/bin/yapi-cli
    + yapi-cli@1.5.0
    added 254 packages from 124 contributors in 1197.95s
    Removing intermediate container de2d3a4dd359
     ---> f89045a34b1a
    Step 4/4 : EXPOSE 3000 9090
     ---> Running in 38d99f2b3b56
    Removing intermediate container 38d99f2b3b56
     ---> b3e5b43f3477
    Successfully built b3e5b43f3477
    Successfully tagged yapi:latest
    WARNING: Image for service yapi was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
    Creating docker-yapi_mongo_1 ... done
    Creating docker-yapi_yapi_1  ... done
    Attaching to docker-yapi_mongo_1, docker-yapi_yapi_1
    mongo_1  | about to fork child process, waiting until server is ready for connections.
    mongo_1  | forked process: 26
    mongo_1  | 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.326+00:00"},"s":"W",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.330+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.344+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.344+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.345+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":26,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"785bfa0474f0"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.345+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.1.1  11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.345+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.345+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"127.0.0.1","port":27017,"tls":{"mode":"disabled"}},"processManagement":{"fork":true,"pidFilePath":"/tmp/docker-entrypoint-temp-mongod.pid"},"systemLog":{"destination":"file","logAppend":true,"path":"/proc/1/fd/1"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:26.347+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=407M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.047+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544528:47418][26:0x7f0e34c2ba80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.070+00:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":1723}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.070+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.110+00:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.138+00:00"},"s":"W",  "c":"CONTROL",  "id":22120,   "ctx":"initandlisten","msg":"Access control is not enabled for the database. Read and write access to data and configuration is unrestricted","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.139+00:00"},"s":"W",  "c":"CONTROL",  "id":22178,   "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.139+00:00"},"s":"W",  "c":"CONTROL",  "id":22181,   "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.140+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"admin.system.version","uuidDisposition":"provided","uuid":{"uuid":{"$uuid":"0dffebb7-5840-46bf-b494-93566c96de02"}},"options":{"uuid":{"$uuid":"0dffebb7-5840-46bf-b494-93566c96de02"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.201+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"admin.system.version","index":"_id_","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.202+00:00"},"s":"I",  "c":"COMMAND",  "id":20459,   "ctx":"initandlisten","msg":"Setting featureCompatibilityVersion","attr":{"newVersion":"4.4"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.202+00:00"},"s":"I",  "c":"STORAGE",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.203+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"initandlisten","msg":"createCollection","attr":{"namespace":"local.startup_log","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"a6c38f23-2dbf-4966-8070-4f3cd141735e"}},"options":{"capped":true,"size":10485760}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.251+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"initandlisten","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"local.startup_log","index":"_id_","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.252+00:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.269+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.269+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"127.0.0.1"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.269+00:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.271+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"LogicalSessionCacheRefresh","msg":"createCollection","attr":{"namespace":"config.system.sessions","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"5bf430dc-1ede-4cec-a748-e6a48b7a6c48"}},"options":{}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.272+00:00"},"s":"I",  "c":"CONTROL",  "id":20712,   "ctx":"LogicalSessionCacheReap","msg":"Sessions collection is not set up; waiting until next sessions reap interval","attr":{"error":"NamespaceNotFound: config.system.sessions does not exist"}}
    mongo_1  | child process started successfully, parent exiting
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.521+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"LogicalSessionCacheRefresh","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"config.system.sessions","index":"_id_","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.521+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"LogicalSessionCacheRefresh","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"config.system.sessions","index":"lsidTTLIndex","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.521+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"LogicalSessionCacheRefresh","msg":"Slow query","attr":{"type":"command","ns":"config.system.sessions","command":{"createIndexes":"system.sessions","indexes":[{"key":{"lastUse":1},"name":"lsidTTLIndex","expireAfterSeconds":1800}],"writeConcern":{},"$db":"config"},"numYields":0,"reslen":114,"locks":{"ParallelBatchWriterMode":{"acquireCount":{"r":3}},"ReplicationStateTransition":{"acquireCount":{"w":3}},"Global":{"acquireCount":{"w":3}},"Database":{"acquireCount":{"w":3}},"Collection":{"acquireCount":{"r":2,"w":2}},"Mutex":{"acquireCount":{"r":4}}},"flowControl":{"acquireCount":1,"timeAcquiringMicros":2},"storage":{},"protocol":"op_msg","durationMillis":250}}
    yapi_1   | 在浏览器打开 http://0.0.0.0:9090 访问。非本地服务器,请将 0.0.0.0 替换成指定的域名或ip 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.595+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:51962","sessionId":1,"connectionCount":1}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.595+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn1","msg":"client metadata","attr":{"remote":"127.0.0.1:51962","client":"conn1","doc":{"application":{"name":"MongoDB Shell"},"driver":{"name":"MongoDB Internal Client","version":"4.4.0"},"os":{"type":"Linux","name":"Ubuntu","architecture":"x86_64","version":"18.04"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.603+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn1","msg":"connection ended","attr":{"remote":"127.0.0.1:51962","connectionCount":0}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.691+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:51964","sessionId":2,"connectionCount":1}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.691+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn2","msg":"client metadata","attr":{"remote":"127.0.0.1:51964","client":"conn2","doc":{"application":{"name":"MongoDB Shell"},"driver":{"name":"MongoDB Internal Client","version":"4.4.0"},"os":{"type":"Linux","name":"Ubuntu","architecture":"x86_64","version":"18.04"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.734+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"conn2","msg":"createCollection","attr":{"namespace":"admin.system.users","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"80847642-03c2-4a83-bcb4-31828ffef8e9"}},"options":{}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.754+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"conn2","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"admin.system.users","index":"_id_","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.754+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"conn2","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"admin.system.users","index":"user_1_db_1","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | Successfully added user: {
    mongo_1  | 	"user" : "root",
    mongo_1  | 	"roles" : [
    mongo_1  | 		{
    mongo_1  | 			"role" : "root",
    mongo_1  | 			"db" : "admin"
    mongo_1  | 		}
    mongo_1  | 	]
    mongo_1  | }
    mongo_1  | Error saving history file: FileOpenFailed Unable to open() file /home/mongodb/.dbshell: No such file or directory
    mongo_1  | 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.764+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn2","msg":"connection ended","attr":{"remote":"127.0.0.1:51964","connectionCount":0}}
    mongo_1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init-mongo.js
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.840+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"connection accepted","attr":{"remote":"127.0.0.1:51966","sessionId":3,"connectionCount":1}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.841+00:00"},"s":"I",  "c":"NETWORK",  "id":51800,   "ctx":"conn3","msg":"client metadata","attr":{"remote":"127.0.0.1:51966","client":"conn3","doc":{"application":{"name":"MongoDB Shell"},"driver":{"name":"MongoDB Internal Client","version":"4.4.0"},"os":{"type":"Linux","name":"Ubuntu","architecture":"x86_64","version":"18.04"}}}}
    mongo_1  | Successfully added user: {
    mongo_1  | 	"user" : "admin",
    mongo_1  | 	"roles" : [
    mongo_1  | 		{
    mongo_1  | 			"role" : "root",
    mongo_1  | 			"db" : "admin"
    mongo_1  | 		}
    mongo_1  | 	]
    mongo_1  | }
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.911+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn3","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-256","principalName":"admin","authenticationDatabase":"yapi","client":"127.0.0.1:51966"}}
    mongo_1  | Successfully added user: {
    mongo_1  | 	"user" : "yapi",
    mongo_1  | 	"roles" : [
    mongo_1  | 		{
    mongo_1  | 			"role" : "dbAdmin",
    mongo_1  | 			"db" : "yapi"
    mongo_1  | 		},
    mongo_1  | 		{
    mongo_1  | 			"role" : "readWrite",
    mongo_1  | 			"db" : "yapi"
    mongo_1  | 		}
    mongo_1  | 	]
    mongo_1  | }
    mongo_1  | 
    mongo_1  | 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.958+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn3","msg":"connection ended","attr":{"remote":"127.0.0.1:51966","connectionCount":0}}
    mongo_1  | 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.992+00:00"},"s":"W",  "c":"CONTROL",  "id":20698,   "ctx":"main","msg":"***** SERVER RESTARTED *****","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.994+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.997+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.997+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
    mongo_1  | killing process with pid: 26
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.997+00:00"},"s":"I",  "c":"CONTROL",  "id":23377,   "ctx":"SignalHandler","msg":"Received signal","attr":{"signal":15,"error":"Terminated"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.997+00:00"},"s":"I",  "c":"CONTROL",  "id":23378,   "ctx":"SignalHandler","msg":"Signal was sent by kill(2)","attr":{"pid":87,"uid":999}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.997+00:00"},"s":"I",  "c":"CONTROL",  "id":23381,   "ctx":"SignalHandler","msg":"will terminate after current cmd ends"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:28.999+00:00"},"s":"I",  "c":"NETWORK",  "id":20562,   "ctx":"SignalHandler","msg":"Shutdown: going to close listening sockets"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.016+00:00"},"s":"I",  "c":"NETWORK",  "id":23017,   "ctx":"listener","msg":"removing socket file","attr":{"path":"/tmp/mongodb-27017.sock"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.017+00:00"},"s":"I",  "c":"-",        "id":20520,   "ctx":"SignalHandler","msg":"Stopping further Flow Control ticket acquisitions."}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.022+00:00"},"s":"I",  "c":"-",        "id":4695300, "ctx":"SignalHandler","msg":"Interrupted all currently running operations","attr":{"opsKilled":3}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.022+00:00"},"s":"I",  "c":"CONTROL",  "id":20609,   "ctx":"SignalHandler","msg":"Shutting down free monitoring"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.023+00:00"},"s":"I",  "c":"FTDC",     "id":20626,   "ctx":"SignalHandler","msg":"Shutting down full-time diagnostic data capture"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.026+00:00"},"s":"I",  "c":"STORAGE",  "id":20282,   "ctx":"SignalHandler","msg":"Deregistering all the collections"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.026+00:00"},"s":"I",  "c":"STORAGE",  "id":22261,   "ctx":"SignalHandler","msg":"Timestamp monitor shutting down"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.027+00:00"},"s":"I",  "c":"STORAGE",  "id":22317,   "ctx":"SignalHandler","msg":"WiredTigerKVEngine shutting down"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.029+00:00"},"s":"I",  "c":"STORAGE",  "id":22318,   "ctx":"SignalHandler","msg":"Shutting down session sweeper thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.031+00:00"},"s":"I",  "c":"STORAGE",  "id":22319,   "ctx":"SignalHandler","msg":"Finished shutting down session sweeper thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.031+00:00"},"s":"I",  "c":"STORAGE",  "id":22320,   "ctx":"SignalHandler","msg":"Shutting down journal flusher thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.032+00:00"},"s":"I",  "c":"STORAGE",  "id":22321,   "ctx":"SignalHandler","msg":"Finished shutting down journal flusher thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.032+00:00"},"s":"I",  "c":"STORAGE",  "id":22322,   "ctx":"SignalHandler","msg":"Shutting down checkpoint thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.033+00:00"},"s":"I",  "c":"STORAGE",  "id":22323,   "ctx":"SignalHandler","msg":"Finished shutting down checkpoint thread"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.033+00:00"},"s":"I",  "c":"STORAGE",  "id":4795902, "ctx":"SignalHandler","msg":"Closing WiredTiger","attr":{"closeConfig":"leak_memory=true,"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.057+00:00"},"s":"I",  "c":"STORAGE",  "id":4795901, "ctx":"SignalHandler","msg":"WiredTiger closed","attr":{"durationMillis":24}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.057+00:00"},"s":"I",  "c":"STORAGE",  "id":22279,   "ctx":"SignalHandler","msg":"shutdown: removing fs lock..."}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.058+00:00"},"s":"I",  "c":"CONTROL",  "id":20565,   "ctx":"SignalHandler","msg":"Now exiting"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:29.058+00:00"},"s":"I",  "c":"CONTROL",  "id":23138,   "ctx":"SignalHandler","msg":"Shutting down","attr":{"exitCode":0}}
    mongo_1  | 
    mongo_1  | MongoDB init process complete; ready for start up.
    mongo_1  | 
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.030+00:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.033+00:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.033+00:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.035+00:00"},"s":"I",  "c":"STORAGE",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":1,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"785bfa0474f0"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.035+00:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.1.1  11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.035+00:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.035+00:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"net":{"bindIp":"*"},"security":{"authorization":"enabled"}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.036+00:00"},"s":"I",  "c":"STORAGE",  "id":22270,   "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.036+00:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=407M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.845+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544530:845129][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 1 through 2"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:30.969+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544530:969750][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 2 through 2"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.121+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544531:114853][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Main recovery loop: starting at 1/27008 to 2/256"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.240+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544531:240526][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 1 through 2"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.308+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544531:308945][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY_PROGRESS] Recovering log 2 through 2"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.370+00:00"},"s":"I",  "c":"STORAGE",  "id":22430,   "ctx":"initandlisten","msg":"WiredTiger message","attr":{"message":"[1596544531:370713][1:0x7f2c7a089a80], txn-recover: [WT_VERB_RECOVERY | WT_VERB_RECOVERY_PROGRESS] Set global recovery timestamp: (0, 0)"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.378+00:00"},"s":"I",  "c":"STORAGE",  "id":4795906, "ctx":"initandlisten","msg":"WiredTiger opened","attr":{"durationMillis":1342}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.378+00:00"},"s":"I",  "c":"RECOVERY", "id":23987,   "ctx":"initandlisten","msg":"WiredTiger recoveryTimestamp","attr":{"recoveryTimestamp":{"$timestamp":{"t":0,"i":0}}}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.391+00:00"},"s":"I",  "c":"STORAGE",  "id":22262,   "ctx":"initandlisten","msg":"Timestamp monitor starting"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.395+00:00"},"s":"W",  "c":"CONTROL",  "id":22178,   "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.396+00:00"},"s":"W",  "c":"CONTROL",  "id":22181,   "ctx":"initandlisten","msg":"/sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never'","tags":["startupWarnings"]}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.424+00:00"},"s":"I",  "c":"STORAGE",  "id":20536,   "ctx":"initandlisten","msg":"Flow Control is enabled on this deployment"}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.429+00:00"},"s":"I",  "c":"FTDC",     "id":20625,   "ctx":"initandlisten","msg":"Initializing full-time diagnostic data capture","attr":{"dataDirectory":"/data/db/diagnostic.data"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.432+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"/tmp/mongodb-27017.sock"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.432+00:00"},"s":"I",  "c":"NETWORK",  "id":23015,   "ctx":"listener","msg":"Listening on","attr":{"address":"0.0.0.0"}}
    mongo_1  | {"t":{"$date":"2020-08-04T12:35:31.432+00:00"},"s":"I",  "c":"NETWORK",  "id":23016,   "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
    
    

    3.2打开 localhost:9090进行界面部署操作

    默认部署路径为/my-yapi(需要修改docker-compose.yml才可以更改)
    修改管理员邮箱 admin@admin.com (随意, 修改为自己的邮箱)
    修改数据库地址为 mongo 或者修改为自己的mongo实例 (docker-compose配置的mongo服务名称叫mongo)
    
    打开数据库认证
    输入数据库用户名: yapi(mongo配置的用户名, 见mongo-conf/init-mongo.js)
    输入密码: yapi123456(mongo配置的密码, 见mongo-conf/init-mongo.js)
    
    部署完成后显示,再次开始部署会有“系统已安装,如需重新安装,请清空数据库和删除init.lock文件”文字注意提示
    部署日志
    当前安装版本: 1.9.2
    连接数据库成功! 开始下载平台文件压缩包... http://registry.npm.taobao.org/yapi-vendor/download/yapi-vendor-1.9.2.tgz
    部署文件完成,正在安装依赖库...
    npm WARN mongoose-auto-increment@5.0.1 requires a peer of mongoose@^4.1.12 but none is installed. You must install peer dependencies yourself.
    up to date in 17.542s
    5 packages are looking for funding run `npm fund` for details
    依赖库安装完成,正在初始化数据库mongodb...
    > yapi-vendor@1.9.2 install-server /my-yapi/vendors > node server/install.js
    log: mongodb load success...
    初始化管理员账号成功,账号名:"admin@admin.com",密码:"ymfe.org"
    部署成功,请切换到部署目录,输入: "node vendors/server/app.js" 指令启动服务器, 然后在浏览器打开 http://127.0.0.1:3000 访问
    
    

    3.3.部署完毕后,Control+C退出

    ^CGracefully stopping... (press Ctrl+C again to force)
    Stopping docker-yapi_yapi_1  ... done
    Stopping docker-yapi_mongo_1 ... done
    
    

    3.4.修改docker-compose.yml 启用

    [root@localhost docker-yapi]# vim docker-compose.yml
    
    docker-compose.yml内容如下
     yapi:
        build:
          context: ./
          dockerfile: Dockerfile
        image: yapi
        # 第一次启动使用
        # command: "yapi server"
        # 之后使用下面的命令
        command: "node /my-yapi/vendors/server/app.js"
    

    3.5.重启服务

    docker-compose up
    

    3.4.访问 localhost:3000

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

    3.5.后台启动

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

    问题纪要

    问题1

    [root@localhost docker-yapi]# docker-compose up
    Creating network "docker-yapi_default" with the default driver
    ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT rule:  (iptables failed: iptables --wait -t nat -I DOCKER -i br-61f456534edf -j RETURN: iptables: No chain/target/match by that name.
     (exit status 1))
    
    

    原因

    关闭防火墙之后docker需要重启,执行以下命令重启docker即可
    
  • 相关阅读:
    浏览器中复制不能复制的文档并使用word通配符进行高级替换整理
    windows找回映像文件“装载”快捷菜单
    python如何得到模块所在的目录
    搜狗五笔输入法自定义短语使用及设置
    启动office应用更新失败无法进入excel、word、visio的问题解决
    使用ssh登录windows10
    python的索引与切片
    python列表和元组的操作函数
    Python字符串的格式化
    与python字符串相关的一些函数
  • 原文地址:https://www.cnblogs.com/code-red-memory/p/13570426.html
Copyright © 2011-2022 走看看