网站首页 > 开源技术 正文
介绍
给大家推荐一个开源接口管理平台YApi,众多互联网大厂都在使用
YApi 的一些客户:百度,阿里巴巴,腾讯,今日头条等
GitHub地址:https://github.com/YMFE/yapi
github上有本地安装的教程,因为docker安装比较方便,因此官方推荐了如下docker安装教程,当然docker镜像不是官方做的。建议配置阿里云Docker镜像仓库,下载起来比较快
使用 Docker 构建 YApi
1.启动 MongoDB
docker run -d --name mongo-yapi mongo
1
2.获取 Yapi 镜像,版本信息可在 阿里云镜像仓库 查看
docker pull registry.cn-hangzhou.aliyuncs.com/anoy/yapi
1
3.初始化 Yapi 数据库索引及管理员账号
docker run -it --rm \
--link mongo-yapi:mongo \
--entrypoint npm \
--workdir /api/vendors \
registry.cn-hangzhou.aliyuncs.com/anoy/yapi \
run install-server
123456
自定义配置文件挂载到目录 /api/config.json,官方自定义配置文件https://github.com/YMFE/yapi/blob/master/config_example.json
4.启动 Yapi 服务
docker run -d \
--name yapi \
--link mongo-yapi:mongo \
--workdir /api/vendors \
-p 3000:3000 \
registry.cn-hangzhou.aliyuncs.com/anoy/yapi \
server/app.js
1234567
使用 Yapi
访问 http://localhost:3000 登录账号 admin@admin.com,密码 ymfe.org
至此,帅气的 YApi 就可以轻松使用啦!更多文档信息,请参考
YApi 官方教程https://hellosean1025.github.io/yapi/documents/index.html
YApi 版本更新记录https://github.com/YMFE/yapi/blob/master/CHANGELOG.md
其他相关操作
1.关闭 YApi
docker stop yapi
1
2.启动YApi
docker start yapi
1
3.升级 YApi
# 1、停止并删除旧版容器
docker rm -f yapi
# 2、获取最新镜像
docker pull registry.cn-hangzhou.aliyuncs.com/anoy/yapi
# 3、启动新容器
docker run -d \
--name yapi \
--link mongo-yapi:mongo \
--workdir /api/vendors \
-p 3000:3000 \
registry.cn-hangzhou.aliyuncs.com/anoy/yapi \
server/app.js
1234567891011121314
手动构建 YApi 镜像
1.下载 YApi 到本地
wget -o yapi.tar.gz https://github.com/YMFE/yapi/archive/v1.8.0.tar.gz
1
下载地址:https://github.com/YMFE/yapi/releases
2.编辑 Dockerfile
FROM node:12-alpine as builder
RUN apk add --no-cache git python make openssl tar gcc
COPY yapi.tar.gz /home
RUN cd /home && tar zxvf yapi.tar.gz && mkdir /api && mv /home/yapi-1.8.0 /api/vendors
RUN cd /api/vendors && \
npm install --production --registry https://registry.npm.taobao.org
FROM node:12-alpine
MAINTAINER 545544032@qq.com
ENV TZ="Asia/Shanghai" HOME="/"
WORKDIR ${HOME}
COPY --from=builder /api/vendors /api/vendors
COPY config.json /api/
EXPOSE 3000
ENTRYPOINT ["node"]
1234567891011121314151617181920212223242526
3.构建镜像
docker build -t yapi .
猜你喜欢
- 2024-09-16 比较一下XML, JSON和YAML(xml与json区别)
- 2024-09-16 JSON的概念及应用场景举例(json的概念及应用场景举例分析)
- 2024-09-16 Java实现在线SQL编程(完整版)(java代码中怎样写sql语句)
- 2024-09-16 RESTful API (Application Programming Interface)
- 2024-09-16 API低代码开发平台实践(低代码开发工具)
- 2024-09-16 JSON 格式的接口测试流程【Eolink Apikit】
- 2024-09-16 推荐腾讯开源的零代码、全功能、强安全API架构
- 2024-09-16 下个十年高性能 JSON 库来了:fastjson2!
- 2024-09-16 高并发之API接口,分布式,防刷限流,如何做?
- 2024-09-16 可以让你零代码快速开发REST API的几个开源项目
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- jdk (81)
- putty (66)
- rufus (78)
- 内网穿透 (89)
- okhttp (70)
- powertoys (74)
- windowsterminal (81)
- netcat (65)
- ghostscript (65)
- veracrypt (65)
- asp.netcore (70)
- wrk (67)
- aspose.words (80)
- itk (80)
- ajaxfileupload.js (66)
- sqlhelper (67)
- express.js (67)
- phpmailer (67)
- xjar (70)
- redisclient (78)
- wakeonlan (66)
- tinygo (85)
- startbbs (72)
- webftp (82)
- vsvim (79)
本文暂时没有评论,来添加一个吧(●'◡'●)