aboutsummaryrefslogtreecommitdiff
path: root/bin/hook/etc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/hook/etc')
-rw-r--r--bin/hook/etc/README.md12
-rw-r--r--bin/hook/etc/webhook.conf34
-rw-r--r--bin/hook/etc/webhook.service14
3 files changed, 60 insertions, 0 deletions
diff --git a/bin/hook/etc/README.md b/bin/hook/etc/README.md
new file mode 100644
index 0000000..e918e07
--- /dev/null
+++ b/bin/hook/etc/README.md
@@ -0,0 +1,12 @@
+Webhook Config Files
+====================
+
+Various [webhook][] daemon configuration files. The files are as
+follows:
+
+* `webhook.service`: [systemd][] service file for [webhook][] daemon
+* `webhook.conf`: [webhook][] config file ([JSON][]-formatted).
+
+[systemd]: https://en.wikipedia.org/wiki/Systemd "Linux system management daemon"
+[webhook]: https://github.com/adnanh/webhook "minimal webhook daemon"
+[json]: https://json.org "JavaScript Object Notation"
diff --git a/bin/hook/etc/webhook.conf b/bin/hook/etc/webhook.conf
new file mode 100644
index 0000000..95c4ca5
--- /dev/null
+++ b/bin/hook/etc/webhook.conf
@@ -0,0 +1,34 @@
+[{
+ "id": "deploy-pablotron-org",
+ "execute-command": "/data/www/pablotron.org/bin/hook/deploy.rb",
+
+ "pass-arguments-to-command": [{
+ "source": "payload",
+ "name": "time"
+ }],
+
+ "pass-environment-to-command": [{
+ "source": "string",
+ "envname": "DEPLOY_HTDOCS_PATH",
+ "name": "/data/www/pablotron.org/htdocs"
+ }, {
+ "source": "string",
+ "envname": "DEPLOY_REPO_DIR",
+ "name": "/data/www/pablotron.org/data/git/pablotron.org"
+ }, {
+ "source": "string",
+ "envname": "DEPLOY_BUILDS_DIR",
+ "name": "/data/www/pablotron.org/data/builds"
+ }],
+
+ "trigger-rule": {
+ "match": {
+ "type": "payload-hmac-sha256",
+ "secret": "omitted",
+ "parameter": {
+ "source": "header",
+ "name": "X-Hub-Signature"
+ }
+ }
+ }
+}]
diff --git a/bin/hook/etc/webhook.service b/bin/hook/etc/webhook.service
new file mode 100644
index 0000000..20cd6bb
--- /dev/null
+++ b/bin/hook/etc/webhook.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Webhook daemon
+After=network.target
+ConditionPathExists=/etc/webhook.conf
+
+[Service]
+# debian/ubuntu version of webhook is comically old, so i'm using the static
+# binary from the github releases page
+# ExecStart=/usr/local/bin/webhook -port 9000 -hooks /etc/webhook.conf -urlprefix '' -verbose
+ExecStart=/usr/local/bin/webhook -port 9000 -hooks /etc/webhook.conf -urlprefix ''
+RunAs=webhook
+
+[Install]
+WantedBy=multi-user.target