Initialize project with DIUN Webhook Dashboard: core Go app, Docker setup, static assets, and documentation.
This commit is contained in:
69
README.md
Normal file
69
README.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# DIUN Webhook Dashboard
|
||||
|
||||
A tiny Go web app that receives [DIUN](https://crazymax.dev/diun/) webhook events and shows the latest image updates in a simple UI.
|
||||
|
||||
- Receives DIUN webhooks at `POST /webhook`
|
||||
- Serves a minimal dashboard at `/`
|
||||
- Exposes a read-only API at `GET /api/updates`
|
||||
- Stores events in memory (ephemeral)
|
||||
|
||||
## Quick start
|
||||
|
||||
### Run locally (Go 1.26+)
|
||||
```bash
|
||||
go run .
|
||||
# open http://localhost:8080
|
||||
```
|
||||
|
||||
### Docker
|
||||
```bash
|
||||
docker build -t diun-webhook-dashboard .
|
||||
docker run --rm -p 8080:8080 diun-webhook-dashboard
|
||||
# open http://localhost:8080
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
```bash
|
||||
docker compose up -d
|
||||
# open http://localhost:8080
|
||||
```
|
||||
|
||||
## DIUN configuration example
|
||||
Configure DIUN to send webhooks to this app. Example (YAML):
|
||||
|
||||
```yaml
|
||||
notif:
|
||||
webhook:
|
||||
enable: true
|
||||
endpoint: http://your-host-or-ip:8080/webhook
|
||||
```
|
||||
|
||||
Expected JSON payload (simplified):
|
||||
```json
|
||||
{
|
||||
"image": "library/nginx",
|
||||
"tag": "1.27.0",
|
||||
"status": "new",
|
||||
"time": "2026-02-23T16:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
- `POST /webhook` — accept a DIUN event JSON body.
|
||||
- `GET /api/updates` — return the latest events as a JSON object keyed by image name.
|
||||
- `/` — static HTML dashboard.
|
||||
|
||||
Note: data is only kept in-memory and will be reset on restart.
|
||||
|
||||
## Development
|
||||
- Code: `main.go`
|
||||
- Static assets: `static/`
|
||||
- Container image: `Dockerfile`
|
||||
|
||||
## Production notes
|
||||
- Behind a reverse proxy, ensure the app is reachable at `/webhook` from DIUN.
|
||||
- Persistence is not implemented; hook up a store (e.g., BoltDB/Redis/Postgres) if you need durability.
|
||||
- Consider adding auth, rate limiting, or a secret/token on the webhook endpoint if exposed publicly.
|
||||
|
||||
## License
|
||||
MIT — see `LICENSE`.
|
||||
Reference in New Issue
Block a user