<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Proofdock</title>
    <description>The latest articles on DEV Community by Proofdock (@proofdock).</description>
    <link>https://dev.to/proofdock</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F2636%2F22600bb8-4bb5-48a2-a2d5-c81f7ef8c0ed.png</url>
      <title>DEV Community: Proofdock</title>
      <link>https://dev.to/proofdock</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/proofdock"/>
    <language>en</language>
    <item>
      <title>Chaos Middleware: where Spring Boot meets Chaos Engineering</title>
      <dc:creator>Marcin Kaszubski</dc:creator>
      <pubDate>Mon, 12 Oct 2020 05:55:28 +0000</pubDate>
      <link>https://dev.to/proofdock/chaos-middleware-where-spring-boot-meets-chaos-engineering-2874</link>
      <guid>https://dev.to/proofdock/chaos-middleware-where-spring-boot-meets-chaos-engineering-2874</guid>
      <description>&lt;p&gt;Chaos engineering tools activate features like stopping virtual machines or terminating pods in your Kubernetes cluster. The Cloud Bug Study states that neglected error handling - buggy code, timeouts, etc. - accounts for the vast majority of system malfunction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chaos Middleware&lt;/strong&gt; allows you to inject turbulent conditions into your application. It lets you delay or raise errors when handling requests, and by applying additional conditions, you can  decrease the blast radius of your attack.&lt;/p&gt;

&lt;p&gt;The following sections will guide you through: i) the installation and configuration process of &lt;strong&gt;Chaos Middleware&lt;/strong&gt; in your Spring Boot application and ii) simulation of delays and application faults.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation &amp;amp; configuration
&lt;/h2&gt;

&lt;p&gt;1. Install the Chaos Middleware by including following dependency in your spring boot application &lt;code&gt;pom.xml&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.proofdock&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-chaos-middleware&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;0.1.4&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Add an &lt;strong&gt;application name&lt;/strong&gt; to the &lt;code&gt;application.properties&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;chaos.middleware.application-name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;webshop-order&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3. Start your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simulate delays
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;delay&lt;/strong&gt; attack introduces delays to the request/response cycle. This type of the attack enables you to verify the behavior of your system in case of timeouts or slow responses.&lt;/p&gt;

&lt;p&gt;Trigger delays by setting the &lt;strong&gt;x-proofdock-attack&lt;/strong&gt; request header. The Chaos Middleware detects any value inside this header and injects appropriate turbulent conditions.&lt;/p&gt;

&lt;p&gt;To simulate delay, set the x-proofdock-attack header's value to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"actions"&lt;/span&gt;&lt;span class="p"&gt;:[{&lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"delay"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"5"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"application"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"webshop-order"&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;name&lt;/strong&gt; - set delay attack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;value&lt;/strong&gt; - delay response by 5 seconds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;target&lt;/strong&gt; - target application name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's attack an application using Postman.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdcimff0ug86xgz94yqy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdcimff0ug86xgz94yqy.gif" alt="chaos_panel_delay"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Simulate faults
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;fault&lt;/strong&gt; attack injects an &lt;strong&gt;exception&lt;/strong&gt; into your code.  This type of the attack enables you to verify the behavior of your application in case of an unexpected event.&lt;/p&gt;

