# Attacks with the Chaos Panel

Chaos Panel leverages you to run attacks on your system. The following paragraphs will guide you through the process of attacking applications and Azure infrastructure.

# Application attacks

In this guide we will configure your application and connect it to the Chaos Panel. This will allow you to inject turbulent conditions such as delays or timeouts by simply selecting it from the list.

Important notes

The following guide is exemplified for a Python Flask application. Please head to the Chaos Middleware section to check other programming languages or frameworks.

# Installation

Add proofdock-chaos-middleware-flask package to your Flask-based application:

$ pip install -U proofdock-chaos-middleware-flask

# Configuration

Provide following configuration variables:

Variable Description
CHAOS_MIDDLEWARE_APPLICATION_NAME The application's name
CHAOS_MIDDLEWARE_APPLICATION_ENVIRONMENT The application's deployed environment
CHAOS_MIDDLEWARE_API_TOKEN The token to connect to the Proofdock Cloud

The application with configured Chaos Middleware looks as follow:

from flask import Flask, jsonify
from pdchaos.middleware.contrib.flask.flask_middleware import FlaskMiddleware

app = Flask(__name__)
# Set required input variables
app.config['CHAOS_MIDDLEWARE_APPLICATION_NAME'] = 'webshop-recommendation'
app.config['CHAOS_MIDDLEWARE_APPLICATION_ENV'] = 'sandbox'
app.config['CHAOS_MIDDLEWARE_PROOFDOCK_API_TOKEN'] = 'eyJ0eXAi...05'

# Initialize chaos middleware
middleware = FlaskMiddleware(app)

# Your business logic here

@app.route("/products/shower/recommendations")
def recommendations():
    return ["Shampoo", "Soap", "Shower foam"]

if __name__ == "__main__":
    app.run()

# The first attack

The Chaos Panel allows to manage and interact with applications that has installed Chaos Middleware.

  1. Start your application. It automatically registers itself at the Proofdock Cloud.
  2. Navigate to Project -> Chaos Platform -> Chaos Panel.
  3. Click the New attack button, fill out the form and submit the application attacks.
  4. The submission may take up to thirty seconds until becoming active in your application.

# Azure attacks

Connect your Azure subscription with the Chaos Panel and inject turbulent conditions such as outages or stress situations to your resources.

# Configuration

Chaos Panel requires a service connection in order to attack Azure resources. If you don't have a service connection, please create one. In case you need more knowledge about creating service connections, please read the descriptive guide from Microsoft.

# Attack

The Chaos Panel allows to manage and interact with attackable resources. Select your target(s) and a proper attack.

Important notes