Code Monkey home page Code Monkey logo

Comments (7)

iamtsm avatar iamtsm commented on June 13, 2024

docker compose --profile=http up

#PROXY-START/


location /
{
    proxy_pass http://127.0.0.1:9092;
    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 REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    	add_header Cache-Control no-cache;
}

location /ws {
  proxy_pass http://127.0.0.1:8444;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_set_header Host $host;
}

#PROXY-END/

但是发现只有Chrome正常的. 手机 和 电脑的Safari 连接时报错. docker 也没有日志输出 image

env 文件没有改

#-----------------以下为基础配置-----------------#
## api服务端口
tl_rtc_file_api_port=9092
## websocket服务端口
tl_rtc_file_socket_port=8444
## websocket服务地址
tl_rtc_file_socket_host=127.0.0.1:8444


#-----------------以下为webrtc相关配置-----------------#
## webrtc-stun中继服务地址
tl_rtc_file_webrtc_stun_host=stun:127.0.0.1:3478
## webrtc-turn中继服务地址
tl_rtc_file_webrtc_turn_host=turn:127.0.0.1:3478?transport=udp
## webrtc中继服务用户名
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc中继服务密码
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc中继服务Secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc中继服务帐号过期时间 (毫秒)
tl_rtc_file_webrtc_turn_expire=86400000


#-----------------以下为mysql数据库相关配置-----------------#
## 是否开启数据库
tl_rtc_file_db_open=false
## 数据库地址
tl_rtc_file_db_mysql_host=mysql
## 数据库端口
tl_rtc_file_db_mysql_port=3306
## 数据库名称
tl_rtc_file_db_mysql_dbName=webchat
## 数据库用户名
tl_rtc_file_db_mysql_user=tlrtcfile
## 数据库密码
tl_rtc_file_db_mysql_password=tlrtcfile

#-----------------以下为oss相关配置-----------------#
## oss-seafile存储库ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile地址
tl_rtc_file_oss_seafile_host=
## oss-seafile用户名
tl_rtc_file_oss_seafile_username=
## oss-seafile密码
tl_rtc_file_oss_seafile_password=

## oss-alyun存储accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-aly存储SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-aly存储bucket
tl_rtc_file_oss_alyun_bucket=

## oss-txyun存储accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyunt存储SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun存储bucket
tl_rtc_file_oss_txyun_bucket=

## oss-qiniuyun存储accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyunt存储SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey=
## oss-qiniuyun存储bucket
tl_rtc_file_oss_qiniuyun_bucket=


#-----------------以下为管理后台相关配置-----------------#
## 管理后台房间号
tl_rtc_file_manage_room=tlrtcfile
## 管理后台密码
tl_rtc_file_manage_password=tlrtcfile


#-----------------以下为openai相关配置-----------------#
## openai-key,如果有多个key,逗号分隔
tl_rtc_file_openai_keys=


#-----------------以下为企业微信通知相关配置-----------------#
## 企业微信通知开关
tl_rtc_file_notify_open=false
## 企业微信通知机器人KEY,正常通知,如果有多个key,逗号分隔
tl_rtc_file_notify_qiwei_normal=
## 企业微信通知机器人KEY,错误通知,如果有多个key,逗号分隔
tl_rtc_file_notify_qiwei_error=

安装可以先看下文档,tl_rtc_file_socket_host这个地址是给浏览器连接websocket服务用的,所以在本机测试的时候可以填127,但是在局域网下就只能填局域网可访问的ip,在公网就只能填公网ip

from tl-rtc-file.

tanpengsccd avatar tanpengsccd commented on June 13, 2024

我想以https 方式启动
docker compose --profile=https up
那么 证书该如何替换呢?

from tl-rtc-file.

iamtsm avatar iamtsm commented on June 13, 2024

你已经配置了nginx代理,就在nginx这一层做ssl证书就好,应用里面的证书可以忽略不用处理

from tl-rtc-file.

tanpengsccd avatar tanpengsccd commented on June 13, 2024

如果以 http 启动服务

并配置 tl_rtc_file_socket_host 为 chat.baidu.com:8444 或 chat.baidu.com
并在 nginx这里做反代开启ssl, 会提示跨域

[Warning] [blocked] The page at https://chat.baidu.com/ was not allowed to display insecure content from http://chat.baidu.com/socket.io/?EIO=3&transport=polling&t=OgCsv0K. (socket.io.js, line 2)

[Error] Not allowed to request resource
	(anonymous function) (socket.io.js:2:3442)
	i (socket.io.js:2:1048)
	....
[Error] XMLHttpRequest cannot load http://chat.baidu.com/socket.io/?EIO=3&transport=polling&t=OgCsv0K due to access control checks.
	(anonymous function) (socket.io.js:2:3442)
	i (socket.io.js:2:1048)
....

地址已脱敏.

from tl-rtc-file.

iamtsm avatar iamtsm commented on June 13, 2024