&lt;p&gt;Trigger faults by setting the &lt;strong&gt;x-proofdock-attack&lt;/strong&gt; request header.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"actions"&lt;/span&gt;&lt;span class="p"&gt;:[{&lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"fault"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"java.lang.Exception"&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"application"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"webshop-order"&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;name&lt;/strong&gt; - set fault attack&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;value&lt;/strong&gt; - thow exception of the type &lt;code&gt;java.lang.Excpetion&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;target&lt;/strong&gt; - the targeted application name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's attack an application using Postman.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpmzcxcxbwspt10w3y93z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpmzcxcxbwspt10w3y93z.gif" alt="chaos_panel_fault"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Chaos Panel for Azure DevOps users
&lt;/h2&gt;

&lt;p&gt;A more convenient way to control such attacks is the usage of the &lt;strong&gt;Chaos Panel&lt;/strong&gt; provided by Proofdock's Chaos Platform. The Chaos Platform extends the Azure DevOps with chaos engineering capabilities. The Chaos Panel allows you to control application attacks via a graphical user interface.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3q8afxx8d2tydmmwqj0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3q8afxx8d2tydmmwqj0s.png" alt="4xs9vhcsdtmqp83tffan"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The Chaos Panel in Azure DevOps&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://docs.proofdock.io/chaos/guide/" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, if you are interested in the Chaos Platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you
&lt;/h2&gt;

&lt;p&gt;We hope you enjoyed reading this article and got a new perspective on resilience.&lt;/p&gt;

&lt;p&gt;We are &lt;a href="https://proofdock.io" rel="noopener noreferrer"&gt;Proofdock&lt;/a&gt;, a software tech company located in Germany, created to help engineers build more resilient and reliable software products. Check out the &lt;a href="https://marketplace.visualstudio.com/items?itemName=proofdock.chaos-platform" rel="noopener noreferrer"&gt;Chaos Platform for Microsoft Azure&lt;/a&gt; and explore your system.&lt;/p&gt;

&lt;p&gt;&lt;span&gt;Article photo by &lt;a href="https://unsplash.com/@raychelsnr?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Raychel Sanner&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/spring-weather?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

</description>
      <category>chaosengineering</category>
      <category>sre</category>
      <category>springboot</category>
      <category>java</category>
    </item>
    <item>
      <title>Introduce Chaos Middleware for Python Flask: Simulate disruptions to improve resiliency</title>
      <dc:creator>Bugra Derre</dc:creator>
      <pubDate>Mon, 28 Sep 2020 05:44:24 +0000</pubDate>
      <link>https://dev.to/proofdock/introduce-chaos-middleware-for-python-flask-simulate-disruptions-to-improve-resiliency-3alp</link>
      <guid>https://dev.to/proofdock/introduce-chaos-middleware-for-python-flask-simulate-disruptions-to-improve-resiliency-3alp</guid>
      <description>&lt;p&gt;&lt;strong&gt;Resiliency&lt;/strong&gt; is key to software nowadays. It contributes to your application's reliability and plays a major role in the &lt;a href="https://medium.com/proofdock/how-chaos-engineering-increases-your-competitiveness-d83caa6ce2cb" rel="noopener noreferrer"&gt;competitive advantage of your business&lt;/a&gt;. Resilient applications smartly exploit the strengths of software patterns that handle timeouts, delays and faulty service responses.&lt;/p&gt;

&lt;p&gt;Great authors and presenters like &lt;a href="https://www.slideshare.net/ufried/" rel="noopener noreferrer"&gt;Uwe Friedrichsen&lt;/a&gt; and &lt;a href="https://insights.sei.cmu.edu/author/donald-firesmith/" rel="noopener noreferrer"&gt;Donald Firesmith&lt;/a&gt; share their ideas and knowledge about &lt;strong&gt;resilient software design&lt;/strong&gt;. Such articles describe software patterns that overcome disruptions and improve application resiliency in a handsome way.&lt;/p&gt;

&lt;p&gt;However, deploying a resilience pattern requires you as a developer to &lt;strong&gt;verify your implementation&lt;/strong&gt;. When touching the ground of verification, things appear to get difficult.&lt;/p&gt;

&lt;p&gt;Chaos engineering tools advertise features like stopping a virtual machine, or to terminate pods in your Kubernetes cluster. The "blast radius" gets high here. Higher than a developer expects when exploring a resilience design pattern on Friday afternoon at 2PM.&lt;/p&gt;

&lt;p&gt;That is where the &lt;code&gt;Chaos Middleware&lt;/code&gt; package goes into action. The &lt;a href="https://ucare.cs.uchicago.edu/pdf/socc14-cbs.pdf" rel="noopener noreferrer"&gt;Cloud Bug Study&lt;/a&gt; states, that neglected error handling - buggy code, timeouts, and others - leads to a great portion of a system's unavailability.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Chaos Middleware&lt;/code&gt; allows you to throw your application at turbulent conditions. It lets you simulate delayed responses or raise errors. Activate disruptions when needed and narrow them down on specific URL paths. The &lt;code&gt;Chaos Middleware&lt;/code&gt; gives you the opportunity to minimize the "blast radius" and verify your application's resilience, even on a Friday afternoon.&lt;/p&gt;

&lt;p&gt;The next sections will guide you through &lt;em&gt;i)&lt;/em&gt; the installation and configuration process in your Flask application &lt;em&gt;ii)&lt;/em&gt; and the simulation of delays and application faults. Simulations are enabled by HTTP header requests or by the &lt;a href="https://docs.proofdock.io/chaos/guide/" rel="noopener noreferrer"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt; control panel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation &amp;amp; configuration
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install the &lt;code&gt;Chaos Middleware&lt;/code&gt; for the Flask application:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/your/flask-application  &lt;span class="c"&gt;# Enter your Flask application&lt;/span&gt;
 venv/bin/activate  &lt;span class="c"&gt;# Active virtual environment&lt;/span&gt;
 pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-U&lt;/span&gt; proofdock-chaos-middleware-flask
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the Flask application:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt; &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;jsonify&lt;/span&gt;
 &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pdchaos.middleware.contrib.flask.flask_middleware&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FlaskMiddleware&lt;/span&gt;

 &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CHAOS_MIDDLEWARE_APPLICATION_NAME&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;example-application-name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
 &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CHAOS_MIDDLEWARE_APPLICATION_ENV&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;example-environment&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
 &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CHAOS_MIDDLEWARE_PROOFDOCK_API_TOKEN&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;eyJ0eXAi...05&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;

 &lt;span class="n"&gt;middleware&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FlaskMiddleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="c1"&gt;# Your business logic here
