https://github.com/handcraftedbits/docker-nginx-unit-webhook
A Docker container that provides a webhook unit for NGINX Host
https://github.com/handcraftedbits/docker-nginx-unit-webhook
Last synced: 11 days ago
JSON representation
A Docker container that provides a webhook unit for NGINX Host
- Host: GitHub
- URL: https://github.com/handcraftedbits/docker-nginx-unit-webhook
- Owner: handcraftedbits
- License: apache-2.0
- Created: 2016-07-22T00:16:41.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-09-26T02:28:44.000Z (over 8 years ago)
- Last Synced: 2025-01-04T01:56:25.366Z (over 1 year ago)
- Language: Shell
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NGINX Host Webhook Unit [](https://hub.docker.com/r/handcraftedbits/nginx-unit-webhook)
A [Docker](https://www.docker.com) container that provides a webhook unit for
[NGINX Host](https://github.com/handcraftedbits/docker-nginx-host).
Webhooks are useful for creating an endpoint that, when accessed, runs a command on the server hosting the webhook.
This is commonly used by REST APIs as a way to subscribe to an event. For example, [GitHub](https://github.com)'s APIs
can call a webhook whenever a push has been made to a Git repository.
This container makes use of [adnanh/webhook](https://github.com/adnanh/webhook) to create webhooks.
# Features
* adnanh/webhook 2.6.2
# Usage
## Configuration
It is highly recommended that you use container orchestration software such as
[Docker Compose](https://www.docker.com/products/docker-compose) when using this NGINX Host unit as several Docker
containers are required for operation. This guide will assume that you are using Docker Compose.
To begin, start with a basic `docker-compose.yml` file as described in the
[NGINX Host configuration guide](https://github.com/handcraftedbits/docker-nginx-host#configuration). Then, add a
service for the NGINX Host webhook unit (named `webhooks`):
```yaml
webhooks:
image: handcraftedbits/nginx-unit-webhook
environment:
- NGINX_UNIT_HOSTS=mysite.com
- NGINX_URL_PREFIX=/webhooks
volumes:
- data:/opt/container/shared
- /home/me/webhooks.json:/opt/container/webhooks.json
```
Observe the following:
* We mount `/opt/container/webhooks.json` using the local file `/home/me/webhooks.json`. This is a file containing our
webhook configuration. Refer to the [documentation](https://github.com/adnanh/webhook/blob/master/README.md) for
information on the contents of this file.
* As with any other NGINX Host unit, we mount our data volume, in this case named `data`, to `/opt/container/shared`.
Finally, we need to create a link in our NGINX Host container to the `webhooks` container in order to host the
webhooks. Here is our final `docker-compose.yml` file:
```yaml
version: "2.1"
volumes:
data:
services:
proxy:
image: handcraftedbits/nginx-host
links:
- webhooks
ports:
- "443:443"
volumes:
- data:/opt/container/shared
- /etc/letsencrypt:/etc/letsencrypt
- /home/me/dhparam.pem:/etc/ssl/dhparam.pem
webhooks:
image: handcraftedbits/nginx-unit-webhook
environment:
- NGINX_UNIT_HOSTS=mysite.com
- NGINX_URL_PREFIX=/webhooks
volumes:
- data:/opt/container/shared
- /home/me/webhooks.json:/opt/container/webhooks.json
```
This will result in making the webhooks available at `https://mysite.com/webhooks`.
## Running the NGINX Host Webhook Unit
Assuming you are using Docker Compose, simply run `docker-compose up` in the same directory as your
`docker-compose.yml` file. Otherwise, you will need to start each container with `docker run` or a suitable
alternative, making sure to add the appropriate environment variables and volume references.
# Reference
## Environment Variables
### `WEBHOOK_VERBOSE`
Used to show verbose webhook logging (e.g., rule matching, command execution) if set to `true`.
**Default value**: `false`
### Others
Please see the NGINX Host [documentation](https://github.com/handcraftedbits/docker-nginx-host#units) for information
on additional environment variables understood by this unit.