没有项目描述
clingmerv的Python项目详细描述
的跨平台cli客户端
用法
envmgr旨在提供直观的、可读的界面 围绕较低层Environment Manager Python Library
所有envmgr命令都公开在一组动词(geta)后面 状态,schedule一些停机时间,wait一个asg,等等)。动词是 总是提供给envmgr的第一个值,并且只有一个 每个命令的动词。
输出
默认情况下,envmgr命令将输出一个人性化的响应 用于一次测试单个命令。帮助编写脚本或 将结果链接在一起,所有命令也接受--json 将从环境返回原始json响应的参数 经理:
>> envmgr schedule asg my-asg on in prod Scheduled 1 instance in my-asg to: ON >> envmgr schedule asg my-asg on in prod --json {"ChangedInstances": ["i-0afe2276909859130"], "ChangedAutoScalingGroups": ["my-asg"]}
示例
在下面的示例中,假设“prod-1”是一个环境,“awesomeservice”是一个 “我的ASG”是一个ASG,所有这些都已经在 环境经理。
# Get the health status of all instances of AwesomeService, in all slices: envmgr get AwesomeService health in prod-1 # Get the the active slice information for the AwesomeService service in prod-1 environment: envmgr get AwesomeService active slice in prod-1 # Get the status of the my-asg ASG in the prod-1 environment. Status is calculated as an aggregate of all instances in the ASG: envmgr get asg my-asg status in prod-1 # Get the schedule value set on the my-asg ASG in the prod-1 environment. Note this will tell you what the schedule is configured to - not the current state according to the schedule: envmgr get asg my-asg schedule in prod-1 # Get the current status of the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994: envmgr get deploy status a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994 # Block and wait until the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994 either succeeds or fails: envmgr wait-for deploy a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994 # Block and wait until all instances in the ASG my-asg are ready fordeployment (In Service): envmgr wait-for asg my-asg in prod-1 # Block and wait until the service AwesomeService is running with all healthchecks passing: envmgr wait-for healthy AwesomeService in prod-1 # Set the schedule of the ASG my-asg in prod-1 to be off permanently until further notice: envmgr schedule asg my-asg off in prod-1 # Publish the file build-22.zip as version 1.2.9 of AwesomeService: envmgr publish build-22.zip as AwesomeService 1.2.9 # Deploy the published version 1.2.9 of AwesomeService into the prod-1 environment: envmgr deploy AwesomeService 1.2.9 in prod-1 # Toggle the upstreams for AwesomeService in the prod-1 environment: envmgr toggle AwesomeService in prod-1 # Get the Windows patch status for servers belonging to A-Team in prod-1: envmgr get A-team patch status in prod-1
配置
认证
所有对环境管理器的调用都需要身份验证,可以是 以两种方式之一提供。
将凭据导出为环境变量:
ENVMGR_USER=myusername ENVMGR_PASS=mypa$$word
或者为每个commad提供一个--user和--pass值:
envmgr get MyService health in prod --user="sarah" --pass="pa$$word"
注意:建议只在ci环境中使用此方法。
主机配置
已配置环境管理器实例的主机名 与您的凭证类似:
将主机名导出为环境变量:
ENVMGR_HOST=environmentmanager.acme.com
或者为每个命令提供主机名:
envmgr get MyService health in prod --host=environmentmanager.acme.com
开发
要安装所有测试依赖项并运行所有测试,只需运行:
python setup.py test [--adopts -v]
为了方便起见,还可以通过包含的makefile获取此文件:
make test
码头工人
如果需要,您可以使用我们的自动容器构建
使用量
docker run -it --rm \ -e ENVMGR_USER=user -e ENVMGR_PASS=password -e ENVMGR_HOST=foo.bar trainline/envmgr-cli:latest envmgr {YOUR_ARGS}
示例
~$ docker run -it --rm trainline/envmgr-cli envmgr --version 1.9.1
建造
docker build -t {YOUR_NAME}/envmgr-cli .