webhooks: avoid including whole config file

This commit is contained in:
chandi 2022-04-03 23:24:20 +02:00
parent 83eee18228
commit 7eb142b43e
3 changed files with 30 additions and 94 deletions

View File

@ -1,26 +1,24 @@
FROM node:14-alpine
# download dockerize
ENV DOCKERIZE_VERSION v0.6.1
RUN wget -q 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
FROM node:14.18.1-bullseye-slim AS builder
ENV TAG v2.4.0
RUN svn checkout https://github.com/bigbluebutton/bigbluebutton/tags/$TAG/bbb-webhooks /app \
&& rm -rf /app/.svn \
&& cd /app && npm install --production
RUN apt-get update && apt-get install -y git wget
RUN wget -q https://github.com/mikefarah/yq/releases/download/v4.20.1/yq_linux_amd64 -O /usr/bin/yq \
&& chmod +x /usr/bin/yq
COPY ./bbb-webhooks /bbb-webhooks
RUN cd /bbb-webhooks && npm install --production
RUN chmod 777 /bbb-webhooks/config
# ------------------------------
FROM node:14.18.1-bullseye-slim
RUN useradd --uid 2004 --user-group bbb-webhooks
COPY --from=builder /usr/bin/yq /usr/bin/yq
COPY --from=builder /bbb-webhooks /bbb-webhooks
COPY entrypoint.sh /entrypoint.sh
COPY config.yml /app/config/default.yml.tmpl
USER bbb-webhooks
ENTRYPOINT /entrypoint.sh

View File

@ -1,70 +0,0 @@
# 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:
bind: 0.0.0.0
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
# Hook's request module timeout for socket conn establishment and/or responses (ms)
requestTimeout: 5000
# 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

View File

@ -1,9 +1,17 @@
#!/bin/sh
set -e
TARGET=/bbb-webhooks/config/production.yml
cp /bbb-webhooks/config/default.example.yml $TARGET
yq e -i ".bbb.sharedSecret = \"$SHARED_SECRET\"" $TARGET
yq e -i ".bbb.serverDomain = \"$DOMAIN\"" $TARGET
yq e -i ".bbb.auth2_0 = true" $TARGET
yq e -i ".server.bind = \"0.0.0.0\"" $TARGET
yq e -i ".hooks.getRaw = false" $TARGET
yq e -i ".redis.host = \"redis\"" $TARGET
export NODE_ENV=production
cd /app
dockerize \
-wait tcp://redis:6379 \
-template /app/config/default.yml.tmpl:/app/config/default.yml \
node app.js
cd /bbb-webhooks
node app.js