DEV Community

mikotian
mikotian

Posted on

1 2

Setting up ChaosToolkit Execution Environment

Base Setup

Install Python 3.5 on your execution machine.

Windows : Download the latest binary installer from the Python website.

Linux: https://www.python.org/download/other/

Create a virtual environment. Virtual environments help us encapsulate our changes away from the larger system.

python3 -m venv ~/.venvs/resilient

source ~/.venvs/resilient/bin/activate
Enter fullscreen mode Exit fullscreen mode

Install chaostoolkit

pip install chaostoolkit
Enter fullscreen mode Exit fullscreen mode

Verify version

chaos --version
Enter fullscreen mode Exit fullscreen mode

This will install the base version of chaostoolkit with its inbuilt probes, tolerances & actions.

Install AWS Drivers

pip install -U chaostoolkit-aws
Enter fullscreen mode Exit fullscreen mode

Passing Credentials to ChaosToolkit.

For AWS actions/probes to work as expected we need to place a credentials file like below in the following location. ~/.aws

The credentials can be added in the experiment itself, like so

{
  "secrets": {
    "aws": {
      "aws_access_key_id": "your key",
      "aws_secret_access_key": "access key",
      "aws_session_token": "token"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Thats it, you're all set to run AWS Chaos/resiliency experiments!

Install Toxiproxy Drivers

Install Toxiproxy Server from here: (https://github.com/Shopify/toxiproxy/releases)

Install the toxiproxy CLI (https://github.com/Shopify/toxiproxy/releases)

These are required in order to make the network changes work.

Install the chaos toolkit drivers:

pip install -U chaostoolkit-toxiproxy
Enter fullscreen mode Exit fullscreen mode

Add the following configuration to your experiment.

"configuration": {
    "toxiproxy_host" : "10.124.23.183",
    "some_environment_variable": {
      "type": "environment",
      "key": "ENVIRONMENT_VARIABLE"
    }
  }
Enter fullscreen mode Exit fullscreen mode

Start the toxiproxy server.

Now you are ready to run the experiment.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay