96 lines
1.9 KiB
Markdown
96 lines
1.9 KiB
Markdown
<div align="center">
|
|
<img src="./assets/widelogo.png" alt="Haven Notify Logo">
|
|
</div>
|
|
|
|
## Overview
|
|
Haven Notify is an internal service designed to send notifications to a specified Discord channel.
|
|
|
|
It's built in Go and can be deployed as a container or managed service.
|
|
|
|
## Prerequisites
|
|
- Go 1.18 or newer
|
|
- Docker
|
|
- A Discord Webhook URL
|
|
|
|
## API Specification
|
|
|
|
### Send Notification
|
|
- **Endpoint**: `/notify`
|
|
- **Method**: `POST`
|
|
- **Request Body**:
|
|
```json
|
|
{
|
|
"title": "Notification Title",
|
|
"message": "Notification Message"
|
|
}
|
|
```
|
|
|
|
### Send Backup Notification
|
|
- **Endpoint**: `/template/notify/backup`
|
|
- **Method**: `POST`
|
|
- **Request Body**:
|
|
```json
|
|
{
|
|
"title": "Notification Title",
|
|
"message": "Notification Message",
|
|
"backupSizeInMB": 500,
|
|
"extra": [
|
|
{
|
|
"name": "Additional Info",
|
|
"value": "Some extra information"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### 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
|
|
|
|
### Docker
|
|
1. Build the Docker image:
|
|
```sh
|
|
docker build -t haven-notify .
|
|
```
|
|
2. Run the container:
|
|
```sh
|
|
docker run -e WEBHOOK_URL=your_webhook_url haven-notify
|
|
```
|
|
|
|
### Kubernetes
|
|
Deployment manifest is available at `deploy/haven-notify.yaml`.
|
|
1. Edit the manifest to set your environment variables.
|
|
2. Create a generic secret named `WEBHOOK_URL` with `discord-webhook=your_webhook_url`
|
|
3. Apply deployment:
|
|
```sh
|
|
kubectl apply -f deploy/haven-notify.yaml
|
|
```
|