FICUSONLINE F9E
ビデオ会議システム JITSI ON DOCKER
オープンソースであるウェブ会議システムJitsiをDockerにより構築します。商用のウェブ会議システムであるZoom,Webexなどは無料サービスとしても提供されていますが、会議時間・参加人数などに制限が設けられています。
Takanobu FuseAdministrator

5 min read

4 years ago

Cloud / Server

オープンソースであるウェブ会議システムJitsiをDockerにより構築します。商用のウェブ会議システムであるZoom,Webexなどは無料サービスとしても提供されていますが、会議時間・参加人数などに制限が設けられています。Jitsiによるウェブ会議システムを独自に構築する場合のメリットは、時間・人数制限なしのサービスを実現できることに加え、必要に応じてシステムの拡張・機能追加・カスタマイズが行えるという点にあります。Jitsiはブラウザ上での動作に加え、iPhone、Android向けに専用アプリも用意されています。

今回構築するJitsiによる会議システムは、主に以下5つの基本ブロックから構成されています。docker-composeにより、ウェブサーバとウェブインターフェイスの各ブロックが一つのイメージファイルとして纏められコンテナとして起動、その他ブロックは各々のイメージファイルを持ち、これらイメージファイルからコンテナとして起動します。サーバ側のネットワーク環境は、Nginxのリバースプロキシ経由とし、このリバースプロキシでLet's EncryptによるSSL接続を確立・処理します。

  1. Jitsi-Meet:ウェブインターフェイスであるファイル群
  2. Nginx:ウェブサーバ
  3. Prosody:XMPPサーバ
  4. Jicofo:ユーザセッションの交換、ビデオストリームチャネルの割当
  5. Jvb:Jitsi Video Bridge ビデオストリームサーバ、バンド幅の監視・コントロール

Docker Compose Jitsi

Jitsi-Prosody

Port Description
5222 Prosody Clent Listening Port
5280 Prosody Server Listening Port
5347 Prosody Components

 

Jitsi-Videobridge

Port Description
443 Jitsi Video Bridge Harvester Port
5347 Prosody Components
4443 Jitsi Video Bridge Harvester Port
10000-20000/UDP Web RTC / ICE

 

Jitsi-Jicofo

Port Description
5222 Prosody Client Port
5347 Prosody Components

 

Jitsi-Meet

Port Description
80 Nginx Listening Port
5280 Prosody Server Listening Port

インストールプロセスは以下の通りです。

  1. Nginxリバースプロキシサーバの設定
  2. CertbotによるSSL認証
  3. Jitsi Meet on Dockerのダウンロード・設定
  4. 動作確認

Jitsi Meet on Docker
https://github.com/jitsi/docker-jitsi-meet/tree/stable-4857

Jitsi Meet
https://meet.jit.si/


1.Nginxリバースプロキシの設定

予めJitsi専用のドメインwww.jitsi-example.com(名称任意)を取得しておきます。Jitsiをインストールするマシンとは別に、同一LANネットワーク内にNginxによるリバースプロキシを用意します(NginxリバースプロキシもDockerコンテナとしてインストール。リバースプロキシをコンテナとして稼働させない場合は、以下Dockerコマンドの箇所を省略して下さい)。

上記ドメイン専用の設定ファイル/etc/nginx/conf.d/jitsi-example.conf(名称任意)を用意します。内容は以下の通りです。

