mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-12-25 23:03:34 +01:00
update webhook
This commit is contained in:
@@ -9,7 +9,7 @@ execute configured commands.
|
||||
|
||||
## Directory Tree
|
||||
|
||||
```
|
||||
```bash
|
||||
~/fig/webhook/
|
||||
├── docker-compose.yml
|
||||
└── data/
|
||||
@@ -17,36 +17,24 @@ execute configured commands.
|
||||
└── test.sh* (executable)
|
||||
```
|
||||
|
||||
docker-compose.yml
|
||||
File: data/hooks.yaml
|
||||
|
||||
```yaml
|
||||
webhook:
|
||||
image: vimagick/webhook
|
||||
ports:
|
||||
- "9000:9000"
|
||||
volumes:
|
||||
- "./data:/etc/webhook"
|
||||
restart: always
|
||||
- id: test
|
||||
execute-command: /etc/webhook/test.sh
|
||||
pass-file-to-command:
|
||||
- source: entire-payload
|
||||
envname: HOOK_PAYLOAD
|
||||
command-working-directory: /etc/webhook
|
||||
include-command-output-in-response: true
|
||||
```
|
||||
|
||||
hooks.json
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "test",
|
||||
"execute-command": "/etc/webhook/test.sh",
|
||||
"command-working-directory": "/etc/webhook",
|
||||
"include-command-output-in-response": true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
test.sh
|
||||
File: data/test.sh
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
echo 'hello world'
|
||||
cat $HOOK_PAYLOAD
|
||||
```
|
||||
|
||||
## Up and Running
|
||||
@@ -59,26 +47,27 @@ $ chmod +x data/test.sh
|
||||
$ docker-compose up -d
|
||||
Creating webhook_webhook_1...
|
||||
|
||||
$ curl http://localhost:9000/hooks/test
|
||||
$ curl http://localhost:9000/hooks/test -d hello=world
|
||||
hello world
|
||||
{"hello":"world"}
|
||||
|
||||
$ docker-compose logs
|
||||
Attaching to webhook_webhook_1
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 version 2.3.5 starting
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 setting up os signal watcher
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 attempting to load hooks from hooks.json
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 loaded 1 hook(s) from file
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 > test
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 starting insecure (http) webhook on :9000
|
||||
webhook_1 | [webhook] 2015/11/05 04:26:52 os signal watcher ready
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 Started GET /hooks/test
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 Completed 200 OK in 390.207µs
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 test got matched (1 time(s))
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 test hook triggered successfully
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 executing /scripts/test.sh (/scripts/test.sh) with arguments [/scripts/test.sh] using /scripts as cwd
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 command output: hello world
|
||||
webhook_1 |
|
||||
webhook_1 | [webhook] 2015/11/05 04:27:11 finished handling test
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 version 2.8.1 starting
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 setting up os signal watcher
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 attempting to load hooks from hooks.json
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 loaded 1 hook(s) from file
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 > test
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 starting insecure (http) webhook on :9000
|
||||
webhook_1 | [webhook] 2024/02/20 04:26:52 os signal watcher ready
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 Started GET /hooks/test
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 Completed 200 OK in 390.207µs
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 test got matched (1 time(s))
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 test hook triggered successfully
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 executing /scripts/test.sh (/scripts/test.sh) with arguments ["/etc/webhook/test.sh"] and environment [HOOK_PAYLOAD=/etc/webhook/HOOK_PAYLOAD967569167] using /etc/webhook as cwd
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 command output: hello world
|
||||
webhook_1 | {"hello":"world"}
|
||||
webhook_1 | [webhook] 2024/02/20 04:27:11 finished handling test
|
||||
```
|
||||
|
||||
[1]: https://github.com/adnanh/webhook
|
||||
|
||||
Reference in New Issue
Block a user