Docker-composeによるjitsiのインストール

2023年2月9日

この記事は、サーバに単体でJitsiをインストールする場合の手順。つまり、Jitsiが80,443番ポートを専有してしまうやり方である。リバースプロキシとしてのTraefikの後ろにJitsiを置く方法はJitsiのTraefik対応で説明している。

jitsiはZOOM等に代わる「自分自身の」オンラインミーティングシステムである。これをインストールすることにより、ZOOM等の料金を払う必要がなく、さらに一切の盗聴がされないというメリットもある。

注意事項

jitsiの設定ファイル.envには、あたかもHTTP_PORT、HTTPS_PORTを自由に変更できるかのように書いてあるが、実際にはこれはできないようだ。80,443でないと満足に動作しないようである。

※ただしこれは、jitsi自体でLetsEncryptの証明書を取得する場合。

まず初めに、httpポートが80でないと、LetsEncryptのCERTを得ることができない。なぜなら、ここをどう変更しようがLetsEncrypt側は80から取得しようとするからだ。

web_1      | [Mon Sep 26 18:28:45 JST 2022] Verifying: jitsi.example.com
web_1      | [Mon Sep 26 18:28:45 JST 2022] Standalone mode server
jicofo_1   | Jicofo 2022-09-26 18:28:47.683 INFO: [22] [type=bridge brewery=jvbbrewery] BaseBrewery.addInstance#341: Added brewery instance: jvbbrewery@internal-muc.meet.jitsi/81197b14552e
jicofo_1   | Jicofo 2022-09-26 18:28:47.703 INFO: [22] BridgeSelector.addJvbAddress#102: Added new videobridge: Bridge[jid=jvbbrewery@internal-muc.meet.jitsi/81197b14552e, version=2.2.22-g42bc1b99, relayId=null, region=null, stress=0.00]
jicofo_1   | Jicofo 2022-09-26 18:28:47.706 INFO: [33] JvbDoctor.bridgeAdded#130: Scheduled health-check task for: Bridge[jid=jvbbrewery@internal-muc.meet.jitsi/81197b14552e, version=2.2.22-g42bc1b99, relayId=null, region=null, stress=0.00]
web_1      | [Mon Sep 26 18:28:49 JST 2022] jitsi.example.com:Verify error:133.18.205.41: Fetching http://jitsi.example.com/.well-known/acme-challenge/-2YddCF4Z2XlBrWRFJNxoZF5uYxYaFED*****: Error getting validation data
web_1      | [Mon Sep 26 18:28:49 JST 2022] Please add '--debug' or '--log' to check more details.
web_1      | [Mon Sep 26 18:28:49 JST 2022] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
web_1      | [Mon Sep 26 18:28:49 JST 2022] Run post hook:'if [[ -d /var/run/s6/services/nginx ]]; then s6-svc -u /var/run/s6/services/nginx; fi'
web_1      | Failed to obtain a certificate from the Let's Encrypt CA.

一時的に80にしてCERTを取得し、あとはhttpポートを8080などにして、httpsポートを8443等にしてもうまくいかない。jitsi運用中は、443である必要があるようだ。

リリースの取得と準備

基本的には、Self-Hosting Guide – Dockerに従ってインストールする。現在の安定バージョンは、stable-7648-4: releaseだった。

これをダウンロードして展開し、以下の操作を行う

cp env.example .env
./gen-passwords.sh
mkdir -p ~/.jitsi-meet-cfg/{web,transcripts,prosody/config,prosody/prosody-plugins-custom,jicofo,jvb,jigasi,jibri}

この後、マニュアルではいきなりdocker-compose up -dすることになっているが、その前に.envを編集しておく必要がある。

以下では、80,443ポートをjitsiが専有する場合の設定である。また、誰でも使えては困るので、この編集が終了した後で、ユーザ名・パスワードを設定する。

# shellcheck disable=SC2034

################################################################################
################################################################################
# Welcome to the Jitsi Meet Docker setup!
#
# This sample .env file contains some basic options to get you started.
# The full options reference can be found here:
# https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker
################################################################################
################################################################################


#
# Basic configuration options
#

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

# Exposed HTTP port
HTTP_PORT=80 # 80に変更

# Exposed HTTPS port
HTTPS_PORT=443 # 443に変更

# System time zone
TZ=Asia/Tokyo # タイムゾーン変更

# Public URL for the web service (required)
PUBLIC_URL=https://jitsi.example.com # このjitsiを運用するURL

# IP address of the Docker host
# See the "Running behind NAT or on a LAN environment" section in the Handbook:
# https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-docker#running-behind-nat-or-on-a-lan-environment
DOCKER_HOST_ADDRESS=123.123.123.123 # サーバのIPアドレス


#
# JaaS Components (beta)
# https://jaas.8x8.vc
#

# Enable JaaS Components (hosted Jigasi)
#ENABLE_JAAS_COMPONENTS=0 # jitsiをアプリに組み込むものらしいが不要

#
# Let's Encrypt configuration
#

# Enable Let's Encrypt certificate generation
ENABLE_LETSENCRYPT=1 # SSL証明書を取得

# Domain for which to generate the certificate
LETSENCRYPT_DOMAIN=jitsi.example.com # 証明書を取得するドメイン

# E-Mail for receiving important account notifications (mandatory)
LETSENCRYPT_EMAIL=me@example.com # 適当なメアド

# Use the staging server (for avoiding rate limits while testing)
#LETSENCRYPT_USE_STAGING=1


#
# Etherpad integration (for document sharing)
#

