add webhooks

This commit is contained in:
chandi 2020-06-30 19:44:20 +02:00 committed by chandi
parent e0d019d999
commit 8b921bc624
7 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,13 @@
version: '3.6'
services:
webhooks:
build: mod/webhooks
restart: unless-stopped
environment:
DOMAIN: ${DOMAIN}
SHARED_SECRET: ${SHARED_SECRET}
extra_hosts:
- "redis:10.7.7.5"
networks:
bbb-net:
ipv4_address: 10.7.7.15

View File

@ -0,0 +1,9 @@
# Pass to the webhooks app all requests made to the webhooks API.
location /bigbluebutton/api/hooks {
proxy_pass http://10.7.7.15:3005;
proxy_redirect default;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}

26
mod/webhooks/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM node:12-alpine
# download dockerize
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& apk add subversion \
&& mkdir /app \
&& adduser -D -u 2002 -g webhooks webhooks \
&& chown webhooks:webhooks /app
USER webhooks
ENV TAG v2.2.19
RUN svn checkout https://github.com/bigbluebutton/bigbluebutton/tags/$TAG/bbb-webhooks /app \
&& rm -rf /app/.svn \
&& cd /app && npm install --production
COPY entrypoint.sh /entrypoint.sh
COPY config.yml /app/config/default.yml.tmpl
ENTRYPOINT /entrypoint.sh

67
mod/webhooks/config.yml Normal file
View File

@ -0,0 +1,67 @@
# Shared secret of your BigBlueButton server.
bbb:
serverDomain: {{ .Env.DOMAIN }}
sharedSecret: {{ .Env.SHARED_SECRET }}
# Whether to use Auth2.0 or not, Auth2.0 sends the sharedSecret whithin an Authorization header as a bearer
auth2_0: true
apiPath: /bigbluebutton/api
# The port in which the API server will run.
server:
port: 3005
# Web hooks configs
hooks:
channels:
- from-akka-apps-redis-channel
- from-bbb-web-redis-channel
- from-akka-apps-chat-redis-channel
- bigbluebutton:from-bbb-apps:meeting
- bigbluebutton:from-bbb-apps:users
- bigbluebutton:from-bbb-apps:chat
- bigbluebutton:from-rap
# IP where permanent hook will post data (more than 1 URL means more than 1 permanent hook)
permanentURLs: []
# How many messages will be enqueued to be processed at the same time
queueSize: 10000
# Allow permanent hooks to receive raw message, which is the message straight from BBB
getRaw: false
# If set to higher than 1, will send events on the format:
# "event=[{event1},{event2}],timestamp=000" or "[{event1},{event2}]" (based on using auth2_0 or not)
# when there are more than 1 event on the queue at the moment of processing the queue.
multiEvent: 1
# Retry intervals for failed attempts for perform callback calls.
# In ms. Totals to around 5min.
retryIntervals:
- 100
- 500
- 1000
- 2000
- 4000
- 8000
- 10000
- 30000
- 60000
- 60000
- 60000
- 60000
# Reset permanent interval when exceeding maximum attemps
permanentIntervalReset: 8
# Mappings of internal to external meeting IDs
mappings:
cleanupInterval: 10000 # 10 secs, in ms
timeout: 86400000 # 24 hours, in ms
# Redis
redis:
host: redis
port: 6379
keys:
hookPrefix: bigbluebutton:webhooks:hook
hooks: bigbluebutton:webhooks:hooks
mappings: bigbluebutton:webhooks:mappings
mappingPrefix: bigbluebutton:webhooks:mapping
eventsPrefix: bigbluebutton:webhooks:events
userMaps: bigbluebutton:webhooks:userMaps
userMapPrefix: bigbluebutton:webhooks:userMap

9
mod/webhooks/entrypoint.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
export NODE_ENV=production
cd /app
dockerize \
-wait tcp://redis:6379 \
-template /app/config/default.yml.tmpl:/app/config/default.yml \
node app.js

View File

@ -15,6 +15,9 @@ ENABLE_COTURN=true
# https://docs.bigbluebutton.org/greenlight/gl-overview.html
ENABLE_GREENLIGHT=true
# Enable Webhooks
# used by some integrations
#ENABLE_WEBHOOKS=true
# ====================================
# SECRETS

View File

@ -24,4 +24,8 @@ if [ "$ENABLE_GREENLIGHT" == true ]; then
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.greenlight.yml"
fi
if [ "$ENABLE_WEBHOOKS" == true ]; then
COMPOSE_FILES="$COMPOSE_FILES -f docker-compose.webhooks.yml"
fi
docker-compose $COMPOSE_FILES $@