diff --git a/README.md b/README.md index 49aa3c4b..e71c3575 100644 --- a/README.md +++ b/README.md @@ -130,35 +130,20 @@ $ docker-compose down
-Https +Ngrok - Https
-You can start videoconferencing directly from your Local PC, and be reachable from any device outside your network, simply by following [these steps](https://github.com/miroslavpejic85/mirotalksfu/issues/26#issuecomment-986309051). +You can start videoconferencing directly from your Local PC, and be reachable from any device outside your network, simply by following [these documentation](docs/ngrok.md).
-Self Host +Self Hosting
-Change the `announcedIp` with your `Server public IPv4` on `app/src/config.js`: - -```js -{ - ip: '0.0.0.0', - announcedIp: 'Server Public IPv4', // 'xx.xxx.xxx.xx' -} -``` - -Set the inbound rules: - -| Port range | Protocol | Source | Description | -| ----------- | -------- | --------- | ------------------- | -| 3010 | TCP | 0.0.0.0/0 | App listen on tcp | -| 40000-40100 | TCP | 0.0.0.0/0 | RTC port ranges tcp | -| 40000-40100 | UDP | 0.0.0.0/0 | RTC port ranges udp | +Follow [this documentation](docs/self-hosting.md).
@@ -308,11 +293,13 @@ For a MiroTalk license under conditions other than AGPLv3, please contact us at
-Sponsors +Support the project
-Support this project by [becoming a sponsor](https://github.com/sponsors/miroslavpejic85). Your logo will show up here with a link to your website. +Do you find MiroTalk useful? + +Support the project by [becoming a sponsor](https://github.com/sponsors/miroslavpejic85). Your logo will show up here with a link to your website. [![BroadcastX](public/sponsors/BroadcastX.png)](https://broadcastx.de/) diff --git a/app/src/Server.js b/app/src/Server.js index e13c8212..16544895 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -282,7 +282,7 @@ async function ngrokStart() { hostConfig: hostCfg, announced_ip: announcedIP, server: host, - tunnel: tunnel, + server_tunnel: tunnel, api_docs: api_docs, mediasoup_server_version: mediasoup.version, mediasoup_client_version: mediasoupClient.version, diff --git a/docs/ngrok.md b/docs/ngrok.md new file mode 100644 index 00000000..98acd2b9 --- /dev/null +++ b/docs/ngrok.md @@ -0,0 +1,46 @@ +## MiroTalk SFU - Ngrok + +If you want to expose MiroTalk SFU from your `Local PC` to outside in `HTTPS`, you need to do 2 things: + +1. Add the [Ngrok](https://ngrok.com) `authToken` and change the `announcedIp` + +In `app/src/` copy config.template.js to `config.js` then edit it + +```js + /* + Ngrok + 1. Goto https://ngrok.com + 2. Get started for free + 3. Copy YourNgrokAuthToken: https://dashboard.ngrok.com/get-started/your-authtoken + */ + ngrokAuthToken: 'YourNgrokAuthToken', <--- put it here + + announcedIp: 'Your-Public-Static-IP-here' <--- take it from https://api.ipify.org +``` + +2. You need to do a `port forwarding` on your router, something like this: + +| Name | Protocol | Port Wan | Port Lan | IP Destination | +| ------------- | --------- | ----------- | ----------- | --------------- | +| `MiroTalkSfu` | `TCP/UDP` | 40000:40100 | 40000:40100 | `Your Local IP` | +| `MiroTalkSfu` | `TCP` | 3010 | 3010 | `Your Local IP` | + +Make sure your firewall not blocking rtcPorts `range: 40000:40100` + +Then, when you run it with `npm start`, you should see in the console log this line + +```bash +server_tunnel: 'https://xxxxxxxxxxxxxxxxxx.ngrok.io' +``` + +So open it in your browser, join in the room, share it to whom you want and wait participants to join. + +
+ +## Do you find MiroTalk useful? + +Show your appreciation by becoming a [backer or sponsor](https://github.com/sponsors/miroslavpejic85) + +Thank you for your support! ❤️ + +--- diff --git a/docs/self-hosting.md b/docs/self-hosting.md new file mode 100644 index 00000000..7a5f7d1e --- /dev/null +++ b/docs/self-hosting.md @@ -0,0 +1,228 @@ +## MiroTalk SFU - Self Hosting + +Requirments: + +- Recommended: [Hetzner](https://www.hetzner.com/cloud) (`CPX11` it's enough, OS: `Ubuntu 20.04`) +- [Node.js](https://nodejs.org/en/) at least 12x, better `16.15.1 LTS` +- Your domain example: `your.domain.name` (Set a DNS A record for that domain that point to Your Server public IPv4) + +Install the requirements (Note: Many of the installation steps require `root` or `sudo` access) + +```bash +# Gcc g++ make +$ apt-get update +$ apt-get install -y build-essential + +# Python 3.8 and pip +$ DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata +$ apt install -y software-properties-common +$ add-apt-repository ppa:deadsnakes/ppa +$ apt update +$ apt install -y python3.8 python3-pip + +# NodeJS 16.X and npm +$ apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates +$ curl -sL https://deb.nodesource.com/setup_16.x | bash - +$ apt-get install -y nodejs +$ npm install -g npm@latest +``` + +Quick start + +```bash +# Clone this repo +$ git clone https://github.com/miroslavpejic85/mirotalksfu.git +# Go to to dir mirotalksfu +$ cd mirotalksfu +# Copy app/src/config.template.js in app/src/config.js +$ cp app/src/config.template.js app/src/config.js +``` + +Change the `announcedIp` with your `Server public IPv4` on `app/src/config.js` + +```js +{ + ip: '0.0.0.0', + announcedIp: 'Server Public IPv4', // 'xx.xxx.xxx.xx' +} +``` + +Set the `inbound rules` if you have the Firewall enalbled + +| Port range | Protocol | Source | Description | +| ----------- | -------- | --------- | ------------------- | +| 3010 | TCP | 0.0.0.0/0 | App listen on tcp | +| 40000-40100 | TCP | 0.0.0.0/0 | RTC port ranges tcp | +| 40000-40100 | UDP | 0.0.0.0/0 | RTC port ranges udp | + +```bash +# Install dependencies - be patient, the first time will take a few minutes, in the meantime have a good coffee ;) +$ npm install +# Start the server +$ npm start +``` + +Check if is correctly installed: https://your.domain.name:3010 + +Using [PM2](https://pm2.keymetrics.io) to run it as deamon + +```bash +$ npm install -g pm2 +$ pm2 start app/src/Server.js +``` + +If you want to use Docker + +```bash +# Install docker and docker-compose +$ sudo apt install docker.io +$ sudo apt install docker-compose + +# Copy app/src/config.template.js in app/src/config.js and edit it if needed +$ cp app/src/config.template.js app/src/config.js +# Copy docker-compose.template.yml in docker-compose.yml and edit it if needed +$ cp docker-compose.template.yml docker-compose.yml +# Build or rebuild services - be patient, the first time will take a few minutes, in the meantime have a good coffee ;) +$ docker-compose build +# Create and start containers as deamon +$ docker-compose up -d +``` + +Check if is correctly installed: https://your.domain.name:3010 + +In order to use it without the port number at the end, and to have encrypted communications, we going to install [nginx](https://www.nginx.com) and [certbot](https://certbot.eff.org) + +```bash +# Install Nginx +$ sudo apt-get install nginx + +# Install Certbot (SSL certificates) +$ sudo snap install core; sudo snap refresh core +$ sudo snap install --classic certbot +$ sudo ln -s /snap/bin/certbot /usr/bin/certbot + +# Setup Nginx sites +$ sudo vim /etc/nginx/sites-enabled/default + +#--- + +# HTTP — redirect all traffic to HTTPS +server { + if ($host = your.domain.name) { + return 301 https://$host$request_uri; + } + listen 80; + listen [::]:80 ; + server_name your.domain.name; + return 404; +} + +#--- + +# Check if all configured correctly +$ sudo nginx -t + +# Active https for your domain name (follow the instruction) +$ sudo certbot certonly --nginx + +# Add let's encrypt part on nginx config +$ sudo vim /etc/nginx/sites-enabled/default + +#--- + +# MiroTalk SFU - HTTPS — proxy all requests to the Node app +server { + # Enable HTTP/2 + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name your.domain.name; + + # Use the Let’s Encrypt certificates + ssl_certificate /etc/letsencrypt/live/your.domain.name/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/your.domain.name/privkey.pem; + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_pass http://localhost:3010/; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } +} + +#--- + +# Check if all configured correctly +$ sudo nginx -t + +# Restart nginx +$ service nginx restart +$ service nginx status + +# Auto renew SSL certificate +$ sudo certbot renew --dry-run + +# Show certificates +$ sudo certbot certificates +``` + +Check Your MiroTalk SFU instance: https://your.domain.name/ + +## Update script + +In order to have always Your MiroTalk SFU updated to latest, we going to create a script + +```bash +# Create a file sfuUpdate.sh +$ vim sfuUpdate.sh +``` + +If you use `PM2`, paste this: + +```bash +#!/bin/bash + +cd mirotalksfu +git pull +pm2 stop app/src/Server.js +sudo npm install +pm2 start app/src/Server.js +``` + +If you use `Docker`, paste this: + +```bash +#!/bin/bash + +cd mirotalksfu +git pull +docker-compose down +docker-compose build +docker images |grep '' |awk '{print $3}' |xargs docker rmi +docker-compose up -d +``` + +Make the script executable + +```bash +$ chmod +x ./sfuUpdate.sh +``` + +Follow the commits of the MiroTalk SFU project [here](https://github.com/miroslavpejic85/mirotalksfu/commits/master) + +To update your instance of MiroTalk SFU at latest commit, execute: + +```bash +./sfuUpdate.sh +``` + +
+ +## Do you find MiroTalk useful? + +Show your appreciation by becoming a [backer or sponsor](https://github.com/sponsors/miroslavpejic85) + +Thank you for your support! ❤️ + +--- diff --git a/public/view/Room.html b/public/view/Room.html index 5794cca4..b8dc4d1b 100644 --- a/public/view/Room.html +++ b/public/view/Room.html @@ -365,7 +365,7 @@ access to use this app.