/ccx-notification-service

CCX notification service

Primary LanguageGoApache License 2.0Apache-2.0

ccx-notification-service

CCX notification service

GoDoc GitHub Pages Go Report Card Build Status Build Status GitHub go.mod Go version License

Description

The purpose of this service is to enable automatic email notifications to users for all serious issues found in their OpenShift clusters. The "instant" mode of this service runs as a cronjob every fifteen minutes, and it sends a sequence of events to the configured Kafka topic so that the notification-backend can process them and create email notifications based on the provided events. The events are only created for the important and critical issues found in the new_reports table of the configured PostgreSQL database. Once the reports are processed, the DB is updated with info about sent events by populating the reported table with the corresponding information. For more info about initialising the database, take a look at the ccx-notification-writer repository.

In the instant notification mode, one email will be received for each cluster with important or critical issues.

Building

Use make build to build executable file with this service.

All Makefile targets:

Usage: make <OPTIONS> ... <TARGETS>

Available targets are:

clean                Run go clean
build                Keep this rule for compatibility
fmt                  Run go fmt -w for all sources
lint                 Run golint
vet                  Run go vet. Report likely mistakes in source code
cyclo                Run gocyclo
ineffassign          Run ineffassign checker
shellcheck           Run shellcheck
errcheck             Run errcheck
goconst              Run goconst checker
gosec                Run gosec checker
abcgo                Run ABC metrics checker
json-check           Check all JSONs for basic syntax
style                Run all the formatting related commands (fmt, vet, lint, cyclo) + check shell scripts
run                  Build the project and executes the binary
test                 Run the unit tests
bdd_tests            Run BDD tests (needs real dependencies)
bdd_tests_mock       Run BDD tests with mocked dependencies
before_commit        Checks done before commit
help                 Show this help screen

Usage

Provided a valid configuration, you can start the service with ./ccx-notification-service --instant-reports

All command line options

List of all available command line options:

  -instant-reports
    	create instant reports
  -cleanup-on-startup
        perform database clean up on startup
  -show-authors
    	show authors and exit
  -show-configuration
    	show configuration
  -show-version
    	show version and exit
  -weekly-reports
    	create weekly reports
  -max-age string
    	max age for displaying/cleaning old records
  -new-reports-cleanup
    	perform new reports clean up
  -old-reports-cleanup
    	perform old reports clean up
  -print-new-reports-for-cleanup
    	print new reports to be cleaned up
  -print-old-reports-for-cleanup
    	print old reports to be cleaned up

Database

PostgreSQL database is used as a storage.

Please look at detailed schema description for more details about tables, indexes, and keys.

Schema description

DB schema description can be generated by generate_db_schema_doc.sh script. Output is written into directory docs/db-description/. Its content can be viewed at this address.

Notification templates

Notification templates used to send e-mails etc. to customers are stored in different repository: https://github.com/RedHatInsights/notifications-backend/

Templates used by this notification service are available at: https://github.com/RedHatInsights/notifications-backend/tree/master/backend/src/main/resources/templates/AdvisorOpenshift

Package manifest

Package manifest is available at docs/manifest.txt.