Notify service with multiple supported target
This is a backend service build with FastAPI.
- Python 3.9
- Pipenv
- Podman, buildah on Linux host
- Helm 3
- Redis
Check Pipfile for python packages.
Make a copy of the chart/values.yaml
, e.g. dev.value.yaml and update.
Update api key:
apiKeyValue: The API key to authenticate and access the apis, you could generate one with cmd `$openssl rand -hex 32`
SMTP related config:
smtp.endpoint.enableTls: default to True
smtp.endpoint.port: int, required
smtp.endpoint.host: str, required
smtp.endpoint.user: str, optional
smtp.endpoint.password: str, optional
Email related config:
fromName: str, service name, e.g. Notify Service
fromEmail: str, the email from
Chat Webhook URL:
chatWebhook.enabled: boolen, enable or disable chat webhook
chatWebhook.gchat: str, Google Chat room webhook
chatWebhook.slack: str, Slack room webhook
ActiveMQ message bus:
activeMQ.enabled: boolen, enable or disable ActiveMQ message bus config
activeMQ.cert_mount_path: str, specify where the certs will be mounted in the container
activeMQ.ca_certs: multiline str, the CA server certificate
activeMQ.client_cert: multiline str, the message bus client certificate
activeMQ.client_key: multiline str, the message bus client key
activeMQ.msg_bus_host_1: str, the message bus host name
activeMQ.msg_bus_host_1: int, the message bus host port
activeMQ.msg_bus_host_2: str, optional, the second message bus host name
activeMQ.msg_bus_host_2: int, optional, the second message bus host port
IRC config:
irc.enabled: boolen, enable or disable IRC config
irc.server: str, IRC host name
irc.port: int, the IRC host port
irc.ssl: boolen, enable or disable ssl, make sure set the right port if is enabled
irc.nickname: str, IRC username
irc.password: str, set if password exist
irc.default_target: str, the default channel name start with '#' or username
Jira config:
jira.enabled: boolen, enable or disable Jira config
jira.issue_type_list: list of str, include all the available Jira issue types
jira.url: str, the Jira instance url
jira.token: str, the user's personal Jira token
Bugzilla config:
bugzilla.enabled: boolen, enable or disable Bugzilla config
bugzilla.url: str, the Bugzilla instance url
bugzilla.api_key: str, the user's personal Bugzilla API key
Persistent volume config:
persistence.enabled: boolen, true or false
persistence.subPath: str, sub path
persistence.existingClaim, str, using existing pvc
persistence.accessMode: str, ReadWriteOnce, ReadWriteMany or ReadOnlyOnce
persistence.size: str, volume size, e.g. 1G
persistence.storageClass: str, storage class name
persistence.VolumeName: str, volume name
If deploy to Openshift (default) update OpenShift route url:
openshift.enabled: boolen, true or false
openshift.hosts: str, the full app host name
or else update the ingress part.
Make sure you have login your cluster.
Add helm repo with:
$ helm repo add notify https://RedHatQE.github.io/notify-service/
Check the latest release on the project with:
$ helm search repo notify-service
Then install with:
$ helm install ns notify-service -f dev.value.yaml
$ helm install ns chart/ -f dev.value.yaml
The API docs are automatically generated on Swagger UI and Redoc UI.
After deployment is done access the app Swagger UI:
http://${ openshift.hosts }:8080/docs
You could try the apis on Swagger UI and check parameters and request body samples in description.
After the deployment is done, Redoc UI could be accessed at:
http://${ openshift.hosts }:8080/redoc
The Redoc UI is more developer friendly with detail on descriptins, parameters, schemas, payload, code samples, etc.
For each API, both Swagger UI and Redoc UI provide request body schema, while Redoc UI with more details and provide drop list with different supported schemas and details.
Check sample dir under doc for some request body with the matching template names under app/templates/build or app/templates/src.
The repo have provided few templates under app/templates/
, which includes templates for email, Google Chat, Slack, and Jira.
All templates are Jinja templates. Check following for how each target templates are generated, remember to add new request body sample under sample dir for each templates.
The email templates are generated with MJML, you could create a mjml template online with try-it-live.
After edit done, you could save the mjml file with suffix .mjml
under app/templates/src, and SAVE THE HTML file with suffix '.html' under app/templates/build, the HTML
file will be directly used as email template.
Then you could raise PR for adding new templates, make sure your template is unique.
Note: Use Jinja semantic for templating.
Google chat message support simple text and cards:
- Simple text contains plain text content with limited text formatting.
- Cards define the format, content, and behavior of cards to be displayed in the target space.
Follow the docs and create your own google chat templates and save the template file with suffix '.jinja' under app/templates/build. Then you could raise PR for adding new templates, make sure your template is unique.
Note: Use Jinja semantic for templating.
Slack message use mrkdwn formatting syntax and support layouts, check:
- Formatting text in messages
- Composing layouts for layouts
Follow the docs and create your own slack templates and save the template file with suffix '.jinja' under app/templates/build. Then you could raise PR for adding new templates, make sure your template is unique.
Note: Use Jinja semantic for templating.
Jira issues and comments use wikimarkup formatting syntax check:
- Formatting text in tickets and comments
Follow the docs and create your own Jira templates and save the template file with suffix '.jinja' under app/templates/build. Then you could raise PR for adding new templates, make sure your template is unique.
Note: Use Jinja semantic for templating. Advanced Fields (Creating a new issue): In order to specify Components, Labels, Affect Versions, and Fix Versions when you create a new issue on Jira, please check under app/templates/sample the file jira_new_issue_extra_fields.jinja. Adding the fields to any Jira sample will allow you to specify Components, Labels, Affect Versions, and Fix Versions under your new issue.
Bugzilla comments templates (in the current Bugzilla version) only support basic text and hyper-links:
Follow the docs and create your own Bugzilla templates and save the template file with suffix '.jinja' under app/templates/build. Then you could raise PR for adding new templates, make sure your template is unique.
Note: Use Jinja semantic for templating.
No need to raise PRs for each template, if the template is not for common use for all users, user could choose upload templates to a running instance use the Update Tempalte API. Check on the Swagger UI or Redoc UI with PUT method under template APIs on a running instance.
The templates are saved on a volume mounted to dir specified as templateMountDir
in helm chart, make sure persistence.enabled
is true. Then the templates will be saved in a persistent volumn on your OCP cluster.
TODO: Supprt S3 storage
User could also store templates on a github repo or other places which could be accessed by url, then could specify the template url in email, gchat, slack target apis.
For remote urls, cache with default 300 secs timeout will be enabled, so no fetching if request same template between 300 secs.
Note: Make sure you have matching request body for Jinja templating.
For develop, build, test and debug, please check Development Doc for more info.
For update and release the Helm chart of the repo to github webpage, please check Helm Chart Release Doc for more info.
The latest build images are published on: https://quay.io/repository/waynesun09/notify-service
You can contribute by:
- Raising any issues you find using notify-service
- Fixing issues by opening Pull Requests
- Submitting a patch or opening a PR
- Improving documentation
- Talking about notify-service
All bugs, tasks or enhancements are tracked as GitHub issues.
The Github Action will run flake8 against .py files, pytest and helm chart test.