- Notifications
You must be signed in to change notification settings - Fork1
Morpheus Processes with Webhooks
License
spoonboy-io/dozer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Dozer watchesMorpheus CMP processes/events.It will notify external applications of Morpheus eventsvia HTTP request (webhook) based on YAML configuration you specify.
You can find thelatest software here.
Dozer polls the Morpheus database so needs credentials. Themorpheus
user can be used, but it is preferable tocreate an additional user with SELECT privileges on theprocess
andprocess_type
tables.
Amysql.env
file should be created in the same directory as the application from which the database user configurationwill be read. The following example shows the environment variables used by Dozer which should be included inmysql.env
:
## MySQL ConfigMYSQL_SERVER=127.0.0.1MYSQL_USER=dozerMYSQL_PASSWORD=xxxxa8aca0de5dab5fa1bxxxxx## Optional to override defaultsMYSQL_DATABASE=morpheusPOLL_INTERVAL_SECONDS=3
Webhooks and their triggers are configured in a YAML filewebhook.yaml
which should reside in the same directoryas the Dozer application. An example configuration, showing a single Webhook is shown below:
----webhook:description:Hook example with trigger that runs when status is `complete`url:https://webhook-endpoint.commethod:POSTrequestBody:| { "id": {{.Id}}, "updatedBy": "{{.UpdatedBy}}", "status": "{{.Status}}" }token:BEARER xxxxxxxxxxxxxxtriggers:status:complete
GET and POST methods are supported. If POST method Dozer will look forrequestBody
.
Iftoken
is supplied it will be sent in the AUTHORIZATION header.
Variables which contain information about the Morpheus process can be interpolated in therequestBody
using the standard Golangtemplating format. A complete list can be foundhere.
Currently, Webhook triggers can be specified onstatus
,processType
,taskName
,accountId
andcreatedBy
. They areevaluated on processes which have finished running, not in-progress processes. Triggers are additive - all conditions mustbe satisfied for the Webhook to fire.
Trigger | Description | YAML Example |
---|---|---|
status | Runs when the process is complete or failed | status: failed |
processType | Runs for a specific process type (see list here) | processType: localWorkflow |
taskName | Runs for a given task name | taskName: Hello World |
accountId | Runs for specific tenant id | accountId: 2 |
createdBy | Runs for processes created by a specific user | createdBy: admin |
Grab the tar.gz or zip archive for your OS from thereleases page.
Unpack it to the target host, and then start the server.
./dozer
Or with nohup..
nohup ./dozer &
- Add more triggers such as
zoneId
,instanceName
,appName
,containerName
- Retry and blacklisting for webhooks that fail
- Other notification mechanisms such as email or messaging protocol
- Run as a service
Licensed underMozilla Public License 2.0
About
Morpheus Processes with Webhooks