mirror of
https://github.com/bigbluebutton/docker.git
synced 2025-02-22 20:50:48 +01:00
bbb3.0: graphql container, postgres with multiple db, repo updates
This commit is contained in:
parent
426349d0d7
commit
4b89a5b52f
4
.gitignore
vendored
4
.gitignore
vendored
@ -19,4 +19,6 @@ postgres-data
|
||||
greenlight-data
|
||||
|
||||
.cache/*/**
|
||||
!.cache/*/.gitkeep
|
||||
!.cache/*/.gitkeep
|
||||
data/*
|
||||
!data/.gitkeep
|
||||
|
@ -1,9 +1,9 @@
|
||||
<img width="1012" alt="bbb-docker-banner" src="https://user-images.githubusercontent.com/1273169/141153216-0386cd4e-0aaf-473a-8f42-a048e52ed0d7.png">
|
||||
|
||||
|
||||
# 📦 BigBlueButton 2.7 Docker
|
||||
# 📦 BigBlueButton 3.0 Docker
|
||||
|
||||
Version: 2.7.3 | [Changelog](CHANGELOG.md) | [Issues](https://github.com/bigbluebutton/docker/issues) | [Upgrading](docs/upgrading.md) | [Development](docs/development.md)
|
||||
Version: 3.0.0-alpha.1 | [Changelog](CHANGELOG.md) | [Issues](https://github.com/bigbluebutton/docker/issues) | [Upgrading](docs/upgrading.md) | [Development](docs/development.md)
|
||||
|
||||
## Features
|
||||
- Easy installation
|
||||
|
0
data/.gitkeep
Normal file
0
data/.gitkeep
Normal file
1
dev.env
1
dev.env
@ -2,6 +2,7 @@
|
||||
|
||||
# enables
|
||||
# - meteor dev server
|
||||
# - watch & restart of bbb-grahql-actions
|
||||
# - accept self signed certificates
|
||||
DEV_MODE=true
|
||||
|
||||
|
@ -260,8 +260,7 @@ services:
|
||||
ipv4_address: 10.7.7.5
|
||||
|
||||
mongodb:
|
||||
container_name: bbb-mongodb
|
||||
image: mongo:4.4
|
||||
image: mongo:6.0
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./mod/mongo/mongod.conf:/etc/mongod.conf
|
||||
@ -276,14 +275,6 @@ services:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.6
|
||||
|
||||
# TODO: remove as soon as not required anymore by webrtc-sfu
|
||||
kurento:
|
||||
image: kurento/kurento-media-server:6.18
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
volumes:
|
||||
- vol-kurento:/var/kurento
|
||||
|
||||
webrtc-sfu:
|
||||
build:
|
||||
context: mod/webrtc-sfu
|
||||
@ -302,9 +293,12 @@ services:
|
||||
FREESWITCH_IP: 10.7.7.1
|
||||
FREESWITCH_SIP_IP: ${EXTERNAL_IPv4}
|
||||
MCS_HOST: 0.0.0.0
|
||||
MCS_ADDRESS: 127.0.0.1
|
||||
MCS_ADDRESS: 0.0.0.0
|
||||
ESL_IP: 10.7.7.1
|
||||
ESL_PASSWORD: ${FSESL_PASSWORD:-ClueCon}
|
||||
RECORDING_ADAPTER: bbb-webrtc-recorder
|
||||
RECORD_WEBCAMS: "true"
|
||||
KURENTO: '[]'
|
||||
# TODO: add mediasoup IPv6
|
||||
# TODO: can listen to 0.0.0.0 for nat support? https://github.com/versatica/mediasoup/issues/487
|
||||
{{ if .Env.EXTERNAL_IPv6 }}
|
||||
@ -351,15 +345,83 @@ services:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
environment:
|
||||
DOMAIN: ${DOMAIN}
|
||||
SHARED_SECRET: ${SHARED_SECRET}
|
||||
POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password}
|
||||
volumes:
|
||||
- vol-freeswitch:/var/freeswitch/meetings
|
||||
- ./data/freeswitch-meetings:/var/freeswitch/meetings
|
||||
- ./conf/settings.yml:/etc/bigbluebutton/bbb-html5.yml:ro
|
||||
networks:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.15
|
||||
|
||||
bbb-graphql-server:
|
||||
build:
|
||||
context: mod/bbb-graphql-server
|
||||
additional_contexts:
|
||||
- src=./repos/bigbluebutton/bbb-graphql-server
|
||||
args:
|
||||
BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }}
|
||||
depends_on:
|
||||
- postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password}
|
||||
networks:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.31
|
||||
|
||||
extra_hosts:
|
||||
- "bbb-web:10.7.7.2"
|
||||
- "bbb-graphql-actions:10.7.7.30"
|
||||
|
||||
bbb-graphql-actions:
|
||||
build:
|
||||
context: mod/bbb-graphql-actions
|
||||
{{ if isTrue .Env.DEV_MODE }}
|
||||
dockerfile: Dockerfile.dev
|
||||
{{ else }}
|
||||
additional_contexts:
|
||||
- src=./repos/bigbluebutton/bbb-graphql-actions
|
||||
{{ end }}
|
||||
args:
|
||||
BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- redis
|
||||
environment:
|
||||
BBB_REDIS_HOST: redis
|
||||
networks:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.30
|
||||
{{ if isTrue .Env.DEV_MODE }}
|
||||
volumes:
|
||||
- ./repos/bigbluebutton/bbb-graphql-actions:/app/:rw
|
||||
- ./.cache/npm:/tmp/.npm:rw
|
||||
{{ end }}
|
||||
|
||||
bbb-graphql-middleware:
|
||||
build:
|
||||
context: mod/bbb-graphql-middleware
|
||||
additional_contexts:
|
||||
- src=./repos/bigbluebutton/bbb-graphql-middleware
|
||||
args:
|
||||
BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- bbb-graphql-server
|
||||
- redis
|
||||
environment:
|
||||
BBB_GRAPHQL_MIDDLEWARE_LISTEN_PORT: 8378
|
||||
BBB_GRAPHQL_MIDDLEWARE_REDIS_ADDRESS: 10.7.7.5:6379
|
||||
BBB_GRAPHQL_MIDDLEWARE_HASURA_WS: ws://bbb-graphql-server:8080/v1/graphql
|
||||
networks:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.32
|
||||
|
||||
jodconverter:
|
||||
build: mod/jodconverter
|
||||
image: alangecker/bbb-docker-jodconverter:latest
|
||||
@ -527,10 +589,10 @@ services:
|
||||
ipv4_address: 10.7.7.21
|
||||
|
||||
postgres:
|
||||
image: postgres:12-alpine
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: greenlight-v3
|
||||
POSTGRES_MULTIPLE_DATABASES: bbb_graphql,hasura_app,greenlight
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: ${POSTGRESQL_SECRET:-password}
|
||||
healthcheck:
|
||||
@ -539,11 +601,10 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
volumes:
|
||||
- ./postgres-data:/var/lib/postgresql/data
|
||||
- ./mod/postgres/initdb.sh:/docker-entrypoint-initdb.d/initdb.sh
|
||||
networks:
|
||||
bbb-net:
|
||||
ipv4_address: 10.7.7.22
|
||||
{{end}}
|
||||
|
||||
{{ if isTrue .Env.ENABLE_PROMETHEUS_EXPORTER }}
|
||||
# prometheus
|
||||
|
@ -26,5 +26,6 @@ COPY bbb-apps-akka.conf /etc/bigbluebutton/bbb-apps-akka.conf.tmpl
|
||||
COPY logback.xml /bbb-apps-akka/conf/logback.xml
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
COPY settings.yml /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml
|
||||
USER bigbluebutton
|
||||
ENTRYPOINT /entrypoint.sh
|
||||
|
@ -11,4 +11,14 @@ services {
|
||||
}
|
||||
http {
|
||||
interface = "0.0.0.0"
|
||||
}
|
||||
|
||||
postgres {
|
||||
properties = {
|
||||
serverName = "10.7.7.22"
|
||||
portNumber = "5432"
|
||||
databaseName = "bbb_graphql"
|
||||
user = "postgres"
|
||||
password = "POSTGRES_PASSWORD"
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ TARGET=/etc/bigbluebutton/bbb-apps-akka.conf
|
||||
cp /etc/bigbluebutton/bbb-apps-akka.conf.tmpl $TARGET
|
||||
sed -i "s/DOMAIN/$DOMAIN/" $TARGET
|
||||
sed -i "s/SHARED_SECRET/$SHARED_SECRET/" $TARGET
|
||||
sed -i "s/POSTGRES_PASSWORD/$POSTGRES_PASSWORD/" $TARGET
|
||||
|
||||
cd /bbb-apps-akka
|
||||
/bbb-apps-akka/bin/bbb-apps-akka
|
7
mod/apps-akka/settings.yml
Normal file
7
mod/apps-akka/settings.yml
Normal file
@ -0,0 +1,7 @@
|
||||
# just the default values required for gettting apps-akka running
|
||||
|
||||
# use ./conf/sertings.yml for modifying anything
|
||||
public:
|
||||
plugins: []
|
||||
userReaction:
|
||||
expire: 30
|
32
mod/bbb-graphql-actions/Dockerfile
Normal file
32
mod/bbb-graphql-actions/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
ARG BBB_BUILD_TAG
|
||||
FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
|
||||
|
||||
COPY --from=src ./ /src
|
||||
RUN cd /src && \
|
||||
npm ci --no-progress && \
|
||||
npm run build
|
||||
|
||||
# delete node_modules (it should create a fresh one inside /src/dist/)
|
||||
RUN rm -rf /src/node_modules
|
||||
|
||||
RUN cd /src/dist && \
|
||||
mv index.js bbb-graphql-actions.js && \
|
||||
cp ../package.json ../package-lock.json . && \
|
||||
npm ci --no-progress --omit=dev
|
||||
|
||||
|
||||
# ------------------------------
|
||||
FROM node:18-bookworm-slim
|
||||
|
||||
COPY --from=builder /src/dist /app
|
||||
|
||||
RUN groupadd -g 2062 app \
|
||||
&& useradd -m -u 2063 -g app app
|
||||
|
||||
USER app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV SERVER_HOST 0.0.0.0
|
||||
|
||||
CMD [ "node", "/app/bbb-graphql-actions.js" ]
|
14
mod/bbb-graphql-actions/Dockerfile.dev
Normal file
14
mod/bbb-graphql-actions/Dockerfile.dev
Normal file
@ -0,0 +1,14 @@
|
||||
ARG BBB_BUILD_TAG
|
||||
FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y gosu
|
||||
|
||||
# allow any user to use node in /root/.nvm
|
||||
RUN chmod 755 /root
|
||||
|
||||
COPY dev-entrypoint.sh /dev-entrypoint.sh
|
||||
ENTRYPOINT [ "/dev-entrypoint.sh" ]
|
||||
|
||||
WORKDIR /app
|
||||
ENV SERVER_HOST 0.0.0.0
|
||||
CMD [ "npm install && npm start" ]
|
12
mod/bbb-graphql-actions/dev-entrypoint.sh
Executable file
12
mod/bbb-graphql-actions/dev-entrypoint.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get owner of /app
|
||||
OWNER="$(stat -c '%u' "/app")"
|
||||
GROUP="$(stat -c '%g' "/app")"
|
||||
useradd --home-dir /tmp -u $OWNER user || /bin/true
|
||||
|
||||
# run with same user to avoid any issues
|
||||
# with file permissions
|
||||
. /root/.nvm/nvm.sh
|
||||
gosu $OWNER:$GROUP bash -c "$@"
|
||||
|
11
mod/bbb-graphql-middleware/Dockerfile
Normal file
11
mod/bbb-graphql-middleware/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
ARG BBB_BUILD_TAG
|
||||
FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
|
||||
|
||||
COPY --from=src / /src/
|
||||
RUN cd /src/ && ./local-build.sh
|
||||
|
||||
|
||||
# ------------------------------
|
||||
FROM alpine
|
||||
COPY --from=builder /src/bbb-graphql-middleware /app/bbb-graphql-middleware
|
||||
CMD [ "/app/bbb-graphql-middleware" ]
|
24
mod/bbb-graphql-server/Dockerfile
Normal file
24
mod/bbb-graphql-server/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
ARG BBB_BUILD_TAG
|
||||
FROM bigbluebutton/bbb-build:$BBB_BUILD_TAG AS builder
|
||||
|
||||
RUN mkdir -p /hasura-cli && cd /hasura-cli && npm install hasura-cli
|
||||
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && chmod a+x /usr/local/bin/yq
|
||||
|
||||
# ----------------------------
|
||||
FROM hasura/graphql-engine:v2.36.0
|
||||
|
||||
# install netstat
|
||||
RUN apt-get update && apt-get install -y net-tools gosu
|
||||
|
||||
COPY --from=builder /usr/local/bin/yq /usr/local/bin/yq
|
||||
COPY --from=builder /hasura-cli/node_modules/hasura-cli/hasura /usr/local/bin/hansura
|
||||
|
||||
COPY --from=src /bbb_schema.sql /app/
|
||||
COPY --from=src /metadata /app/metadata
|
||||
|
||||
COPY config.yaml /app/config.yaml
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
COPY start.sh /app/start.sh
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
CMD [ "/app/start.sh" ]
|
7
mod/bbb-graphql-server/config.yaml
Normal file
7
mod/bbb-graphql-server/config.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
version: 3
|
||||
endpoint: http://localhost:8080
|
||||
admin_secret: bigbluebutton
|
||||
metadata_directory: metadata
|
||||
actions:
|
||||
kind: synchronous
|
||||
handler_webhook_baseurl: http://localhost:3000
|
22
mod/bbb-graphql-server/entrypoint.sh
Executable file
22
mod/bbb-graphql-server/entrypoint.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# for psql
|
||||
export PGHOST=postgres
|
||||
export PGUSER="${POSTGRES_USER}"
|
||||
export PGPASSWORD="${POSTGRES_PASSWORD}"
|
||||
|
||||
|
||||
# for hasura
|
||||
export HASURA_GRAPHQL_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/hasura_app
|
||||
export HASURA_GRAPHQL_METADATA_DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/hasura_app
|
||||
export HASURA_GRAPHQL_LOG_LEVEL=warn
|
||||
export HASURA_GRAPHQL_ENABLE_CONSOLE=false
|
||||
export HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=250
|
||||
export HASURA_GRAPHQL_STREAMING_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=100
|
||||
export HASURA_GRAPHQL_ADMIN_SECRET=bigbluebutton # TODO: improve security
|
||||
export HASURA_GRAPHQL_ENABLE_TELEMETRY=false
|
||||
export HASURA_GRAPHQL_AUTH_HOOK=http://bbb-web:8090/bigbluebutton/connection/checkGraphqlAuthorization
|
||||
export HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL=http://bbb-graphql-actions:8093
|
||||
|
||||
|
||||
exec $@
|
39
mod/bbb-graphql-server/start.sh
Executable file
39
mod/bbb-graphql-server/start.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /app/
|
||||
|
||||
# patch database url
|
||||
# TODO: this should be possible via an environment variable
|
||||
yq e -i '.[1].configuration.connection_info.database_url.connection_parameters.host = "postgres"' metadata/databases/databases.yaml
|
||||
yq e -i ".[1].configuration.connection_info.database_url.connection_parameters.password = \"${POSTGRES_PASSWORD}\"" metadata/databases/databases.yaml
|
||||
|
||||
|
||||
echo "SELECT 'CREATE DATABASE hasura_app' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'hasura_app')\gexec" | psql
|
||||
|
||||
echo "Restarting database bbb_graphql"
|
||||
psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE datname = 'bbb_graphql'" > /dev/null
|
||||
psql -c "drop database if exists bbb_graphql with (force)"
|
||||
psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'"
|
||||
psql -c "alter database bbb_graphql set timezone to 'UTC'"
|
||||
|
||||
echo "Creating tables in bbb_graphql"
|
||||
psql -U postgres -d bbb_graphql -q -f bbb_schema.sql --set ON_ERROR_STOP=on
|
||||
|
||||
echo "Starting hasura-graphql-engine"
|
||||
gosu nobody graphql-engine serve &
|
||||
PID=$!
|
||||
|
||||
sleep 1
|
||||
|
||||
|
||||
#Check if Hasura is ready before applying metadata
|
||||
HASURA_PORT=8080
|
||||
while ! netstat -tuln | grep ":$HASURA_PORT " > /dev/null; do
|
||||
echo "Waiting for Hasura's port ($HASURA_PORT) to be ready..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Applying new metadata to Hasura"
|
||||
/usr/local/bin/hansura metadata apply --skip-update-check
|
||||
|
||||
wait "$PID"
|
@ -15,12 +15,12 @@ mongod --oplogSize 8 --replSet rs0 --noauth \
|
||||
--pidfilepath /tmp/docker-entrypoint-temp-mongod.pid --fork
|
||||
|
||||
# init replset with defaults
|
||||
mongo 10.7.7.6 --eval "rs.initiate({
|
||||
mongosh 10.7.7.6 --eval "rs.initiate({
|
||||
_id: 'rs0',
|
||||
members: [ { _id: 0, host: '10.7.7.6:27017' } ]
|
||||
})"
|
||||
|
||||
echo "Waiting to become a master"
|
||||
echo 'while (!db.isMaster().ismaster) { sleep(100); }' | mongo
|
||||
echo 'while (!db.isMaster().ismaster) { sleep(100); }' | mongosh
|
||||
|
||||
echo "I'm the master!"
|
24
mod/nginx/bbb/graphql.nginx
Normal file
24
mod/nginx/bbb/graphql.nginx
Normal file
@ -0,0 +1,24 @@
|
||||
location /graphql-test {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
|
||||
# Websocket connection
|
||||
location /v1/graphql {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
#proxy_pass http://127.0.0.1:8080; #Hasura
|
||||
proxy_pass http://10.7.7.32:8378; #Graphql Middleware
|
||||
}
|
||||
|
||||
location /api/rest {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://127.0.0.1:8080; #Hasura
|
||||
}
|
21
mod/postgres/initdb.sh
Executable file
21
mod/postgres/initdb.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
function create_user_and_database() {
|
||||
local database=$1
|
||||
echo " Creating user and database '$database'"
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
|
||||
CREATE DATABASE $database;
|
||||
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
|
||||
EOSQL
|
||||
}
|
||||
|
||||
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then
|
||||
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES"
|
||||
for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do
|
||||
create_user_and_database $db
|
||||
done
|
||||
echo "Multiple databases created"
|
||||
fi
|
@ -1 +1 @@
|
||||
Subproject commit c0de0ff3857146da4924233d36b710874d16a26f
|
||||
Subproject commit fe901bd15cadcb33f935900f804926f36793c48d
|
@ -1 +1 @@
|
||||
Subproject commit 5d671b3b506712e54093f50c2a4bdb9995982fab
|
||||
Subproject commit b674477a40a3060738219d8a58915f1bcaf8738b
|
Loading…
Reference in New Issue
Block a user