From df8c6ef8f7c47af7f0757eae49a7ad2bd56a1ea5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 12 Jan 2022 19:43:31 +0100 Subject: [PATCH] use webhook tool --- deployment/bare_metal/install.sh | 41 ++++++++++++++++++- .../sites-available/gradido.conf.ssl.template | 5 +++ .../sites-available/gradido.conf.template | 5 +++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/deployment/bare_metal/install.sh b/deployment/bare_metal/install.sh index 091f86e5b..fe6c770ae 100755 --- a/deployment/bare_metal/install.sh +++ b/deployment/bare_metal/install.sh @@ -105,4 +105,43 @@ git config pull.ff only # Allow nginx configuration and restart for gradido sudo nano /etc/sudoers.d/gradido > gradido ALL=(ALL) NOPASSWD: /etc/init.d/nginx start,/etc/init.d/nginx stop,/etc/init.d/nginx restart -sudo chmod a+rw /etc/nginx/sites-enabled \ No newline at end of file +sudo chmod a+rw /etc/nginx/sites-enabled + +# Webhooks (optional) +sudo apt install webhook +nano ~/hooks.json +``` +[ + { + "id": "gradido", + "execute-command": "/home/gradido/gradido/deployment/bare_metal/start.sh", + "command-working-directory": "/home/gradido/gradido/deployment/bare_metal", + "trigger-rule": { + "and": [ + { + "match": { + "type": "payload-hash-sha1", + "secret": "secret", + "parameter": { + "source": "header", + "name": "X-Hub-Signature" + } + } + }, + { + "match": { + "type": "value", + "value": "refs/heads/new_deployment", + "parameter": { + "source": "payload", + "name": "ref" + } + } + } + ] + } + } +] +``` + +webhook -hooks ~/hooks.json & \ No newline at end of file diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template index 07c7c3779..845cf56ad 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.ssl.template @@ -70,6 +70,11 @@ server { proxy_redirect off; } + # Webhook reverse proxy + location /hooks/ { + proxy_pass http://127.0.0.1:9000/hooks/; + } + # Admin Frontend location /admin { proxy_http_version 1.1; diff --git a/deployment/bare_metal/nginx/sites-available/gradido.conf.template b/deployment/bare_metal/nginx/sites-available/gradido.conf.template index 44521823d..e76140b56 100644 --- a/deployment/bare_metal/nginx/sites-available/gradido.conf.template +++ b/deployment/bare_metal/nginx/sites-available/gradido.conf.template @@ -56,6 +56,11 @@ server { proxy_redirect off; } + # Webhook reverse proxy + location /hooks/ { + proxy_pass http://127.0.0.1:9000/hooks/; + } + # Admin Frontend location /admin { proxy_http_version 1.1;