server {
    server_name www.jitsi-example.com;

    server_tokens off;
    # access_log  /var/log/nginx/www.jitsi-example.com.access.log;
    # error_log   /var/log/nginx/www.jitsi-example.com.error.log error;

    location / {
        proxy_pass http://192.168.xx.xxx:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

}

2.CertbotによるSSL認証

CertbotによりJitsiドメイン専用のSSL証明書を取得します。リバースプロキシサーバのマシン上で以下コマンドを実行します(nginxのコンテナ内)。

$ docker exec -ti nginx bash
# certbot --nginx -d www.jitsi-example.com

certbotにより自動的にnginxの設定ファイルが以下のように更新されます。

server {
    server_name www.jitsi-example.com;

    server_tokens off;
    # access_log  /var/log/nginx/www.jitsi-example.com.access.log;
    # error_log   /var/log/nginx/www.jitsi-example.com.error.log error;

    location / {
        proxy_pass http://192.168.xx.xxx:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.jitsi-example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.jitsi-example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.jitsi-example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name www.jitsi-example.com;
    listen 80;
    return 404; # managed by Certbot


}

Let's Encryptによる証明書の期限は90日のため、cronジョブに更新スクリプトを記述しておきます。

#certbot in nginx docker
0 1 * * * docker exec nginx bash -c "certbot renew >> /var/log/letsencrypt/renew.log"

3.Jitsi Meet on Dockerのダウンロード・設定

Jitsiをインストールするマシンの任意のフォルダ内で最新安定版ブランチをクローン(ダウンロード)

$ git clone -b stable-4857 --single-branch https://github.com/jitsi/docker-jitsi-meet.git

docker-jitsi-meetディレクトリに移動し、.envファイルを作成します。

$ cd docker-jitsi-meet
$ cp env.example .env

.envに書き込むセキュリティを確保するためのパスワードスクリプトを実行します。

$ ./gen-passwords.sh

.envファイルを各々の環境に合わせ変更します。リバースプロキシ経由でSSL接続するため、

DISABLE_HTTPS=1

#ENABLE_HTTP_REDIRECT=1

とします。以下一部抜粋。


#
# Basic configuration options
#

# Directory where all configuration will be stored
CONFIG=./.jitsi-meet-cfg

# Exposed HTTP port
HTTP_PORT=8000

# Exposed HTTPS port
#HTTPS_PORT=8443

# System time zone
TZ=JST

# Public URL for the web service
PUBLIC_URL=https://www.jitsi-example.com

# IP address of the Docker host
# See the "Running behind NAT or on a LAN environment" section in the README
DOCKER_HOST_ADDRESS=192.168.x.xx

# Control whether the lobby feature should be enabled or not
ENABLE_LOBBY=1

#
# Let's Encrypt configuration
#

# Enable Let's Encrypt certificate generation
#ENABLE_LETSENCRYPT=0

# Domain for which to generate the certificate
#LETSENCRYPT_DOMAIN=meet.example.com

# E-Mail for receiving important account notifications (mandatory)
#[email protected]


#
# Authentication configuration (see handbook for details)
#

# Enable authentication
ENABLE_AUTH=1

# Enable guest access
ENABLE_GUESTS=1

# Select authentication type: internal, jwt or ldap
AUTH_TYPE=internal

#
# Advanced configuration options (you generally don't need to change these)
#

# Disable HTTPS: handle TLS connections outside of this setup
DISABLE_HTTPS=1

# Redirect HTTP traffic to HTTPS
# Necessary for Let's Encrypt, relies on standard HTTPS port (443)
#ENABLE_HTTP_REDIRECT=1

# Container restart policy
# Defaults to unless-stopped
RESTART_POLICY=unless-stopped

SSL接続はリバースプロキシにより処理されるため、docker-compose.yml - '${HTTPS_PORT}:443' をコメントアウトします。

version: '3'

services:
    # Frontend
    web:
        image: jitsi/web:stable-4857
        restart: ${RESTART_POLICY}
        ports:
            - '${HTTP_PORT}:80'
            # - '${HTTPS_PORT}:443'
        volumes:
            - ${CONFIG}/web:/config:Z
            - ${CONFIG}/web/letsencrypt:/etc/letsencrypt:Z
            - ${CONFIG}/transcripts:/usr/share/jitsi-meet/transcripts:Z
        environment:

Jitsiシステムの各設定ファイルを格納するディレクトリを作成します。

mkdir -p .jitsi-meet-cfg/{web/letsencrypt,transcripts,prosody/config,prosody/prosody-plugins-custom,jicofo,jvb,jigasi,jibri}

.envファイルを変更した場合、変更内容を反映させるため上記設定ディレクトリを削除後、再度作成する必要が有ります。


4.動作確認

docker-composeコマンドにより、Jitsiシステムの各コンテナを起動します。

$ docker-compose up -d

https://www.jitsi-example.comにアクセスして動作を確認して下さい。

Screenshot From 2020 08 10 08 43 37

会議オープン画面

Screenshot From 2020 08 10 08 41 43

ホスト画面(カメラは無効、ホストのみ表示)

Screenshot From 2020 08 10 08 38 25

YouTube画面共有などのサブメニュー表示

Screenshot From 2020 08 10 08 41 00

アプリ画面共有、ブラウザタブ共有

Screenshot From 2020 08 10 08 40 08

メールによる他メンバー招待、チャット機能

SIPによる音声による参加、会議録画・ブロードキャスト機能、etherpadによるドキュメントのリアルタイム編集機能については、動作確認出来次第レポートします。