Browse Source

WIP: spot

Saúl Ibarra Corretgé 5 years ago
parent
commit
543d4e8c6d

+ 1 - 1
Makefile

@@ -2,7 +2,7 @@ FORCE_REBUILD ?= 0
 JITSI_RELEASE ?= stable
 JITSI_BUILD ?= latest
 JITSI_REPO ?= jitsi
-JITSI_SERVICES ?= base base-java web prosody jicofo jvb jigasi jibri
+JITSI_SERVICES ?= base base-java web prosody jicofo jvb jigasi jibri spot
 
 BUILD_ARGS := --build-arg JITSI_REPO=$(JITSI_REPO) --build-arg JITSI_RELEASE=$(JITSI_RELEASE)
 ifeq ($(FORCE_REBUILD), 1)

+ 1 - 0
docker-compose.yml

@@ -86,6 +86,7 @@ services:
             - RESOLUTION_MIN
             - RESOLUTION_WIDTH
             - RESOLUTION_WIDTH_MIN
+            - SPOT_URL_BASE
             - START_AUDIO_ONLY
             - START_AUDIO_MUTED
             - START_WITH_AUDIO_MUTED

+ 18 - 0
env.example

@@ -126,6 +126,24 @@ ETHERPAD_SKIN_VARIANTS=super-light-toolbar super-light-editor light-background f
 # SIP server transport
 #JIGASI_SIP_TRANSPORT=UDP
 
+
+#
+# Spot configuration (for integration with pysical meeting rooms)
+#
+
+# Set Spot client URL (uncomment to enable).
+#SPOT_URL_BASE=http://spot.meet.jitsi:9002
+
+# Google Calendar client ID for calendar integration.
+#SPOT_GOOGLE_CALENDAR_ID=
+
+# Microsoft application client id to be used for interacting with an Outlook calendar.
+#SPOT_OUTLOOK_CALENDAR_ID=
+
+# Background image
+#SPOT_BG_IMAGE=
+
+
 #
 # Authentication configuration (see handbook for details)
 #

+ 18 - 0
spot.yml

@@ -0,0 +1,18 @@
+version: '3'
+
+services:
+    spot:
+        image: jitsi/spot
+        volumes:
+            - ${CONFIG}/spot:/config
+        environment:
+            - PUBLIC_URL
+            - SPOT_BG_IMAGE
+            - SPOT_GOOGLE_CALENDAR_ID
+            - SPOT_OUTLOOK_CALENDAR_ID
+            - XMPP_DOMAIN
+            - XMPP_MUC_DOMAIN
+        networks:
+            meet.jitsi:
+                aliases:
+                    - spot.meet.jitsi

+ 30 - 0
spot/Dockerfile

@@ -0,0 +1,30 @@
+ARG JITSI_REPO=jitsi
+
+FROM node:10-stretch-slim AS builder
+
+ADD https://github.com/jitsi/jitsi-meet-spot/archive/master.tar.gz /tmp/spot.tar.gz
+WORKDIR /build
+
+RUN \
+    apt update && apt install -y git && \
+    tar xvf /tmp/spot.tar.gz --strip 1 && \
+    cd spot-client && \
+    npm install && \
+    npm run build:prod
+
+
+FROM ${JITSI_REPO}/base
+
+RUN \
+	apt-dpkg-wrap apt-get update && \
+	apt-dpkg-wrap apt-get install -y nginx && \
+	apt-cleanup && \
+	rm -f /etc/nginx/conf.d/default.conf
+
+COPY rootfs/ /
+COPY --from=builder /build/spot-client/dist /usr/share/spot-client/dist
+COPY --from=builder /build/spot-client/index.html /usr/share/spot-client/
+
+EXPOSE 9002
+
+VOLUME ["/config"]

+ 4 - 0
spot/Makefile

@@ -0,0 +1,4 @@
+build:
+	docker build $(BUILD_ARGS) -t $(JITSI_REPO)/spot .
+
+.PHONY: build

+ 36 - 0
spot/rootfs/defaults/config.js

