Package: chaosiq-cloud
ChaosIQ extension for the Chaos ToolkitThis is the ChaosIQ extension package for theChaos Toolkit.PurposeThe purpose of this package is to communicate withChaosIQin
order to:Publish experimentsPublish executions of these experimentsSafely guard the execution via a set of controlsInstallInstall this package as any other Python packages:$ pip install -U chaosiq-cloudUsageOnce installed,signin,org,publish,enable,disable,teamandverifywill be added
to thechaoscommand.$chaosUsage: chaos [OPTIONS] COMMAND [ARGS]...Options:--version                   Show the version and exit.--verbose                   Display debug level traces.--no-version-check          Do not search for an updated version of thechaostoolkit.--change-dir TEXT           Change directory before running experiment.--no-log-file               Disable logging to file entirely.--log-file TEXT             File path where to write the command's log.[default: chaostoolkit.log]--log-format [string|json]  Console logging format: string, json.--settings TEXT             Path to the settings file.  [default:~/.chaostoolkit/settings.yaml]--help                      Show this message and exit.Commands:disable   Disable a ChaosIQ featurediscover  Discover capabilities and experiments.enable    Enable a ChaosIQ featureinfo      Display information about the Chaos Toolkit environment.init      Initialize a new experiment from discovered capabilities.org       Set ChaosIQ organisationpublish   Publish your experiment's journal to ChaosIQrun       Run the experiment loaded from SOURCE, either a local file or a...signin    Sign-in with your ChaosIQ credentialsteam      Set ChaosIQ teamvalidate  Validate the experiment at PATH.verify    Run the verification loaded from SOURCE, either a local file or...Sign-in with ChaosIQIn order to work, you first need to authenticate with your account onChaosIQ. First, go there and generate a new token. Copy that
token and paste it when asked from the next command:$chaossigninChaosIQ url [https://console.chaosiq.io]:ChaosIQ token:Here are your known organizations:1) yourorg2) TeamA3) TeamBDefault organization to publish to: 2Experiments and executions will be published to organization 'TeamA'ChaosIQ details saved at ~/.chaostoolkit/settings.yamlThis is now ready to be used.Change ChaosIQ OrganizationChaosIQhas support for multiple organizations. You can
specify which of the organizations that you want the ChaosIQ extension to use
by  executing theorgcommand:$chaosorgHere are your known organizations:1) yourorg2) TeamA3) TeamBDefault organization to publish to: 3Experiments and executions will be published to organization 'TeamB'ChaosIQ details saved at ~/.chaostoolkit/settings.yamlThis is now ready to be used.Publish experiments and executions as you runOnce this extension is installed, it starts transmitting the experiments
and their executions to theChaosIQin your selected organization.$chaosruntest.json[2019-09-25 14:42:34 INFO] Validating the experiment's syntax[2019-09-25 14:42:34 INFO] Experiment looks valid[2019-09-25 14:42:34 INFO] Running experiment: EC2 instances are self-healing[2019-09-25 14:42:35 INFO] Execution available at https://console.chaosiq.io/TeamB/executions/f2133988-a6c0-4c48-ac29-c167cea078c5[2019-09-25 14:42:35 INFO] Steady state hypothesis: EC2 instance self-heals[2019-09-25 14:42:36 INFO] Probe: there-should-be-one-running-instance[2019-09-25 14:42:39 INFO] Steady state hypothesis is met![2019-09-25 14:42:40 INFO] Action: stopping-instance-now[2019-09-25 14:42:41 INFO] Pausing after activity for 5s...[2019-09-25 14:42:47 INFO] Steady state hypothesis: EC2 instance self-heals[2019-09-25 14:42:48 INFO] Probe: there-should-be-one-running-instance[2019-09-25 14:42:50 CRITICAL] Steady state probe 'there-should-be-one-running-instance' is not in the given tolerance so failing this experiment[2019-09-25 14:42:50 INFO] Let's rollback...[2019-09-25 14:42:50 INFO] Rollback: starting-instance-again[2019-09-25 14:42:51 INFO] Pausing before next activity for 15s...[2019-09-25 14:43:06 INFO] Action: starting-instance-again[2019-09-25 14:43:08 INFO] Experiment ended with status: deviated[2019-09-25 14:43:08 INFO] The steady-state has deviated, a weakness may have been discoveredPublish existing executionThepublishcommand enables you to manually push your experimental
findings, typically recorded in thejournal.json, to your ChaosIQ
organization.Disable safe guards checkingDuring development time of your experiment, you may wish to disable checking
for safeguards as they can slow your work down. They aren't always relevant
either. To disable the extension from requesting if the execution is allowed
to carry on:$chaosdisablesafeguardsObviously, run the mirroring command to enable them back:$chaosenablesafeguardsDisable publishing experiments and executionsIf you need to disable publishing for a little while:$chaosdisablepublishNote, when you disable publishing, you essentialy disable the entire extension.Obviously, run the mirroring command to enable publishing again:$chaosenablepublishRun a system verificationA system verification is a chaos experiment with an extension block added such as the following:..."extensions":[{"name":"chaosiq","verification":{"id":"SOME_GUID","warm-up-duration":2,"frequency-of-measurement":2,"duration-of-conditions":10,"cool-down-duration":2}}],...Typically you would create a verification in yourChaosIQ console. You can execute a verification in exactly the same way as thechaos rundefault command in the Chaos Toolkit, but instead ofchaos runyou will usechaos verify:$chaosverifymy-excellent-verification.jsonAs with Chaos Toolkit experiments, system verifications may be specified in JSON or YAML formats.ContributeContributors to this project are welcome as this is an open-source effort that
seeksdiscussionsand continuous improvement.From a code perspective, if you wish to contribute, you will need to run a
Python 3.5+ environment. Then, fork this repository and submit a PR. The
project cares for code readability and checks the code style to match best
practices defined inPEP8. Please also make sure you provide tests
whenever you submit a PR so we keep the code reliable.DevelopIf you wish to develop on this project, make sure to install the development
dependencies. But first,create a virtual environmentand then install
those dependencies.$pipinstall-rrequirements-dev.txt-rrequirements.txtThen, point your environment to this directory:$pipinstall-e.Now, you can edit the files and they will be automatically be seen by your
environment, even when running from thechaoscommand locally.Don't forget to run the linter regularly:$ pylama chaoscloudTestTo run the tests for the project execute the following:$ pytestReleaseIn order to release this package, you must first bump its version inchaoscloud/__init__.pyas well as the CHANGELOG. Commit and push these
changes. Then run the followings:$ git tag VERSION
$ git push origin VERSIONwhereVERSIONis the semantic version you set inchaoscloud/__init__.py.Once the tag was built, it should have released the package on Pypi.