&lt;/span&gt;
 &lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, from the products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

 &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
     &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start your application&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Simulate delays
&lt;/h2&gt;

&lt;p&gt;Trigger delays by setting the &lt;code&gt;x-proofdock-attack&lt;/code&gt; request header. The &lt;code&gt;Chaos Middleware&lt;/code&gt; detects any value inside this header. &lt;/p&gt;

&lt;p&gt;Set the header's value to &lt;code&gt;{"actions":[{"name":"delay","value":"15"}]}&lt;/code&gt;. The value describes the simulation &lt;code&gt;name&lt;/code&gt; and its &lt;code&gt;value&lt;/code&gt; in seconds. The described simulation delays the response by 15 seconds.&lt;/p&gt;

&lt;p&gt;For the simulation, we use the Postman client to visualize the HTTP requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkdp143wjlxyd7fnqd1e1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkdp143wjlxyd7fnqd1e1.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A delay simulation&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Simulate faults
&lt;/h2&gt;

&lt;p&gt;Raise exceptions by setting the &lt;code&gt;x-proofdock-attack&lt;/code&gt; request header.&lt;/p&gt;

&lt;p&gt;Set the header's value to &lt;code&gt;{"actions":[{"name":"fault","value":"Exception"}]}&lt;/code&gt;. The value describes the simulation &lt;code&gt;name&lt;/code&gt; and its &lt;code&gt;value&lt;/code&gt; as a fully qualified name of the exception to be raised. The simulation will raise the &lt;code&gt;Exception&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi76rumlxvwjg3rdi2e1c.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi76rumlxvwjg3rdi2e1c.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A fault simulation&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A control panel for Azure DevOps users
&lt;/h2&gt;

&lt;p&gt;A more appealing way to control such attacks is the usage of the control panel provided by Proofdock's &lt;a href="https://docs.proofdock.io/chaos/guide/" rel="noopener noreferrer"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt;. The &lt;code&gt;Chaos Platform&lt;/code&gt; extends the Azure DevOps with chaos engineering capabilities. The control panel allows you to control application attacks via a graphical user interface and lets your application cache the configured attack. Check out the &lt;a href="https://docs.proofdock.io/chaos/guide/" rel="noopener noreferrer"&gt;&lt;strong&gt;docs&lt;/strong&gt;&lt;/a&gt; when you are interested in the &lt;code&gt;Chaos Platform&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4xs9vhcsdtmqp83tffan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4xs9vhcsdtmqp83tffan.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The control panel in Azure DevOps&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you
&lt;/h2&gt;

&lt;p&gt;We hope you had fun and learned some new aspects on resilience.&lt;/p&gt;

&lt;p&gt;We are &lt;a href="https://proofdock.io" rel="noopener noreferrer"&gt;&lt;strong&gt;Proofdock&lt;/strong&gt;&lt;/a&gt;, a software tech company located in Germany helping engineers build more resilient and reliable software products. Check out the &lt;a href="https://marketplace.visualstudio.com/items?itemName=proofdock.chaos-platform" rel="noopener noreferrer"&gt;&lt;strong&gt;Chaos Platform&lt;/strong&gt;&lt;/a&gt; for Microsoft Azure and explore your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check out the source code at &lt;a href="https://github.com/proofdock/chaos-middleware-python/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.proofdock.io/" rel="noopener noreferrer"&gt;Read the docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=proofdock.chaos-platform" rel="noopener noreferrer"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flask</category>
      <category>resilience</category>
      <category>chaos</category>
      <category>devops</category>
    </item>
    <item>
      <title>Chaos Middleware: Simulate disruptions in Django applications to improve resiliency</title>
      <dc:creator>Bugra Derre</dc:creator>
      <pubDate>Tue, 08 Sep 2020 05:38:03 +0000</pubDate>
      <link>https://dev.to/proofdock/chaos-middleware-simulate-disruptions-in-django-applications-to-improve-resiliency-j8h</link>
      <guid>https://dev.to/proofdock/chaos-middleware-simulate-disruptions-in-django-applications-to-improve-resiliency-j8h</guid>
      <description>&lt;p&gt;&lt;strong&gt;Resiliency&lt;/strong&gt; is key to software nowadays. It contributes to your application's reliability and plays a major role in the &lt;a href="https://medium.com/proofdock/how-chaos-engineering-increases-your-competitiveness-d83caa6ce2cb"&gt;competitive advantage of your business&lt;/a&gt;. Resilient applications smartly exploit the strengths of software patterns that handle timeouts, delays and faulty service responses.&lt;/p&gt;

&lt;p&gt;Great authors and presenters like &lt;a href="https://www.slideshare.net/ufried/"&gt;Uwe Friedrichsen&lt;/a&gt; and &lt;a href="https://insights.sei.cmu.edu/author/donald-firesmith/"&gt;Donald Firesmith&lt;/a&gt; share their ideas and knowledge about &lt;strong&gt;resilient software design&lt;/strong&gt;. Such articles describe software patterns that overcome disruptions and improve application resiliency in a handsome way.&lt;/p&gt;

&lt;p&gt;However, deploying a resilience pattern requires you as a developer to &lt;strong&gt;verify your implementation&lt;/strong&gt;. When touching the ground of verification, things appear to get difficult.&lt;/p&gt;

&lt;p&gt;Chaos engineering tools advertise features like stopping a virtual machine, or to terminate pods in your Kubernetes cluster. The "blast radius" gets high here. Higher than a developer expects when exploring a resilience design pattern on Friday afternoon at 2PM.&lt;/p&gt;

&lt;p&gt;That is where the &lt;code&gt;Chaos Middleware&lt;/code&gt; package goes into action. The &lt;a href="https://ucare.cs.uchicago.edu/pdf/socc14-cbs.pdf"&gt;Cloud Bug Study&lt;/a&gt; states, that neglected error handling - buggy code, timeouts, and others - leads to a great portion of a system's unavailability.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Chaos Middleware&lt;/code&gt; allows you to throw your application at turbulent conditions. It lets you simulate delayed responses or raise errors. Activate disruptions when needed and narrow them down on specific URL paths. The &lt;code&gt;Chaos Middleware&lt;/code&gt; gives you the opportunity to minimize the "blast radius" and verify your application's resilience, even on a Friday afternoon.&lt;/p&gt;

&lt;p&gt;The next sections will guide you through &lt;em&gt;i)&lt;/em&gt; the installation and configuration process in your Django application &lt;em&gt;ii)&lt;/em&gt; and the simulation of delays and application faults. Simulations are enabled by HTTP header requests or by the &lt;a href="https://docs.proofdock.io/chaos/guide/"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt; control center.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation &amp;amp; configuration
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install the &lt;code&gt;Chaos Middleware&lt;/code&gt; for the Django application:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/your/django-application  &lt;span class="c"&gt;# Enter your Django application&lt;/span&gt;
 venv/bin/activate  &lt;span class="c"&gt;# Active virtual environment&lt;/span&gt;
 pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-U&lt;/span&gt; proofdock-chaos-middleware-django
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the Django application:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt; &lt;span class="c1"&gt;# Activate the ``Chaos Middleware`` component by adding 
&lt;/span&gt; &lt;span class="c1"&gt;# it to the MIDDLEWARE list in your Django settings
&lt;/span&gt; &lt;span class="n"&gt;MIDDLEWARE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
   &lt;span class="s"&gt;'..'&lt;/span&gt;
   &lt;span class="s"&gt;'pdchaos.middleware.contrib.django.django_middleware.DjangoMiddleware'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s"&gt;'..'&lt;/span&gt;
 &lt;span class="p"&gt;]&lt;/span&gt;

 &lt;span class="c1"&gt;# Set the Chaos Middleware settings
&lt;/span&gt; &lt;span class="n"&gt;CHAOS_MIDDLEWARE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="s"&gt;'CHAOS_MIDDLEWARE_APPLICATION_NAME'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'example-application-name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="s"&gt;'CHAOS_MIDDLEWARE_APPLICATION_ENV'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'example-environment'&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start your application&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Simulate delays
&lt;/h2&gt;

&lt;p&gt;Trigger delays by setting the &lt;code&gt;x-proofdock-attack&lt;/code&gt; request header. The &lt;code&gt;Chaos Middleware&lt;/code&gt; detects any value inside this header. &lt;/p&gt;

&lt;p&gt;Set the header's value to &lt;code&gt;{"actions":[{"name":"delay","value":"15"}]}&lt;/code&gt;. The value describes the simulation &lt;code&gt;name&lt;/code&gt; and its &lt;code&gt;value&lt;/code&gt; in seconds. The described simulation delays the response by 15 seconds.&lt;/p&gt;

&lt;p&gt;For the simulation, we use the Postman client to visualize the HTTP requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bRb5hdjR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w7uglr5q1rn8t1q2uvh7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bRb5hdjR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w7uglr5q1rn8t1q2uvh7.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A delay simulation&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Simulate faults
&lt;/h2&gt;

&lt;p&gt;Raise exceptions by setting the &lt;code&gt;x-proofdock-attack&lt;/code&gt; request header.&lt;/p&gt;

&lt;p&gt;Set the header's value to &lt;code&gt;{"actions":[{"name":"fault","value":"Exception"}]}&lt;/code&gt;. The value describes the simulation &lt;code&gt;name&lt;/code&gt; and its &lt;code&gt;value&lt;/code&gt; as a fully qualified name of the exception to be raised. The simulation will raise the &lt;code&gt;Exception&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vvtMFVju--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3px8lpxht1q2goiv091r.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vvtMFVju--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3px8lpxht1q2goiv091r.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A fault simulation&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A control center for Azure DevOps users
&lt;/h2&gt;

&lt;p&gt;A more appealing way to control such attacks is the usage of the control center provided by Proofdock's &lt;a href="https://docs.proofdock.io/chaos/guide/"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt;. The &lt;code&gt;Chaos Platform&lt;/code&gt; extends the Azure DevOps with chaos engineering capabilities. The control center allows you to control application attacks via a graphical user interface and lets your application cache the configured attack. Check out the &lt;a href="https://docs.proofdock.io/chaos/guide/"&gt;&lt;strong&gt;docs&lt;/strong&gt;&lt;/a&gt; when you are interested in the &lt;code&gt;Chaos Platform&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ad43WpPg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4xs9vhcsdtmqp83tffan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ad43WpPg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4xs9vhcsdtmqp83tffan.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The control center in Azure DevOps&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you
&lt;/h2&gt;

&lt;p&gt;We hope you had fun and learned some new aspects on resilience.&lt;/p&gt;

&lt;p&gt;We are &lt;a href="https://proofdock.io"&gt;&lt;strong&gt;Proofdock&lt;/strong&gt;&lt;/a&gt;, a software tech company located in Germany helping engineers build more resilient and reliable software products. Check out the &lt;a href="https://marketplace.visualstudio.com/items?itemName=proofdock.chaos-platform"&gt;&lt;strong&gt;Chaos Platform&lt;/strong&gt;&lt;/a&gt; for Microsoft Azure and explore your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Check out the source code at &lt;a href="https://github.com/proofdock/chaos-middleware-python/"&gt;GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.proofdock.io/"&gt;Read the docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=proofdock.chaos-platform"&gt;&lt;code&gt;Chaos Platform&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>django</category>
      <category>resilience</category>
      <category>chaos</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
