How to deploy a WebRTC (easyrtc) server
This tutorial has the aim of guide you through the steps for deploying a WebRTC server and try it with the multiuser feature of BabiaXR.
Specifically, this guide is for deploying an EasyRTC server.
- GitHub Repo: https://github.com/open-easyrtc/open-easyrtc
Deploying using JavaScript (local)
The steps for deploying an Open EasyRTC server using JavaScript (required node 13.8.0) are the next ones:
git clone https://gitlab.com/babiaxr/open-easyrtc
cd open-easyrtc
npm install --production
cd server_example
-
Non-secured server
node server.js
-
SSL autosigned localhost server
node server_ssl.js
-
SSL with custom certs
- Go to
server_ssl_customcerts.js
file and modify the following lines:
// Start Express https server on port 8443 var webServer = https.createServer({ key: fs.readFileSync(__dirname + "your_path_to_key"), cert: fs.readFileSync(__dirname + "your_path_to_cert") }, httpApp);
- Then deploy the server
node server_ssl_customcerts.js
- Go to
Deploying using Docker
First of all you have to have installed Docker and docker-compose (optional)
Dockerfiles
The docker images are allocated in a repository:
- Dockerfile for the nonssl version: https://gitlab.com/babiaxr/open-easyrtc/-/blob/master/server_example/Dockerfile
- Dockerfile for the ssl version autosigned localhost: https://gitlab.com/babiaxr/open-easyrtc/-/blob/master/server_example/Dockerfile_ssl_autosigned
- Dockerfile for the ssl version with custom certs: https://gitlab.com/babiaxr/open-easyrtc/-/blob/master/server_example/Dockerfile_ssl_customcerts
Docker-hub tags:
- non-ssl version:
babiaxr/easyrtc:nonssl
- ssl autosgined version:
babiaxr/easyrtc:sslautosigned
- ssl custom certs:
babiaxr/easyrtc:sslcustomcerts
Deploy with docker
- non-ssl version:
docker run -it -d -p 8080:8080 babiaxr/easyrtc:nonssl
- ssl autosgined version:
docker run -it -d -p 8443:8443 babiaxr/easyrtc:sslautosigned
- ssl custom certs:
docker run -it -d -p 8443:8443 babiaxr/easyrtc:sslcustomcerts
Deploy with docker-compose
Note: volumes and exported ports are optional
version: "2.1"
services:
babiartc-server:
image: babiaxr/easyrtc:nonssl
container_name: babiartc
ports:
- 8080:8080
restart: unless-stopped
volumes:
certsbabia:
external: true
version: "2.1"
services:
sslbabiartc-server:
image: babiaxr/easyrtc:sslautosigned
container_name: sslbabiartc
ports:
- 8443:8443
restart: unless-stopped
volumes:
certsbabia:
external: true
version: "2.1"
services:
sslbabiartc-server:
image: babiaxr/easyrtc:sslcustomcerts
container_name: sslbabiartc
ports:
- 49153:8443
volumes:
- certsbabia:/app/open-easyrtc/server_example/customcerts
restart: unless-stopped
volumes:
certsbabia:
external: true