Skip to content

kgruszka/chaos-demo

Repository files navigation

chaos-demo

Chaos experiment demo with ChaosToolkit

diagram

Issues

If you spot any issue with this repository please do raise an issue in Github

Prerequisites

Services

This will run 2 docker containers: api & jokes-api (provider)

make failing-up
# or
make resilient-up

Alternatively you can run

docker-compose -f docker-compose.failure.yaml up --build
# or
docker-compose -f docker-compose.resilient.yaml up --build

To cleanup containers:

make failing-down
# or
make resilient-down

or

docker-compose -f docker-compose.failure.yaml down
# or
docker-compose -f docker-compose.resilient.yaml down

You can test it by opening web/index.html in your browser. The page does the call to the api on each refresh.

NOTE: API is exposed on the port 3000

Chaos experiment

Steady state

Our api responds with status 200

Action

Simulate jokes provider (jokes-api) downtime by stopping its docker container

docker stop jokes-api

Rollback

Restart jokes provider (jokes-api) docker container

docker start jokes-api

ChaosToolkit

The experiment can be executed with ChaosToolkit

Setup

To create python venv and install ChaosToolkit just execute setup.sh in chaos directory:

cd chaos
source ./setup.sh
cd ..

Execute

Having active venv with installed chaos/requirements.txt (setup.sh) you can execute

make chaos-run

or in chaos directory:

chaos run --rollback-strategy=always experiment.json