# Rugby
Rugby is a Continuous Integration platform, suitable for running tests for multi tiered applications in a semi-production environment.
Rugby does the following:
* Brings up a cluster of virtual machines
* Copies your project source code to each virtual machine
* Runs any installation commands you specify
* Runs any test commands you specify
* Logs all output from the virtual machines
## Rugby Config
All projects which wish to use Rugby, must have a `.rugby.yml` file. This is how you interact with Rugby.
### Blocks
A block consists of a `name`, `service`, `install`, and `script` fields. Each block corresponds to one virtual machine that is spawned to do your bidding.
If you were testing a web application, you might have one block for your database and one block for your web server.
### Fields
`name`: A unique name for the block
`service`: Specify a particular set of packages which should be pre-installed on the VM. You do this by specifying `group` and `type`.
`group`: Specify what category of packages you would like to install. Possible choices are `lang` and `db`
`type`: Specify a particular cluster of packages to install from a `group`. For `lang` you could choose `node` for example. For `db` you could choose `mongo`.
`install`: Specify a list of commands you would like to run before running any tests. All commands run have sudo permission.
`script`: Specify a list of commands you would like to run which actually run any tests. All commands run have sudo permission.
Below we show an example Rugby config which has one VM block definition, which will have the `node` language group preinstalled, `apache2` installed before running any test cases, and will run `npm test` to start the test cases.
```yaml
# .rugby.yml
- name: My App Server
service:
group: lang
type: node
install:
- apt-get install apache2
script:
- npm test
```
## Example Application
```yaml
# .rugby.yml
- name: MongoDB
service:
group: db
type: mongo
- name: UCRCareer
service:
group: lang
type: node
install:
- apt-get -y install build-essential
- npm install -g bower nodemon gulp mocha
- npm install
- mkdir /opt/resumes
- chown -R vagrant:vagrant /opt/resumes
script:
- mocha
```
```python
# test.py
from rugby import Rugby
def print_status_callback(commit_id, state):
print "ID: {} \nState: {}\n".format(commit_id, state)
r = Rugby()
r.start_runner('123123123131',
'https://github.com/CrazyWearsPJs/UCRcareer.git',
'.rugby.yml',
print_status_callback)
while 1:
# Wait till everything is completed
pass
```
To start off the build, run `python test.py`. Make sure you have the directories specified in `rugby/config.py` created before running the build.
## Development
### Pre-Requisites
* Install [pip](https://pip.pypa.io/en/latest/installing.html)
* Install [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/)
* Install sqlite3
### Setting up the environment
* Create a directory named `venv`
* Create a virtualenv by running `virtualenv venv`
* Activate virtualenv by running `. venv/bin/activate`
* Install Rugby's dependancies by running `pip install -r requirements.txt`
* Set your PYTHONPATH environment variable to the root of the Rugby project. `export PYTHONPATH=/path/to/Rugby`
### Applying patches
One of our projects dependancies, `python-vagrant`, has an issue which messes with logging. To apply the patch to fix this issue, run the following
```bash
patch venv/lib/python2.7/site-packages/vagrant/__init__.py < patches/vagrant_quiet_logging_issue.patch
```
### Examples
Examples will be located in the `/example` directory. Run any example by running the corresponding example's `run.py`.
没有合适的资源?快使用搜索试试~ 我知道了~
Rugby:橄榄球的核心
共12个文件
py:7个
gitignore:1个
md:1个
需积分: 5 1 下载量 169 浏览量
2021-06-19
23:01:56
上传
评论
收藏 14KB ZIP 举报
温馨提示
橄榄球 Rugby 是一个持续集成平台,适用于在半生产环境中运行多层应用程序的测试。 橄榄球执行以下操作: 启动虚拟机集群 将您的项目源代码复制到每个虚拟机 运行您指定的任何安装命令 运行您指定的任何测试命令 记录虚拟机的所有输出 橄榄球配置 所有希望使用 Rugby 的项目都必须有一个.rugby.yml文件。 这就是您与 Rugby 互动的方式。 块 一个块由name 、 service 、 install和script字段组成。 每个块对应一个虚拟机,它被生成来执行您的投标。 如果您正在测试 Web 应用程序,您可能有一个用于数据库的块和一个用于 Web 服务器的块。 字段 name :块的唯一名称 service :指定一组特定的软件包,这些软件包应该预先安装在 VM 上。 您可以通过指定group和type来做到这一点。 group :指定要安装的软件包类别。 可能的选择
资源详情
资源评论
资源推荐
收起资源包目录
Rugby-master.zip (12个子文件)
Rugby-master
.gitignore 832B
rugby
rugby_loader.py 5KB
templates
Vagrantfile.j2 873B
__init__.py 452B
rugby_state.py 235B
config.py 695B
rugby_worker.py 11KB
rugby.py 7KB
rugby_database.py 3KB
patches
vagrant_quiet_logging_issue.patch 1KB
requirements.txt 167B
README.md 4KB
共 12 条
- 1
XanaHopper
- 粉丝: 35
- 资源: 4725
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0