@@ -0,0 +1,36 @@
+/**
+ * Overrides for the default configuration for Spot. See file default-config.js
+ * for all the default values which are used.
+ */
+window.JitsiMeetSpotConfig = {
+{{ $SPOT_DOMAIN := trimPrefix "https://" .Env.PUBLIC_URL }}
+    DEFAULT_MEETING_DOMAIN: '{{ $SPOT_DOMAIN }}',
+    EXTERNAL_API_SRC: '{{ .Env.PUBLIC_URL }}/external_api.js',
+{{ if .Env.SPOT_BG_IMAGE }}
+    DEFAULT_BACKGROUND_IMAGE_URL: '{{ .Env.SPOT_BG_IMAGE }}',
+{{ end }}
+    CALENDARS: {
+{{ if .Env.SPOT_GOOGLE_CALENDAR_ID }}
+        GOOGLE: {
+            CLIENT_ID: '{{ .Env.SPOT_GOOGLE_CALENDAR_ID }}'
+        },
+{{ end }}
+{{ if .Env.SPOT_OUTLOOK_CALENDAR_ID }}
+        OUTLOOK: {
+            CLIENT_ID: '{{ .Env.SPOT_OUTLOOK_CALENDAR_ID }}'
+        },
+{{ end }}
+        _: ''
+    },
+    MEETING_DOMAINS_WHITELIST: [
+        '{{ $SPOT_DOMAIN }}',
+        'meet.jit.si'
+    ],
+    XMPP_CONFIG: {
+        bosh: '{{ .Env.PUBLIC_URL }}/http-bind',
+        hosts: {
+            domain: '{{ .Env.XMPP_DOMAIN }}',
+            muc: '{{ .Env.XMPP_MUC_DOMAIN }}'
+        }
+    }
+};

+ 4 - 0
spot/rootfs/defaults/default

@@ -0,0 +1,4 @@
+server {
+	listen 9002 default_server;
+	include /config/nginx/spot.conf;
+}

+ 61 - 0
spot/rootfs/defaults/nginx.conf

@@ -0,0 +1,61 @@
+user www-data;
+worker_processes 4;
+pid /run/nginx.pid;
+include /etc/nginx/modules-enabled/*.conf;
+
+events {
+	worker_connections 768;
+	# multi_accept on;
+}
+
+http {
+
+	##
+	# Basic Settings
+	##
+
+	sendfile on;
+	tcp_nopush on;
+	tcp_nodelay on;
+	keepalive_timeout 65;
+	types_hash_max_size 2048;
+	# server_tokens off;
+
+	# server_names_hash_bucket_size 64;
+	# server_name_in_redirect off;
+
+	client_max_body_size 0;
+
+	include /etc/nginx/mime.types;
+	default_type application/octet-stream;
+
+	##
+	# Logging Settings
+	##
+
+	access_log /dev/stdout;
+	error_log /dev/stderr;
+
+	##
+	# Gzip Settings
+	##
+
+	gzip on;
+	gzip_disable "msie6";
+
+	# gzip_vary on;
+	# gzip_proxied any;
+	# gzip_comp_level 6;
+	# gzip_buffers 16 8k;
+	# gzip_http_version 1.1;
+	# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+
+	##
+	# Virtual Host Configs
+	##
+
+    include /config/nginx/site-confs/*;
+}
+
+
+daemon off;

+ 18 - 0
spot/rootfs/defaults/spot.conf

@@ -0,0 +1,18 @@
+server_name _;
+
+client_max_body_size 0;
+
+root /usr/share/spot-client;
+index index.html;
+
+location ~ ^/(.*)$ {
+    try_files $uri @root_path;
+}
+
+location @root_path {
+    rewrite ^/(.*)$ / break;
+}
+
+location / {
+
+}

+ 24 - 0
spot/rootfs/etc/cont-init.d/10-config

@@ -0,0 +1,24 @@
+#!/usr/bin/with-contenv bash
+
+# make our folders
+mkdir -p \
+    /config/nginx/site-confs \
+    /run \
+    /var/lib/nginx/tmp/client_body \
+    /var/tmp/nginx
+
+# copy config files
+if [[ ! -f /config/nginx/nginx.conf ]]; then
+    cp /defaults/nginx.conf /config/nginx/nginx.conf
+fi
+
+if [[ ! -f /config/nginx/spot.conf ]]; then
+    cp /defaults/spot.conf /config/nginx/spot.conf
+fi
+
+if [[ ! -f /config/nginx/site-confs/default ]]; then
+    cp /defaults/default /config/nginx/site-confs/default
+fi
+
+tpl /defaults/config.js > /config/config.js
+cp /config/config.js /usr/share/spot-client/dist/config/config.js

+ 3 - 0
spot/rootfs/etc/services.d/nginx/run

@@ -0,0 +1,3 @@
+#!/usr/bin/with-contenv bash
+
+exec nginx -c /config/nginx/nginx.conf

+ 11 - 0
web/rootfs/defaults/meet.conf

@@ -99,3 +99,14 @@ location /etherpad/ {
     proxy_buffering off;
 }
 {{ end }}
+
+{{ if .Env.SPOT_URL_BASE }}
+# Spot
+ location ~ ^/spot(/?)(.*)$ {
+    proxy_pass {{ .Env.SPOT_URL_BASE }}/$2$is_args$args;
+    proxy_set_header X-Forwarded-For $remote_addr;
+    proxy_set_header Host {{ .Env.XMPP_DOMAIN }};
+    proxy_buffering off;
+    tcp_nodelay on;
+}
+{{ end }}