RedHatInsights / remediations-consumer

Consumer of platform messages for Remediations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Remediations Consumer

Kafka consumer that consumes messages produced by applications and updates state in Remediations database and Redis accordingly.

Getting started

Prerequisities

  • node.js 10

Running the application locally

  1. docker-compose -f build/docker-compose.yml up

Local development

  1. npm ci
  2. docker-compose -f build/docker-compose.yml up zookeeper
  3. docker-compose -f build/docker-compose.yml up kafka
  4. docker-compose -f build/docker-compose.yml up db
  5. npm run db:ims
  6. npm start

Metrics can be found at http://localhost:9006/metrics

Testing

To run the linter, unit and integration tests run:

npm run verify

Manual testing

Run node test/producer.js to produce a test message and send it to Kafka.

Cleaner script

In addition to the consumer itself this repository also hosts a script that cleans up playbook_runs, playbook_run_executors and playbook_run_systems that failed to reach a final state. More specifically, it:

  • looks for playbook_run_systems that haven't received an updated in more than 6 hours and failed to reach one of the final statuses (success, failure, canceled). These records are set the canceled status.
  • looks for playbook_run_executors that haven't received an update in more than 15 minutes and did not reach one of the final statuses despite all their playbook_run_systems being finished. The status of these records is set based on the status of its systems:
    • failure if any of the systems failed
    • canceled if any of the systems was canceled
    • success otherwise
  • looks for playbook_runs that haven't received an update in more than 15 minutes and did not reach one of the final statuses despite their playbook_run_executors being finished. The status of these records is set based on the status of its executors:
    • failure if any of the executors failed
    • canceled if any of the executors was canceled
    • success otherwise

Releases

Upon any change in the master branch the branch is tested, an image is built and deployed in CI and QA environments automatically. This process is controlled by the deployment Jenkinsfile.

The image can then be promoted to production using a Jenkins job. Use the git commit SHA as the REVISION when running the job.

Contact

For questions or comments join #platform-automation-standup at ansible.slack.com.

About

Consumer of platform messages for Remediations


Languages

Language:TypeScript 84.3%Language:JavaScript 12.3%Language:Shell 1.5%Language:Python 0.9%Language:Dockerfile 0.5%Language:Groovy 0.5%