# Set etherpad-lite URL in docker local network (uncomment to enable)
#ETHERPAD_URL_BASE=http://etherpad.meet.jitsi:9001 # Etherpadという共同作業用エディタとの統合化。とりあえず要らない

# Set etherpad-lite public URL, including /p/ pad path fragment (uncomment to enable)
#ETHERPAD_PUBLIC_URL=https://etherpad.my.domain/p/

# Name your etherpad instance!
ETHERPAD_TITLE=Video Chat

# The default text of a pad
ETHERPAD_DEFAULT_PAD_TEXT="Welcome to Web Chat!\n\n"

# Name of the skin for etherpad
ETHERPAD_SKIN_NAME=colibris

# Skin variants for etherpad
ETHERPAD_SKIN_VARIANTS="super-light-toolbar super-light-editor light-background full-width-editor"


#
# Basic Jigasi configuration options (needed for SIP gateway support)
#

# SIP URI for incoming / outgoing calls
#JIGASI_SIP_URI=test@sip2sip.info # IP電話とjitsiの相互通話を可能にするらしい。とりあえず要らない

# Password for the specified SIP account as a clear text
#JIGASI_SIP_PASSWORD=passw0rd

# SIP server (use the SIP account domain if in doubt)
#JIGASI_SIP_SERVER=sip2sip.info

# SIP server port
#JIGASI_SIP_PORT=5060

# SIP server transport
#JIGASI_SIP_TRANSPORT=UDP


#
# Authentication configuration (see handbook for details)
#

# Enable authentication
ENABLE_AUTH=1 # yesにする

# Enable guest access
ENABLE_GUESTS=1 # yesにする

# Select authentication type: internal, jwt, ldap or matrix
AUTH_TYPE=internal # yesにする

# JWT authentication
#

# Application identifier
#JWT_APP_ID=my_jitsi_app_id # JWT認証というものらしい。とりあえず要らない

# Application secret known only to your token generator
#JWT_APP_SECRET=my_jitsi_app_secret

# (Optional) Set asap_accepted_issuers as a comma separated list
#JWT_ACCEPTED_ISSUERS=my_web_client,my_app_client

# (Optional) Set asap_accepted_audiences as a comma separated list
#JWT_ACCEPTED_AUDIENCES=my_server1,my_server2

# LDAP authentication (for more information see the Cyrus SASL saslauthd.conf man page)
#

# LDAP url for connection
#LDAP_URL=ldaps://ldap.domain.com/ # LDAP認証。とりあえず要らない

# LDAP base DN. Can be empty
#LDAP_BASE=DC=example,DC=domain,DC=com

# LDAP user DN. Do not specify this parameter for the anonymous bind
#LDAP_BINDDN=CN=binduser,OU=users,DC=example,DC=domain,DC=com

# LDAP user password. Do not specify this parameter for the anonymous bind
#LDAP_BINDPW=LdapUserPassw0rd

# LDAP filter. Tokens example:
# %1-9 - if the input key is user@mail.domain.com, then %1 is com, %2 is domain and %3 is mail
# %s - %s is replaced by the complete service string
# %r - %r is replaced by the complete realm string
#LDAP_FILTER=(sAMAccountName=%u)

# LDAP authentication method
#LDAP_AUTH_METHOD=bind

# LDAP version
#LDAP_VERSION=3

# LDAP TLS using
#LDAP_USE_TLS=1

# List of SSL/TLS ciphers to allow
#LDAP_TLS_CIPHERS=SECURE256:SECURE128:!AES-128-CBC:!ARCFOUR-128:!CAMELLIA-128-CBC:!3DES-CBC:!CAMELLIA-128-CBC

# Require and verify server certificate
#LDAP_TLS_CHECK_PEER=1

# Path to CA cert file. Used when server certificate verify is enabled
#LDAP_TLS_CACERT_FILE=/etc/ssl/certs/ca-certificates.crt

# Path to CA certs directory. Used when server certificate verify is enabled
#LDAP_TLS_CACERT_DIR=/etc/ssl/certs

# Wether to use starttls, implies LDAPv3 and requires ldap:// instead of ldaps://
# LDAP_START_TLS=1


#
# Security
#
# Set these to strong passwords to avoid intruders from impersonating a service account
# The service(s) won't start unless these are specified
# Running ./gen-passwords.sh will update .env with strong passwords
# You may skip the Jigasi and Jibri passwords if you are not using those
# DO NOT reuse passwords
#

# XMPP password for Jicofo client connections #なにをするものかわからない
JICOFO_AUTH_PASSWORD=

# XMPP password for JVB client connections
JVB_AUTH_PASSWORD=

# XMPP password for Jigasi MUC client connections
JIGASI_XMPP_PASSWORD=

# XMPP recorder password for Jibri client connections
JIBRI_RECORDER_PASSWORD=

# XMPP password for Jibri client connections
JIBRI_XMPP_PASSWORD=

#
# Docker Compose options
#

# Container restart policy
#RESTART_POLICY=unless-stopped

# Jitsi image version (useful for local development)
#JITSI_IMAGE_VERSION=latest

これでdocker-compose up -dとして起動する。起動した後でprosodyのコンテナに対して以下の処理を行う。

docker exec -it なんとか bash
prosodyctl --config /config/prosody.cfg.lua register USERNAME meet.jitsi PASSWORD

これで、https://jitsi.example.com/testroom1234などとしてミーティングが可能になる。ミーティングルームに最初に入室する人間はUSERNAME/PASSWORDを入力しなければならなくなる。ミーティングルームが開いた後は、そのURLを知る誰でもが入室できる。