xmpp-webhook

webhook to xmpp gateway (clone of https://github.com/opthomas-prime/xmpp-webhook/ with my own mods)
git clone https://git.e1e0.net/xmpp-webhook.git
Log | Files | Refs | README | LICENSE

commit 3479416115f8d7595f5a95f10c3bd4d11ea42dc9
parent bff7a15fdb296a38859427f9675e30aa76d4406f
Author: Thomas Maier <contact@thomas-maier.net>
Date:   Tue, 26 Sep 2017 16:40:07 +0200

README WiP

Diffstat:
MREADME.md | 37+++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -8,22 +8,47 @@ ## Usage - `xmpp-webhook` is configured via environment variables: - `XMPP_ID` - The JID we want to use - - `XMPP_PAS` - The password + - `XMPP_PASS` - The password - `XMPP_RECEIVERS` - Comma-seperated list of JID's -- After startup `xmpp-webhooks` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.: +- After startup, `xmpp-webhooks` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.: ``` -curl -X POST -d @grafana-alert.json localhost:4321 +curl -X POST -d @grafana-alert.json localhost:4321/grafana ``` - After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured receivers. ``` + + +https://github.com/golang/dep +go get -u github.com/golang/dep/cmd/dep +``` + +## Installation +IMPORTANT NOTE: For the sake of simplicity, `xmpp-webhooks` is not reconnecting to the XMPP server after a connection-loss. If you use the provided `xmpp-webhook.service` - Systemd will manage the reconnect by restarting the service. + +- Download and extract the latest tarball (GitHub release page) +- Install the binary: `install -D -m 744 xmpp-webhook /usr/local/bin/xmpp-webhook` +- Install the service: `install -D -m 644 xmpp-webhook.service /etc/systemd/system/xmpp-webhook.service` +- Configure XMMP credentials in `/etc/xmpp-webhook.env`. e.g.: + +``` XMPP_ID='bot@example.com' XMPP_PASS='passw0rd' XMPP_RECEIVERS='jdoe@example.com,ops@example.com' +``` -/etc/systemd/system/xmpp-webhook.service +- Enable and start the service: -https://github.com/golang/dep -go get -u github.com/golang/dep/cmd/dep ``` +systemctl daemon-reload +systemctl enable xmpp-webhook +systemctl start xmpp-webhook +``` + +## Building +- Get the sources: `go get -u github.com/opthomas-prime/xmpp-webhook` +- Install `dep`: https://github.com/golang/dep +- Change in the project folder: `cd $GOPATH/src/github.com/opthomas-prime/xmpp-webhook` +- Populate `vendor` folder: `dep ensure` +- Build `xmpp-webhook`: `go build`