adding error & deploy notification
This commit is contained in:
@@ -76,7 +76,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
KUBE_CONFIG: ${{ env.KUBE_CONFIG }}
|
KUBE_CONFIG: ${{ env.KUBE_CONFIG }}
|
||||||
|
|
||||||
- name: Test connection to cluster
|
- name: Check connection to cluster
|
||||||
run: |
|
run: |
|
||||||
cd haven-notify/deploy
|
cd haven-notify/deploy
|
||||||
kubectl --kubeconfig=kubeconfig.yaml cluster-info
|
kubectl --kubeconfig=kubeconfig.yaml cluster-info
|
||||||
@@ -90,3 +90,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd haven-notify/deploy
|
cd haven-notify/deploy
|
||||||
kubectl --kubeconfig=kubeconfig.yaml rollout restart deployment/haven-notify
|
kubectl --kubeconfig=kubeconfig.yaml rollout restart deployment/haven-notify
|
||||||
|
|
||||||
|
- name: Send notification of deployment
|
||||||
|
run: |
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d '{"title": "🚀 Haven Notify deployed!", "message": "Haven Notify has been successfully deployed and restarted."}' \
|
||||||
|
http://haven.notify/notify
|
||||||
|
@@ -25,7 +25,8 @@ It's built in Go and can be deployed as a container or managed service.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Endpoint**: `/template/notify/backup_template`
|
### Send Backup Notification
|
||||||
|
- **Endpoint**: `/template/notify/backup`
|
||||||
- **Method**: `POST`
|
- **Method**: `POST`
|
||||||
- **Request Body**:
|
- **Request Body**:
|
||||||
```json
|
```json
|
||||||
@@ -42,6 +43,36 @@ It's built in Go and can be deployed as a container or managed service.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Send Update Notification
|
||||||
|
- **Endpoint**: `/template/notify/update`
|
||||||
|
- **Method**: `POST`
|
||||||
|
- **Request Body**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"host": "Notification Title",
|
||||||
|
"asset": "Notification Message",
|
||||||
|
"time": 500 // in seconds
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Send Error Notification
|
||||||
|
- **Endpoint**: `/template/notify/error`
|
||||||
|
- **Method**: `POST`
|
||||||
|
- **Request Body**:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"caller": "Who triggered the error",
|
||||||
|
"message": "Error while moving file",
|
||||||
|
"critical": true,
|
||||||
|
"extra": [
|
||||||
|
{
|
||||||
|
"name": "Additional Info",
|
||||||
|
"value": "Some extra information"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Setup & Usage
|
## Setup & Usage
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
37
haven-notify/template/error.tmpl
Normal file
37
haven-notify/template/error.tmpl
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{{/*
|
||||||
|
Error Notification Template
|
||||||
|
Variables expected:
|
||||||
|
- .caller: The caller of the error
|
||||||
|
- .message: The error message
|
||||||
|
- .critical: Boolean indicating if the error is critical
|
||||||
|
- .extra: Optional array of additional fields with .name and .value
|
||||||
|
*/}}
|
||||||
|
{
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"title": "❌ Error",
|
||||||
|
"description": "**{{.caller}}** encountered an error!",
|
||||||
|
"color": {{if .critical}}15158332{{else}}15844367{{end}},
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "📄 Message",
|
||||||
|
"value": "{{.message}}",
|
||||||
|
"inline": false
|
||||||
|
}
|
||||||
|
{{- if .extra}}
|
||||||
|
{{- range $index, $field := .extra}},
|
||||||
|
{
|
||||||
|
"name": "{{$field.name}}",
|
||||||
|
"value": "{{$field.value}}",
|
||||||
|
"inline": true
|
||||||
|
}
|
||||||
|
{{- end}}
|
||||||
|
{{- end}}
|
||||||
|
],
|
||||||
|
"footer": {
|
||||||
|
"text": "✨ Haven Notify ✨"
|
||||||
|
},
|
||||||
|
"timestamp": "{{formatTime .timestamp}}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user