# ============================================================ # 鸣鹤 (MingHe) SIP Server — Docker Compose 配置 # ============================================================ # # 使用方法: # 1. 复制配置模板: cp config.template.toml config/config.toml # 2. 编辑配置文件: vim config/config.toml # 3. 启动服务: docker compose up -d # 4. 查看日志: docker compose logs -f # 5. 停止服务: docker compose down # # ============================================================ services: minghe: # 使用预构建镜像 image: facilisvelox/minghe:latest # 容器名称 container_name: minghe-sip # 自动重启策略 restart: unless-stopped # 端口映射 ports: # SIP TLS 信令端口 - "${SIP_PORT:-5061}:5061/tcp" # RTP/SRTP 媒体端口范围(UDP) # 外部端口必须与容器端口一致,因为 SDP 会直接公布这些端口。 # 默认 20000-20020 支持约 10 通并发;不要在小 VPS 上一次映射上万个 UDP 端口。 - "${RTP_PORT_START:-20000}-${RTP_PORT_END:-20020}:${RTP_PORT_START:-20000}-${RTP_PORT_END:-20020}/udp" # 卷挂载 volumes: # 配置文件 - ./config:/app/config:ro # TLS 证书持久化(使用 Docker 命名卷,避免宿主机目录权限导致证书无法写入) - certs:/app/certs # 环境变量 environment: # 日志级别: error, warn, info, debug, trace - RUST_LOG=${RUST_LOG:-info} # 时区 - TZ=${TZ:-Asia/Shanghai} # 网络模式 # 如果需要使用宿主机网络(适用于 RTP 端口范围大的场景),取消注释: # network_mode: host # 资源限制 deploy: resources: limits: # CPU 限制。默认 1.0,兼容 1 核 VPS;多核机器可通过 CPU_LIMIT 调高。 cpus: "${CPU_LIMIT:-1.0}" # 内存限制 memory: "${MEM_LIMIT:-512M}" reservations: cpus: "0.25" memory: 64M # 健康检查 healthcheck: test: ["CMD", "pgrep", "minghe"] interval: 30s timeout: 5s retries: 3 start_period: 10s # 日志配置 logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: certs: