A little sanity for our infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2.4 KiB

Sanity

Build Status Docker pulls

“Any daily work task that takes 5 minutes will cost over 20 hours a year, or over half of a work week. Even if it takes 20 hours to automate that daily 5 minute task, the automation will break even in a year.” -- Anthony J. Stieber, Breaking into Information Security

Taking care for a running online application requires repetitive, dull little tasks. Check the web server response. See if certificates will expire (or even worse: Already did.) Check the server time. It adds up for one application, and we certainly have more than one. Sanity runs sanity checks on targets you define. It's meant to be run by CI pipelines and the like, producing output like a unit test suite.

Execution

To run the docker image as provided, use this sequence:

  1. Create an empty directory
  2. Create a file targets.json there (see below for examples)
  3. Run docker run -v $(pwd):/app datenimperator/sanity:latest
  4. Test results will be in directory ./run.

Implemented checks

  • Static web response sanity
  • SSL sanity
  • DNS sanity

Test code is in lib/sanity/tests for reference and details.

Results are written to XML files, one per application in the targets definition. Result files are created in path ./run/*.xml

Example target file

Create a file targets.json in the base directory of this repo. It may contain multiple apps, and for each app any combination of supported tests along with any number of targets (at least one, though).

{
  "app_1": {
    "StaticWeb": [
      "https://software-berater.net/assets/css/main.css"
    ],
    "SSL": [
      "https://software-berater.net/"
    ],
    "DNS": [
      "www.software-berater.net"
    ]
  }
}

Target configuration (optional)

Target definition may contain configuration, if needed and supported by the test.

{
  "app_1": {
    // complex configuration
    "StaticWeb": {
      "config": { "key": "value" },
      "targets": [
        "https://software-berater.net/assets/css/main.css"
      ]
    },
    // simple configuration
    "SSL": [
      "https://software-berater.net/"
    ]
  }
}