Skip to content

Commit

Permalink
[mirotalkbro] - add coturn docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jan 10, 2025
1 parent 169e660 commit 352472a
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ package-lock.json
# personal
.env
docker-compose.yml
docker-push.sh
docker-push.sh
turnserver.conf
2 changes: 1 addition & 1 deletion app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @license For open source under AGPL-3.0
* @license For private project or commercial purposes contact us at: [email protected]
* @author Miroslav Pejic - [email protected]
* @version 1.0.70
* @version 1.0.71
*/

require('dotenv').config();
Expand Down
64 changes: 64 additions & 0 deletions coturn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# CoTURN Setup Guide

Set up `CoTURN` with Docker for NAT traversal and media relay in WebRTC applications.

---

## Installation Steps

### 1. Prepare Docker Compose

1. Copy the template:
```bash
cp docker-compose.template.yml docker-compose.yml
```
2. Edit `docker-compose.yml` to fit your environment.

### 2. Configure TURN Server

1. Copy the template:
```bash
cp turnserver.template.conf turnserver.conf
```
2. Edit `turnserver.conf`:

- Replace `YOUR.DOMAIN.NAME` with your domain.
- Replace `YOUR.USERNAME` and `YOUR.PASSWORD` with your credentials.

Example:

```text
server-name=example.com
realm=example.com
user=username:password
```

### 3. Verify Files

Ensure `turnserver.conf` and `docker-compose.yml` are in the same directory.

### 4. Start the Server

Run:

```bash
docker-compose up -d
```

### 5. Check Logs (Optional)

Check logs to verify the server:

```bash
docker-compose logs -f
```

---

## Notes

- Open ports (e.g., 3478, 5349 for TURN) on your firewall.
- Use secure credentials.
- Test with a WebRTC application.

For more, visit the [official documentation](https://docs.mirotalk.com/coturn/installation/).
11 changes: 11 additions & 0 deletions coturn/docker-compose.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
coturn:
image: coturn/coturn
container_name: coturn
network_mode: 'host'
user: 'root'
restart: unless-stopped
volumes:
- ./turnserver.conf:/etc/coturn/turnserver.conf
- /etc/letsencrypt/live/YOUR.DOMAIN.NAME/fullchain.pem:/etc/letsencrypt/live/YOUR.DOMAIN.NAME/fullchain.pem
- /etc/letsencrypt/live/YOUR.DOMAIN.NAME/privkey.pem:/etc/letsencrypt/live/YOUR.DOMAIN.NAME/privkey.pem
23 changes: 23 additions & 0 deletions coturn/turnserver.template.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
listening-port=3478
tls-listening-port=5349

min-port=10000
max-port=20000

fingerprint
lt-cred-mech

user=YOUR.USERNAME:YOUR.PASSWORD

server-name=YOUR.DOMAIN.NAME
realm=YOUR.DOMAIN.NAME

total-quota=100
stale-nonce=600

cert=/etc/letsencrypt/live/YOUR.DOMAIN.NAME/fullchain.pem
pkey=/etc/letsencrypt/live/YOUR.DOMAIN.NAME/privkey.pem

cipher-list="ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384"

no-stdout-log
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalkbro",
"version": "1.0.70",
"version": "1.0.71",
"description": "P2P WebRTC audio, video and screen live broadcast",
"main": "app/server.js",
"scripts": {
Expand Down

0 comments on commit 352472a

Please sign in to comment.