Add README, Dockerfile and build script
authorSofian Brabez <sbz@6dev.net>
Thu, 24 May 2018 09:42:28 +0000 (10:42 +0100)
committerSofian Brabez <sbz@6dev.net>
Thu, 24 May 2018 09:42:28 +0000 (10:42 +0100)
Dockerfile [new file with mode: 0644]
README.md [new file with mode: 0644]
build.sh [new file with mode: 0755]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..d365f11
--- /dev/null
@@ -0,0 +1,5 @@
+FROM alpine:3.7
+
+COPY vaultmon /
+
+CMD ["/vaultmon"]
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..8c91603
--- /dev/null
+++ b/README.md
@@ -0,0 +1,53 @@
+# Vault Monitor
+
+Monitor connection status and cluster status of [Vault][1] and [Etcd][2] in our
+infrastructure and report issues on Slack.
+
+For the 2 components, it does HTTP/HTTPS connections in order to:
+
+* Test health and aliveness
+* Test cluster status
+
+If tests are failing, it will notify a message on the configured slack
+channel.
+
+# Build Instructions
+
+## Build Go binary
+
+```
+git clone git@github.com:Nitro/vaultmon $GOPATH/src/github.com/Nitro/vaultmon
+cd !$
+GOOS=linux go build
+```
+
+## Build Docker container
+
+```
+./build.sh or bash -x build.sh --no-cache
+```
+
+# Required Env Vars
+
+* `MONITOR_VAULT_URL`: HTTPS Vault Address (Format URL:PORT)
+* `MONITOR_ETCD_URL`: HTTP Etcd Address  (Format URL:PORT)
+* `MONITOR_SLACKWEBHOOK_URL`: HTTPS Slack Webhook URL
+* `MONITOR_SLACK_CHANEL`: Slack channel
+* `MONITOR_VERBOSE`: Enable debug logs
+
+# Example
+
+```
+cat <<EOF >vars
+MONITOR_VAULT_URL=https://vault-address:8200
+MONITOR_ETCD_URL=http://etcd-address:2379
+MONITOR_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/xxx/yyy
+MONITOR_SLACK_CHANNEL="#channel"
+MONITOR_VERBOSE=1
+EOF
+
+docker run --env-file vars gonitro/vaultmon:latest
+```
+
+[1]: https://github.com/hashicorp/vault
+[2]: https://github.com/coreos/etcd
diff --git a/build.sh b/build.sh
new file mode 100755 (executable)
index 0000000..f87638a
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+EXTRA_ARGS="$@"
+
+IMAGE="gonitro/${PWD##*/}"
+TAG=$(git rev-parse --short HEAD)
+IMAGE_NAME="${IMAGE}:${TAG}"
+
+echo Building Docker image ${IMAGE_NAME}
+docker build -t ${IMAGE_NAME} ${EXTRA_ARGS} .
+[[ $? -eq 0 ]] && {
+    docker tag ${IMAGE_NAME} ${IMAGE}:latest
+    echo Publishing ${IMAGE_NAME}
+    docker push ${IMAGE_NAME}
+    docker push ${IMAGE}:latest
+}