https://api.pub.build.mozilla.org背后的代码
relengapi的Python项目详细描述
连续积分:https://travis-ci.org/mozilla/build-relengapi [![codecov.io](http://codecov.io/github/mozilla/build-relengapi/coverage.svg?branch=master)](http://codecov.io/github/mozilla/build-relengapi?分支=主)
发布工程自动化的接口。
这是https://api.pub.build.mozilla.org/背后的框架。 它是一个基于烧瓶的框架,用于构建和托管与发布相关的api。
目标
- Simple self-service usage for consumers * Industry-standard access mechanisms (REST, oAuth2, etc.) that require no client-side custom libraries * One or very few endpoints (e.g., https://api.pub.build.mozilla.org) * Self-documenting tools * Semantic versioning
- Simple, rapid implementation of new apps * Common requirements such as authentication, database access, scheduled tasks, configuration handling are already satisfied * All apps use the same technologies (language, web framework, DB framework, etc.), so the learning curve from one app to the next is small * Tailored for easy local development - minimal requirements, minimal installed components, etc.
- Operations-friendly * Horizontally scalable using normal webops techniques * Easily deployed in multiple environments with normal devops processes * Resilient to failure: no in-memory state
文档
发布pi文档本身。 有关当前部署版本的文档,请参见https://api.pub.build.mozilla.org/docs。
开发商信息
有关所需操作系统包的信息,请参阅部署文档的“安装”页。
###结构
relengapi是一个[烧瓶](http://flask.pocoo.org/)应用程序。它由几个python发行版(包)组成。 每个发行版都可以包含几个[烧瓶蓝图](http://flask.pocoo.org/docs/blueprints/)–web应用程序组件。 每个git存储库可以包含多个发行版。
基础在这个包中实现的relengapi发行版中。 它实现了根应用程序,具有许多通用的支持功能和许多蓝图。 它还搜索它的python环境,寻找可以为发布api提供蓝图的其他发行版。 它们充当插件,向api添加额外的端点和其他功能。
此存储库的其他顶级目录包含其他具有更多蓝图的相关发行版。 其他存储库包含更多的发行版,有更多的蓝图。
所有这些都是通过在发布的web集群上安装适当的发行版而在生产中结合在一起的。 不过,在开发时,只需要relengapi发行版和您正在使用的发行版。
###运行relengapi
要运行该工具进行开发,pip将需求安装到您的virtualenv:
pip install -e .[test]
[测试]也安装了测试要求。 如果不运行测试,请忽略此项。
[可选]生成文档:
relengapi build-docs
[可选]设置设置文件:
cp settings_example.py settings.py vim settings.py export RELENGAPI_SETTINGS=$PWD/settings.py
为已安装的蓝图创建数据库:
relengapi createdb
最后运行服务器:
relengapi serve -p 8010
relengapi工具有许多有用的子命令。 有关详细信息,请参阅其帮助。
###更多
有关发布api的开发和部署的更多信息,请参阅发布api文档。 这可以在https://api.pub.build.mozilla.org/docs上获得,或者,如果您已经在自己的实例上的同一路径上安装了docsblueprint。