在root目录下先放好自定义的constants.py文件再docker run
同时记得修改PUBLIC_IP
可以跨wifi通信
docker pull piasy/apprtc-server
docker run --name apprtc -p 8080:8080 -p 8089:8089 -p 3478:3478 -p 3478:3478/udp -p 3033:3033 --expose=59000-65000 -e PUBLIC_IP=47.88.63.197 -v /root:/apprtc_configs -it piasy/apprtc-server
其中;
-e 设置环境变量的,
-v, --volume=[host-src:]container-dest[:<options>]: Bind mount a volume.映射与共享用
附: -v选项
运行命令:docker run -it -v /home/xqh/myimage:/data ubuntu /bin/bash
其中的 -v 标记 在容器中设置了一个挂载点 /data(就是容器中的一个目录),并将主机上的 /home/xqh/myimage 目录中的内容关联到 /data下。
这样在容器中对/data目录下的操作,还是在主机上对/home/xqh/myimage的操作,都是完全实时同步的,因为这两个目录实际都是指向主机目录。
AppRTC 需要三个 Server:
  • Room Server: 负责处理加入房间、获取配置等请求;
  • Signal Server: 长连接服务器,用于聊天过程中实时下发信息;
  • TURN/STUN Server: 打洞服务器,用于 NAT 打洞;
About port expose:
  • 8080 is used for room server;
  • 8089 is used for signal server;
  • 3033 is used for ICE server;
  • 3478 and 59000-65000 is used for TURN/STUN server;
注意一定要开放 3478 udp 端口,否则 STUN Binding 请求进不去;
AppRTC Android demo 中,会尝试从房间配置中读取 pc_config 域,以取得 TURN/STUN Server 信息;如果没有获取到,就会向配置中的 ice_server_url 指向的服务器获取 TURN/STUN Server 信息。但 apprtc 的配置说明中,让我们把 TURN/STUN Server 配置写在 TURN_SERVER_OVERRIDE中,这是不行的,因为客户端的逻辑并不会读取 TURN_SERVER_OVERRIDE 这个域,此外 Android demo 读取 pc_config 的代码中,无法正确把 TURN Server 的用户名解析出来,所以我们不得不自己搭一个 ICE Server,这会多一次网络请求
示例的constants.py:
ICE_SERVER_BASE_URL, ICE_SERVER_URL_TEMPLATE and WSS_INSTANCES has been modified.
因此我们还需要第四个 Server:ICE Server。它用于下发 TURN/STUN Server 配置信息,代码如下
几点说明:
  • 这里面有两个配置写死了:key = '4080218913',用户名 ninefingers,它们都是在部署 Coturn 时配置的;
  • username/credential 并不是 Coturn 创建用户的 username/password,而是按照上述逻辑计算出来的值,否则 Coturn 会报错 401 Unauthorized;
  • 上面的 ICE Server 部署之后,Android demo 请求时会报 404,最终定位是因为 demo 用 HttpURLConnection 时设置了 connection.setDoOutput(true);,注释掉就好了,详见这个 commit

附:运行日志
log file opened: /var/log/turn_15_2017-09-12.log
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.0.6 'dan Eider'
Max number of open files/sockets allowed for this process: 65536
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 32500 (approximately)
==== Show him the instruments, Practical Frost: ====
0: TLS supported
0: DTLS supported
0: DTLS 1.2 supported
0: TURN/STUN ALPN supported
0: Third-party authorization (oAuth) supported
0: GCM (AEAD) supported
0: OpenSSL compile-time version: OpenSSL 1.0.2g 1 Mar 2016 (0x1000207f)
0: SQLite is not supported
0: Redis is not supported
0: PostgreSQL is not supported
0: MySQL is not supported
0: MongoDB is not supported
0: Default Net Engine version: 3 (UDP thread per CPU core)
=====================================================
0: Listener address to use: 0.0.0.0
0: Domain name:
0: Default realm: apprtc
0: Relay address to use: 0.0.0.0
0: pid file created: /var/run/turnserver.pid
0: IO method (main listener thread): epoll (with changelist)
0: WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one IP address is provided
0: Wait for relay ports initialization...
0: relay 0.0.0.0 initialization...
0: relay 0.0.0.0 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=0 created
0: IPv4. SCTP listener opened on : 0.0.0.0:3478
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=1 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=2 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=3 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=4 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=5 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=6 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=7 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=8 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=9 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=10 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=11 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=12 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=13 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=14 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=15 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=16 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=17 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=18 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=19 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=20 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=21 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=22 created
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: IO method (general relay thread): epoll (with changelist)
0: turn server id=23 created
0: IPv4. UDP listener opened on: 0.0.0.0:3478
0: IPv4. TCP listener opened on : 0.0.0.0:3478
0: Total General servers: 24
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (auth thread): epoll (with changelist)
0: IO method (admin thread): epoll (with changelist)
server started
参考:

基于docker的webrtc开发环境的更多相关文章

  1. 在 Mac/Windows 系统中使用 Laradock 搭建基于 Docker 的 Laravel 开发环境 (改)

    开篇 Use Docker First And Learn About It Later 简介 Laradock 是为 Docker 提供的完整 PHP 本地开发环境,和 Homestead 一样提供 ...

  2. win10搭建基于docker的odoo开发环境

  3. 在windows环境里,用Docker搭建Redis开发环境(新书第一个章节)

    大家都知道高并发分布式组件的重要性,而且如果要进大厂,这些技术不可或缺.但这些技术的学习难点在于,大多数项目里的分布式组件,都是搭建在Linux系统上,在自己的windows机器上很难搭建开发环境,如 ...

  4. Docker最全教程之使用Docker搭建Java开发环境(十七)

    前言 Java是一门面向对象的优秀编程语言,市场占有率极高,但是在容器化实践过程中,发现官方支持并不友好,同时与其他编程语言的基础镜像相比(具体见各语言镜像比较),确实是非常臃肿. 本篇仅作探索,希望 ...

  5. Mac上通过docker配置PHP开发环境

    这篇文章介绍的内容是关于Mac上通过docker配置PHP开发环境,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 更多PHP相关知识请关注我的专栏PHP​zhuanlan.zhihu. ...

  6. 如何使用Docker部署PHP开发环境

    本文主要介绍了如何使用Docker构建PHP的开发环境,文中作者也探讨了构建基于Docker的开发环境应该使用单容器还是多容器,各有什么利弊.推荐PHP开发者阅读.希望对大家有所帮助. 环境部署一直是 ...

  7. 最新基于adt-bundle-windows-x86的android开发环境筹建

    最新基于adt-bundle-windows-x86的android开发环境搭建 某系统要配套做一个android客户端,来一次android开发环境快速搭建,系统Win7,具体步骤如下: 1.下载j ...

  8. 基于MDK的ARM-GCC开发环境建立及新唐M0的HID类设备的C++开发

    一,下载安装测试arm-none-eabi-gcc编译工具链 1,查看arm-none-eabi-gcc编译工具版本        打开网页:https://sourcery.mentor.com/G ...

  9. 如何用docker安装laravel开发环境

    如何用docker安装laravel开发环境 看laravel框架的官方文档安装部分时,发现需要安装特别多软件,估计还有许多复杂的配置,官方推荐使用Laravel Homestead虚拟机进行安装,但 ...

随机推荐

  1. PHP empty()函数:Can't use method return value in write context

    <?php if (!empty (get_gpc('userId'))) { $userId = get_gpc('userId'); } else { $error = "ID d ...

  2. 【mybatis】service层中一个方法中使用mybatis进行数据库的 多个修改操作,可能是update也可能是delete操作,但是sql语句命名执行并且在控制台打印出来了,但是数据库中未更新到数据【事务的问题】

    问题描述: service层中一个方法中使用mybatis进行数据库的 多个修改操作,可能是update也可能是delete操作,但是sql语句命名执行并且在控制台打印出来了,但是数据库中未更新到数据 ...

  3. iOS:Xcode中SVN不能提交CocoaPods中的.a文件的解决方法

    不能提交.a文件, 这个与SVN的配置有关, 其实与xcode倒没有关系. 解决方法: 1. 打开终端,  在命令行中输入: vi ~/.subversion/config  来打开配置文件.2. 然 ...

  4. javascript快速入门20--Cookie

    Cookie 基础知识 我们已经知道,在 document 对象中有一个 cookie 属性.但是 Cookie 又是什么?“某些 Web 站点在您的硬盘上用很小的文本文件存储了一些信息,这些文件就称 ...

  5. Golang 内存热力图

    https://cizixs.com/2017/09/11/profiling-golang-program/

  6. Node.js 解析gzip网页(https)

    gzip网页指网页头字段Content-Encoding是gzip(GNU zip)内容编码方式.内容编码是指不丢失实体信息的前提下所进行的压缩. Node.js 代码如下: //========== ...

  7. zStack学习笔记(原创,绝对不是抄的……)

    我之前写的文章都没写上面那句,但是这篇写了,主要是因为zStack文章抄袭太严重……故此声明 因为涉及到数据的双向交互问题,所以在这里我考虑使用协议栈来实现数据的收发.首先说下如何在Zstack中添加 ...

  8. css - inline\inline-block\block

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. 使用Google-Authenticator加强serverSSH登录

    对于须要特殊加密的人群,我这里给出对应的方法来进行谷歌式加密. 过程例如以下: 准备: 首先在你的手机上准备好client(自己百度下载) 接下来依照命令做: date 查看系统时间       da ...

  10. 【UVA】11468-Substring(AC自己主动机)

    AC自己主动机的题,须要注意的,建立失配边的时候,假设结点1失配边连到的那个结点2,那个结点2是一个单词的结尾,那么这个结点1也须要标记成1(由于能够看成,这个结点包括了这个单词),之后在Trie树上 ...