这种报错看起来是https和http环境不能共存,所以浏览器会丢弃请求,和应用无关,你需要保证api服务和socket服务同时处于https或者http中,而不能一个是http另一个是https

from tl-rtc-file.

tanpengsccd avatar tanpengsccd commented on June 13, 2024

解决了, 分享一下我的 我配置
关键是替换了证书路径 和 配置了 env 文件的 tl_rtc_file_socket_host=chat.baidu.com:8444

## !!!!!!用于docker-compose部署并启动官方镜像!!!!!!
## !!!!!!挂载配置的形式启动,方便修改配置!!!!!!!!!!!!
## !!!!!!需要依赖项目配置文件!!!!!!!!!!!!!!!!!!!!!!

version: '3'
services:

  #http模式启动api服务
  api-http:
    profiles: ['http']
    image: iamtsm/tl-rtc-file-api
    container_name: api
    env_file:
      - ./tlrtcfile.env
    environment:
      - tl_rtc_file_env_mode=http
      - tl_rtc_file_db_open=true
    command: 
      - tlapi
    ports:
      - 9092:9092
    links:
      - mysql
    depends_on:
      - mysql
      - coturn
    volumes:
      - ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env

  #https模式启动api服务
  api-https:
    profiles: ['https']
    image: iamtsm/tl-rtc-file-api
    container_name: api
    env_file:
      - ./tlrtcfile.env
    environment:
      - tl_rtc_file_env_mode=https
      - tl_rtc_file_db_open=true
    command: 
      - tlapi
    ports:
      - 9092:9092
    links:
      - mysql
    depends_on:
      - mysql
      - coturn
    volumes:
      - ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
      - /root/.acme.sh/chat.baidu.com/chat.baidu.com.cer:/tlrtcfile/svr/conf/keys/server.crt
      - /root/.acme.sh/chat.baidu.com/chat.baidu.com.key://tlrtcfile/svr/conf/keys/server.key

  #http模式启动socket服务
  socket-http:
    profiles: ['http']
    image: iamtsm/tl-rtc-file-socket
    container_name: socket
    command: 
      - tlsocket
    env_file:
      - ./tlrtcfile.env
    environment:
      - tl_rtc_file_env_mode=http
      - tl_rtc_file_db_open=true
    ports:
      - 8444:8444
    links:
      - mysql
    depends_on:
      - mysql
      - coturn
    volumes:
      - ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env

  #https模式启动socket服务
  socket-https:
    profiles: ['https']
    image: iamtsm/tl-rtc-file-socket
    container_name: socket
    command: 
      - tlsocket
    env_file:
      - ./tlrtcfile.env
    environment:
      - tl_rtc_file_env_mode=https
      - tl_rtc_file_db_open=true
    ports:
      - 8444:8444
    links:
      - mysql
    depends_on:
      - mysql
      - coturn
    volumes:
      - ./tlrtcfile.env:/tlrtcfile/tlrtcfile.env
      - /root/.acme.sh/chat.baidu.com/chat.baidu.com.cer:/tlrtcfile/svr/conf/keys/server.crt
      - /root/.acme.sh/chat.baidu.com/chat.baidu.com.key://tlrtcfile/svr/conf/keys/server.key

  #mysql服务
  mysql:
    profiles: ['http','https']
    image: iamtsm/tl-rtc-file-mysql
    container_name: mysql
    restart: always
    environment:
      #设置root密码
      - MYSQL_ROOT_PASSWORD=tlrtcfile
      #设置数据库
      - MYSQL_DATABASE=webchat
      #设置用户
      - MYSQL_USER=tlrtcfile
      #设置用户密码
      - MYSQL_PASSWORD=tlrtcfile
    ports:
      - 3306:3306
    volumes:
      - ./docker/mysql/data/db:/var/lib/mysql
      - ./docker/mysql/data/my.cnf:/etc/mysql/conf.d/my.cnf
      - ./docker/mysql/data/log:/var/log/mysql
      - ./docker/mysql/data/init.sql:/docker-entrypoint-initdb.d/init.sql

  #coturn服务
  coturn:
    profiles: ['http','https']
    image: iamtsm/tl-rtc-file-coturn
    container_name: coturn
    ports:
      - "3478:3478/udp"
      - "3478:3478/tcp"
    volumes:
      - ./docker/coturn/turnserver-with-secret-user.conf:/etc/turnserver.conf

然后
docker compose --profile=https up
打开 https://chat.baidu.com:9092 就行了.

如果需要 https://chat.baidu.com 直接访问, 则需要 nginx 再做一次 反代.

from tl-rtc-file.

JiangLongLiu avatar JiangLongLiu commented on June 13, 2024
  • /root/.acme.sh/chat.baidu.com/chat.baidu.com.cer:/tlrtcfile/svr/conf/keys/server.crt

您好! 请教 cer 对应 crt 这样也行吗?

from tl-rtc-file.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.