聊天服务器

/opt/jitsimeet/.env 文件生成成功 [ERROR] ❌ /opt/jitsimeet/.env 文件中以下变量未正确设置: DOMAIN DATA

PHPer 2025-09-28 3 0 0

还有那个data方法没有用的,因为那个原文件里面就没有data那个参数,所以你怎么替换都没有用,必须在最后面再生成一条,就是你要判断,如果查不到那个的话,就要去查不到那个data那个参数的话,就在那个配置文件里查,不查不到的话就要自己去生成,生成一在最后生成一条。

您完全正确!如果原文件中根本没有 DATA这个参数,单纯的 sed替换确实不会生效。我们需要先检查参数是否存在,不存在则追加到文件末尾。以下是完善后的解决方案:

智能化的配置方案

修改后的 setup_jitsimeet_files()函数关键部分

 [✅] RocketChat 配置就绪
[2025-09-28 21:59:57] [INFO] [SETUP] 初始化 Jitsi Meet 配置文件...
[2025-09-28 21:59:57] [INFO] [DOWNLOAD] 下载 docker-compose.yml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17521  100 17521    0     0  13077      0  0:00:01  0:00:01 --:--:-- 13075
[2025-09-28 21:59:59] [INFO] [OK] /opt/jitsimeet/docker-compose.yml 下载完成
[2025-09-28 21:59:59] [INFO] [GENERATE] 生成 /opt/jitsimeet/.env 文件
[2025-09-28 21:59:59] [INFO] [OK] /opt/jitsimeet/.env 文件生成成功
[ERROR] ❌ /opt/jitsimeet/.env 文件中以下变量未正确设置: DOMAIN DATA
[ERROR] 请删除 /opt/jitsimeet/.env 并重新运行安装
~/s/shell_factory ❯❯❯  

---------------------------------------------------
/o/jitsimeet ❯❯❯ ll
total 36K
drwxr-xr-x 5 root root 4.0K Sep 28 18:51 config
drwxr-xr-x 3 root root 4.0K Sep 28 18:51 data
-rw-r--r-- 1 root root  18K Sep 28 21:59 docker-compose.yml
-rw-r--r-- 1 root root 6.4K Sep 28 21:24 env.example
/o/jitsimeet ❯❯❯cat env.example

# 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 (will redirect to HTTPS port)
HTTP_PORT=8000

# Exposed HTTPS port
HTTPS_PORT=8443

# System time zone
TZ=UTC

# Public URL for the web service (required)
# Keep in mind that if you use a non-standard HTTPS port, it has to appear in the public URL
#PUBLIC_URL=https://meet.example.com:${HTTPS_PORT}

# Media IP addresses and ports to advertise by the JVB
# This setting deprecates DOCKER_HOST_ADDRESS, and supports a comma separated list of IPs
# 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
#JVB_ADVERTISE_IPS=192.168.1.1,1.2.3.4,192.168.178.1#12000,fe80::1#12000

#
# Memory limits for Java components
#

#JICOFO_MAX_MEMORY=3072m
#VIDEOBRIDGE_MAX_MEMORY=3072m

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

# Enable JaaS Components (hosted Jigasi)
# NOTE: if Let's Encrypt is enabled a JaaS account will be automatically created, using the provided email in LETSENCRYPT_EMAIL
#ENABLE_JAAS_COMPONENTS=0

#
# Let's Encrypt configuration
#

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

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

# E-Mail for receiving important account notifications (mandatory)
#LETSENCRYPT_EMAIL=alice@atlanta.net

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

# Set ACME server. Default is zerossl, you can peek one at https://github.com/acmesh-official/acme.sh/wiki/Server
#LETSENCRYPT_ACME_SERVER="letsencrypt"

#
# Etherpad integration (for document sharing)
#

# Set the etherpad-lite URL in the docker local network (uncomment to enable)
#ETHERPAD_URL_BASE=http://etherpad.meet.jitsi:9001

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


#
# Whiteboard integration
#

# Set the excalidraw-backend URL in the docker local network (uncomment to enable)
#WHITEBOARD_COLLAB_SERVER_URL_BASE=http://whiteboard.meet.jitsi

