Package: envmgr-cli
A cross-platform CLI client forEnvironment
ManagerInstallpip install envmgr-cliSeeConfigurationfor further install instructions.Usageenvmgris designed to provide an intuitive, human readable interface
around the lower levelEnvironment Manager Python
LibraryAllenvmgrcommands are exposed behind a set of verbs (geta
status,schedulesome downtime,waitfor an ASG, etc). Verbs are
always the first value provided toenvmgrand there is only ever one
verb per command.docoptThe cli interface is described indocopt.
The easiest way to discover and understand the different usage patterns
available is to simply runenvmgr --helpOutputBy default,envmgrcommands will output a human friendly response
useful for testing single commands at a time. To help scripting or
chaining results together, all commands also accept a--jsonargument which will return the raw JSON response from Environment
Manager:>> 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"]}ExamplesIn the examples below, assume that ‘prod-1’ is an environment, ‘AwesomeService’ is a
service and ‘my-asg’ is an ASG, all of which are already registered in
Environment Manager.# Get the health status of all instances of AwesomeService, in all slices:envmgrgetAwesomeServicehealthinprod-1# Get the the active slice information for the AwesomeService service in prod-1 environment:envmgrgetAwesomeServiceactivesliceinprod-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:envmgrgetasgmy-asgstatusinprod-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:envmgrgetasgmy-asgscheduleinprod-1# Get the current status of the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994:envmgrgetdeploystatusa2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994# Block and wait until the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994 either succeeds or fails:envmgrwait-fordeploya2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994# Block and wait until all instances in the ASG my-asg are ready fordeployment (In Service):envmgrwait-forasgmy-asginprod-1# Block and wait until the service AwesomeService is running with all healthchecks passing:envmgrwait-forhealthyAwesomeServiceinprod-1# Set the schedule of the ASG my-asg in prod-1 to be off permanently until further notice:envmgrscheduleasgmy-asgoffinprod-1# Publish the file build-22.zip as version 1.2.9 of AwesomeService:envmgrpublishbuild-22.zipasAwesomeService1.2.9# Deploy the published version 1.2.9 of AwesomeService into the prod-1 environment:envmgrdeployAwesomeService1.2.9inprod-1# Toggle the upstreams for AwesomeService in the prod-1 environment:envmgrtoggleAwesomeServiceinprod-1# Get the Windows patch status for servers belonging to A-Team in prod-1:envmgrgetA-teampatchstatusinprod-1ConfigurationAuthenticationAll calls to Environment Manager require authentication, which can be
provided in 1 of 2 ways.Either export your credentials as environment variables:ENVMGR_USER=myusername
ENVMGR_PASS=mypa$$wordOr provide a--userand--passvalue to each commad:envmgr get MyService health in prod --user="sarah" --pass="pa$$word"Note: It’s recommended to only use this method in CI environments.Host ConfigThe hostname of your Environment Manager instance is configured
similarly to your credentials:Export your hostname as an environment variable:ENVMGR_HOST=environmentmanager.acme.comOr provide the hostname with each command:envmgr get MyService health in prod --host=environmentmanager.acme.comDevelopmentTo install all test dependencies and run all tests, simply run:python setup.py test [--adopts -v]For convenience this is also available via the includedmakefile:make testDockerIf you want, you can use our automated container buildsUsagedocker run -it --rm \
-e ENVMGR_USER=user
-e ENVMGR_PASS=password
-e ENVMGR_HOST=foo.bar
trainline/envmgr-cli:latest envmgr {YOUR_ARGS}Example~$ docker run -it --rm trainline/envmgr-cli envmgr --version
1.9.1Builddocker build -t {YOUR_NAME}/envmgr-cli .