All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Test automated-nfs-backup / test-automated-nfs-backup (push) Successful in 3s
Haven Notify Build and Deploy / Build Haven Notify Image (push) Successful in 22s
Haven Notify Build and Deploy / Deploy Haven Notify (internal) (push) Successful in 10s
- haven-notify.yaml: replace hand-rolled build+deploy (broken docker/build-push-action remote-builder path) with pipeline-actions build-and-push + deploy-restart; full Gitea uses: URLs; ubuntu-amd64. - main.yaml / test-automated-nfs-backup.yaml: runner label ubuntu-latest -> ubuntu-amd64. - haven-notify/README.md: point to infra/haven-notify.yaml in the haven repo; fix secret name to discord-webhook/HAVEN_WEBHOOK_URL.
97 lines
2.1 KiB
Markdown
97 lines
2.1 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",
|
|
"asset": "Notification Asset Name",
|
|
"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
|
|
The Deployment/Service/Ingress manifest lives in the **`haven`** homelab repo at `infra/haven-notify.yaml` (this repo only holds the Go source + Dockerfile + CI).
|
|
1. Edit the manifest to set your environment variables.
|
|
2. Create a generic secret named `discord-webhook` with `HAVEN_WEBHOOK_URL=your_webhook_url`:
|
|
- `kubectl create secret generic discord-webhook --from-literal=HAVEN_WEBHOOK_URL=<your_webhook_url> -n <namespace>`
|
|
3. Apply deployment (from the `haven` repo):
|
|
```sh
|
|
kubectl apply -f infra/haven-notify.yaml
|
|
```
|