# Set the excalidraw-backend public URL (uncomment to enable)
#WHITEBOARD_COLLAB_SERVER_PUBLIC_URL=https://whiteboard.meet.my.domain


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

# SIP URI for incoming / outgoing calls
#JIGASI_SIP_URI=test@sip2sip.info

# 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 (will ask for login and password to join the meeting)
#ENABLE_AUTH=1

# Enable guest access (if authentication is enabled, this allows for users to be held in lobby until registered user lets them in)
#ENABLE_GUESTS=1

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

# JWT authentication
#

# Application identifier
#JWT_APP_ID=my_jitsi_app_id

# 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 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 password for Jigasi transcriber client connections
JIGASI_TRANSCRIBER_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
/o/jitsimeet ❯❯❯


===========  code1 ========================================
# 📁 基础路径:统一使用 /opt
# ========================
BASE_DIR="${BASE_DIR:-/opt}"

# 🎯 配置与数据目录(使用下划线命名,你喜欢的风格)
CONFIG_DIR="${CONFIG_DIR:-$BASE_DIR/jitsimeet_config}"
DATA_DIR="${DATA_DIR:-$BASE_DIR/jitsimeet_data}"

mkdir -p "$CONFIG_DIR" # 20250928 2146
mkdir -p "$DATA_DIR" # 20250928 2146

# ========================
# 🖥️ 服务目录(扁平结构,不再嵌套 docker-jitsi-meet)
# ========================
RC_DIR="${RC_DIR:-$BASE_DIR/$CHAT_SERVICE_NAME}"
JM_DIR="${JM_DIR:-$BASE_DIR/$MEET_SERVICE_NAME}"   # 扁平:/opt/jitsimeet

# compose 执行目录
RC_COMPOSE_DIR="$RC_DIR"
JM_COMPOSE_DIR="$JM_DIR"

# 关键文件
COMPOSE_FILE="docker-compose.yml"
RC_ENV_FILE="$RC_DIR/.env"
JM_ENV_FILE="$JM_DIR/.env"   # 明确区分

# 容器名称
RC_CONTAINER_NAME="rocketchat"
JM_WEB_CONTAINER="web"
JM_PROSODY_CONTAINER="prosody"
JM_JICOFO_CONTAINER="jicofo"
JM_JVB_CONTAINER="jvb"
JM_JVB_COLIBRI_PORT="8888"     


============================ code2 =========     
#!/usr/bin/env bash
# libs/setup_jitsimeet.sh
#==========================================
# 安装/配置 Jitsi Meet 
#==========================================
setup_jitsimeet_files() {
    log "[SETUP] 初始化 Jitsi Meet 配置文件..."

    # 检查必要变量是否已设置
    if [[ -z "$JM_DIR" || -z "$CONFIG_DIR" || -z "$DATA_DIR" || -z "$JM_DOMAIN" ]]; then
        error "必要变量未设置: JM_DIR=$JM_DIR, CONFIG_DIR=$CONFIG_DIR, DATA_DIR=$DATA_DIR, JM_DOMAIN=$JM_DOMAIN"
        return 1
    fi

    # 创建必要的目录
    mkdir -p "$JM_DIR" "$CONFIG_DIR"/{web,prosody,jicofo,jvb} "$DATA_DIR"/transcripts

    # 下载 docker-compose.yml
    local compose_file="$JM_DIR/docker-compose.yml"
    sudo rm -f "$compose_file" # 删除旧文件
    if [[ ! -f "$compose_file" ]]; then
        log "[DOWNLOAD] 下载 docker-compose.yml"
        if ! curl -o "$compose_file" -L https://raw.githubusercontent.com/jitsi/docker-jitsi-meet/master/docker-compose.yml ; then
            error "下载 $compose_file 失败,请检查网络"
            return 1
        fi
        log "[OK] $compose_file 下载完成"
    fi

    # 生成 .env 文件
    local env_file="$JM_DIR/.env"
    local env_example="$JM_DIR/env.example"
    sudo rm -f "$env_file" # 删除旧文件
    if [[ ! -f "$env_file" ]]; then
        log "[GENERATE] 生成 $env_file 文件"

        # 下载 env.example
        if [[ ! -f "$env_example" ]]; then
            if ! curl -f -o "$env_example" -L https://raw.githubusercontent.com/jitsi/docker-jitsi-meet/master/env.example ; then
                error "下载 $env_example 失败"
                return 1
            fi
        fi

        sudo cp "$env_example" "$env_file" || {
            error "cp $env_example  $env_file 失败"
            return 1
        }

        # 生成随机密码
        local jicofo_pwd=$(openssl rand -hex 16)
        local jvb_pwd=$(openssl rand -hex 16)

        # 批量替换
        sed -i "s|HTTP_PORT=8000|HTTP_PORT=$JM_HOST_HTTP_PORT|" "$env_file" || { error "替换 HTTP_PORT 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|HTTPS_PORT=8443|HTTPS_PORT=$JM_HOST_HTTPS_PORT|" "$env_file" || { error "替换 HTTPS_PORT 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|DOMAIN=meet.jitsi|DOMAIN=$JM_DOMAIN|" "$env_file" || { error "替换 DOMAIN 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|CONFIG=.*|CONFIG=$CONFIG_DIR|" "$env_file" || { error "替换 CONFIG 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|DATA=.*|DATA=$DATA_DIR|" "$env_file" || { error "替换 DATA 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|JICOFO_AUTH_PASSWORD=.*|JICOFO_AUTH_PASSWORD=$jicofo_pwd|" "$env_file" || { error "替换 JICOFO_AUTH_PASSWORD 失败"; rm -f "$env_file"; return 1; }
        sed -i "s|JVB_AUTH_PASSWORD=.*|JVB_AUTH_PASSWORD=$jvb_pwd|" "$env_file" || { error "替换 JVB_AUTH_PASSWORD 失败"; rm -f "$env_file"; return 1; }

        chmod 644 "$env_file"
        log "[OK] $env_file 文件生成成功"
    else
        log "[SKIP] $env_file 已存在"
    fi

    if [[ ! -f "$env_file" ]]; then
      error "$env_file 生成成功 is wrong, $env_file 生成失败"
      return 1
    fi

    # 验证 .env 文件中所有关键变量是否已替换
    local missing_vars=()
    grep -q "^HTTP_PORT=$JM_HOST_HTTP_PORT" "$env_file" || missing_vars+=("HTTP_PORT")
    grep -q "^HTTPS_PORT=$JM_HOST_HTTPS_PORT" "$env_file" || missing_vars+=("HTTPS_PORT")
    grep -q "^DOMAIN=$JM_DOMAIN" "$env_file" || missing_vars+=("DOMAIN")
    grep -q "^CONFIG=$CONFIG_DIR" "$env_file" || missing_vars+=("CONFIG")
    grep -q "^DATA=$DATA_DIR" "$env_file" || missing_vars+=("DATA")
    grep -q "^JICOFO_AUTH_PASSWORD=$jicofo_pwd" "$env_file" || missing_vars+=("JICOFO_AUTH_PASSWORD")
    grep -q "^JVB_AUTH_PASSWORD=$jvb_pwd" "$env_file" || missing_vars+=("JVB_AUTH_PASSWORD")

    if [[ ${#missing_vars[@]} -gt 0 ]]; then
        error "❌ $env_file 文件中以下变量未正确设置: ${missing_vars[*]}"
        error "请删除 $env_file 并重新运行安装"
        return 1
    fi

    log "[✅] Jitsi Meet 配置就绪: $JM_DIR"
}

20250928 20\209 ...

立即注册
更新于:2025-09-28 22:39:01
    您需要登录后才可以评论。 立即注册
    相关内容

    win7电脑TrustedInstaller.exe占用内存很大如何解决

    Xampp安装后apache启动失败报错 www.example.com:443:0 server certificate...

    推荐内容

    怎样使用V2Ray代理和SSTap玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩...

    sstap游戏代理教程 从此玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩虹六...

    BT磁力搜索网站汇总和找不到的资源

    什么是磁力链接,您如何使用?

    Z-Library:全球最大的数字图书馆/含打不开的解决方案/镜像

    使用V2Ray的mKCP协议加速游戏

    v2rayN已停止工作

    【车险课堂】什么是无赔款优待系数ncd,你“造”吗?