New port numbering and more fixes

This commit is contained in:
cruizba 2024-03-27 19:59:53 +01:00
parent 2bc5b51c45
commit 38134acb36
21 changed files with 348 additions and 487 deletions

19
.env
View File

@ -1,17 +1,20 @@
# Configure here the private IP of your machine
# It is used by the Media Server to announce it self
# and to configure LAN_MODE ip address
LAN_PRIVATE_IP=192.168.1.60
# Expose OpenVidu with HTTPS.
USE_TLS=false
USE_HTTPS=true
# If true, you can access OpenVidu through your LAN
# If true USE_TLS must be true
LAN_MODE=false
# If true, USE_HTTPS must be true
LAN_MODE=true
# IP Address to expose OpenVidu in your LAN
LAN_PRIVATE_IP=auto
# LiveKit API Key and Secret used for apps to connect to the LiveKit server.
LIVEKIT_API_KEY=key1
LIVEKIT_API_SECRET=abcdefghijklmnopqrstuvwxyz123456
# LiveKit API Key and Secret.
LIVEKIT_API_KEY=devkey
LIVEKIT_API_SECRET=secret
# Dashboard admin user and password.
DASHBOARD_ADMIN_USERNAME=admin

View File

@ -9,50 +9,34 @@ On **Linux**:
- **Docker**
- **Docker Compose**
## How to run
## Install
### Windows
```sh
git clone https://github.com/OpenVidu/openvidu-local-deployment
cd openvidu-local-deployment
.\configure_lan_private_ip_windows.ps1
```
### Mac
```sh
git clone https://github.com/OpenVidu/openvidu-local-deployment
cd openvidu-local-deployment
./configure_lan_private_ip_mac.sh
```
### Linux
```sh
git clone https://github.com/OpenVidu/openvidu-local-deployment
cd openvidu-local-deployment
./configure_lan_private_ip_linux.sh
```
## Run OpenVidu
```sh
docker compose up
```
When the deployment is ready you will see the following message in the logs:
```
readycheck | ------------------------
readycheck | OpenVidu is ready!
readycheck | Open http://localhost:4443/ in your browser
readycheck | ------------------------
```
## Additional Notes
### LAN Access (Optional)
If you want to access the deployment in your LAN for Android or iOS devices, you need to do the following:
1. Get the private IP of your computer in your LAN.
2. Configure your Firewall to allow devices in your LAN to access your computer.
3. Change `LAN_DOMAIN` in the `.env` file to have the IP of your computer in your LAN.
If your IP for example is `192.168.1.10`, `LAN_DOMAIN` should be `192-168-1-10.openvidu-local.dev`.
### About `openvidu-local.dev`
When you develop WebRTC applications, you require a secure context (HTTPS) to access the camera and microphone. This is a requirement of the WebRTC standard.
With the aim of making it easier to develop with OpenVidu, we provide a magic domain name `openvidu-local.dev` which can resolve to any IP specified as a subdomain and it offers a valid wildcard certificate for HTTPS. It is similar to [nip.io](https://nip.io) or [traefik.me](https://traefik.me) or [localtls](https://github.com/Corollarium/localtls).
But take into account that this is just as secure as a HTTP connection, so it is not suitable for production environments.
### Edge cases:
- Linux: All works just fine
- Windows (Docker desktop):
It looks like there is a little edge case which we are fighting with WSL + Docker. Looks related with this: https://stackoverflow.com/questions/61629450/webrtc-does-not-work-in-the-modern-browsers-when-a-peer-is-not-behind-a-nat-beca
The behaviour is the following
- **Chrome based browsers**: Looks like everything works fine. ICE protocol finds a path to communicate the browser and openvidu.
- **Firefox browser**:
The only working candidate in Firefox is filtered, I was able to workaround this limitation with `media.peerconnection.ice.obfuscate_host_addresses=false`.

View File

@ -11,9 +11,13 @@ if [ ! -f /var/www/index.html ]; then
mkdir -p /var/www
cp "$TMP_DIR/index.html" /var/www/index.html
fi
if [ ! -f /var/www/app502.html ]; then
if [ ! -f /var/www/app502client.html ]; then
mkdir -p /var/www
cp "$TMP_DIR/app502.html" /var/www/app502.html
cp "$TMP_DIR/app502client.html" /var/www/app502client.html
fi
if [ ! -f /var/www/app502server.html ]; then
mkdir -p /var/www
cp "$TMP_DIR/app502server.html" /var/www/app502server.html
fi
if [ ! -f /config/caddy/Caddyfile ]; then
mkdir -p /config/caddy

View File

@ -3,18 +3,19 @@ package main
import (
"bytes"
"fmt"
"html/template"
"local-caddy-generate/templates"
"os"
"strconv"
"strings"
"text/template"
)
type TemplateData any
var indexData = &templates.IndexData{}
var caddyData = &templates.CaddyData{}
var app502Data = &templates.App502Data{}
var app502ClientData = &templates.App502Data{}
var app502ServerData = &templates.App502Data{}
func main() {
err := Initialize()
@ -45,12 +46,23 @@ func main() {
os.Exit(1)
}
rawApp502, err := GenerateTemplate(templates.App502Template, app502Data)
rawAppClient502, err := GenerateTemplate(templates.App502Template, app502ClientData)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
err = WriteStringToFile("app502.html", rawApp502)
err = WriteStringToFile("app502client.html", rawAppClient502)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
rawAppServer502, err := GenerateTemplate(templates.App502Template, app502ServerData)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
err = WriteStringToFile("app502server.html", rawAppServer502)
if err != nil {
fmt.Println(err)
os.Exit(1)
@ -59,21 +71,30 @@ func main() {
}
func Initialize() error {
httpPort := 8090
httpsPort := 4443
AppPort := 5442
// OpenVidu && LiveKit API
httpPort := 7880
httpsPort := 7443
// Http ports
appClientPort := 5080
appClientServer := 6080
// Https ports
httpsAppClientPort := 5443
httpsAppServerPort := 6443
version := os.Getenv("VERSION")
if version == "" {
return fmt.Errorf("VERSION is not set")
}
rawUseTLS := os.Getenv("USE_TLS")
if rawUseTLS == "" {
rawUseTLS = "false"
rawUseHTTPS := os.Getenv("USE_HTTPS")
if rawUseHTTPS == "" {
rawUseHTTPS = "false"
}
useTLS, err := strconv.ParseBool(rawUseTLS)
useTLS, err := strconv.ParseBool(rawUseHTTPS)
if err != nil {
return fmt.Errorf("USE_TLS is not a boolean")
return fmt.Errorf("USE_HTTPS is not a boolean")
}
lanMode := os.Getenv("LAN_MODE")
@ -98,10 +119,20 @@ func Initialize() error {
httpUrl := fmt.Sprintf("http://localhost:%d", httpPort)
httpsUrl := ""
wsUrl := fmt.Sprintf("ws://localhost:%d", httpPort)
wssUrl := ""
httpsAppClientUrl := ""
httpsAppServerUrl := ""
if useTLS {
httpsUrl = fmt.Sprintf("https://localhost:%d", httpsPort)
wssUrl = fmt.Sprintf("wss://localhost:%d", httpsPort)
httpsAppClientUrl = fmt.Sprintf("https://localhost:%d", httpsAppClientPort)
httpsAppServerUrl = fmt.Sprintf("https://localhost:%d", httpsAppServerPort)
if lanMode == "true" {
httpsUrl = fmt.Sprintf("https://%s:%d", lanDomain, httpsPort)
wssUrl = fmt.Sprintf("wss://%s:%d", lanDomain, httpsPort)
httpsAppClientUrl = fmt.Sprintf("https://%s:%d", lanDomain, httpsAppClientPort)
httpsAppServerUrl = fmt.Sprintf("https://%s:%d", lanDomain, httpsAppServerPort)
}
}
@ -139,6 +170,8 @@ func Initialize() error {
LanMode: lanMode == "true",
HttpUrl: httpUrl,
HttpsUrl: httpsUrl,
WsUrl: wsUrl,
WssUrl: wssUrl,
LiveKitApiKey: livekitApiKey,
LiveKitApiSecret: livekitApiSecret,
OpenViduSecret: openviduSecret,
@ -151,15 +184,30 @@ func Initialize() error {
caddyData = &templates.CaddyData{
LanMode: lanMode == "true",
LanDomain: lanDomain,
HttpUrl: httpUrl,
HttpsUrl: httpsUrl,
// Main OpenVidu and LiveKit API ports
HttpPort: strconv.Itoa(httpPort),
HttpsPort: strconv.Itoa(httpsPort),
AppPort: strconv.Itoa(AppPort),
// Main OpenVidu and LiveKit API URLs
HttpUrl: httpUrl,
HttpsUrl: httpsUrl,
// Tutorial ports
AppClientPort: strconv.Itoa(appClientPort),
AppServerPort: strconv.Itoa(appClientServer),
HttpsAppClientPort: strconv.Itoa(httpsAppClientPort),
HttpsAppServerPort: strconv.Itoa(httpsAppServerPort),
// Tutorial URLs
HttpsAppClientUrl: httpsAppClientUrl,
HttpsAppServerUrl: httpsAppServerUrl,
}
app502Data = &templates.App502Data{
AppPort: strconv.Itoa(AppPort),
app502ClientData = &templates.App502Data{
Title: "Application Client Not Found",
Message: fmt.Sprintf("Run your Application Client at port <b>%d</b> and you will see it here", appClientPort),
}
app502ServerData = &templates.App502Data{
Title: "Application Server Not Found",
Message: fmt.Sprintf("Run your Application Server at port <b>%d</b> and you will see it here", appClientServer),
}
return nil

View File

@ -1,7 +1,8 @@
package templates
type App502Data struct {
AppPort string
Title string
Message string
}
const App502Template = `<!DOCTYPE html>
@ -37,14 +38,12 @@ const App502Template = `<!DOCTYPE html>
<div class="container">
<div>
<div class="error-code">502 - Bad Gateway</div>
<h1 class="display-5">OpenVidu Application Not Found</h1>
<h1 class="display-5">{{.Title}}</h1>
<hr class="my-4">
<p>If you are developing an application and <b>run it locally at port {{.AppPort}}</b>, you will see here your application, under
the same domain and TLS certificate as OpenVidu.</p>
<p>{{ .Message }}</p>
</div>
</div>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-rwoI1CjyWz1p9q6Lwz3m6ZXjCp3S1/9pSNOWq37fRynwCEK9kwu1F9Mbc+JwDMTV" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
`

View File

@ -3,11 +3,20 @@ package templates
type CaddyData struct {
LanMode bool
LanDomain string
HttpUrl string
HttpsUrl string
// Main OpenVidu and LiveKit API ports
HttpPort string
HttpsPort string
AppPort string
// Main URLs for OpenVidu and LiveKit
HttpUrl string
HttpsUrl string
// Tutorials ports
AppClientPort string
AppServerPort string
HttpsAppClientPort string
HttpsAppServerPort string
// Tutorial URLs
HttpsAppClientUrl string
HttpsAppServerUrl string
}
const CaddyfileTemplate = `
@ -28,7 +37,7 @@ const CaddyfileTemplate = `
# OpenVidu v2 API
@openvidu_v2 path /openvidu/api/* /openvidu/ws/*
handle @openvidu_v2 {
reverse_proxy http://openvidu-v2compatibility:4443
reverse_proxy http://openvidu-v2compatibility:5080
}
# Minio console
@ -53,15 +62,26 @@ const CaddyfileTemplate = `
}
}
(custom_app) {
(application_client) {
handle_errors {
@502 expression {http.error.status_code} == 502
rewrite @502 /app502.html
rewrite @502 /app502client.html
file_server {
root /var/www
}
}
reverse_proxy http://host.docker.internal:{{ .AppPort }}
reverse_proxy http://host.docker.internal:{{ .AppClientPort }}
}
(application_server) {
handle_errors {
@502 expression {http.error.status_code} == 502
rewrite @502 /app502server.html
file_server {
root /var/www
}
}
reverse_proxy http://host.docker.internal:{{ .AppServerPort }}
}
# Servers
@ -73,7 +93,8 @@ const CaddyfileTemplate = `
{{- if .HttpsUrl }}
{{- if .LanMode }}
{{.HttpsUrl}} {
{{ .HttpsUrl }} {
{{- if hasSuffix .LanDomain ".openvidu-local.dev" }}
tls internal {
get_certificate http https://certs.openvidu-local.dev/caddy.pem
@ -82,14 +103,49 @@ const CaddyfileTemplate = `
tls internal
{{- end }}
import general_rules
import custom_app
import index
}
{{ .HttpsAppClientUrl }} {
{{- if hasSuffix .LanDomain ".openvidu-local.dev" }}
tls internal {
get_certificate http https://certs.openvidu-local.dev/caddy.pem
}
{{- else }}
tls internal
{{- end }}
import application_client
}
{{ .HttpsAppServerUrl }} {
{{- if hasSuffix .LanDomain ".openvidu-local.dev" }}
tls internal {
get_certificate http https://certs.openvidu-local.dev/caddy.pem
}
{{- else }}
tls internal
{{- end }}
import application_server
}
{{- else }}
https://*:{{.HttpsPort}} {
tls internal
import general_rules
import custom_app
import index
}
https://*:{{.HttpsAppClientPort}} {
tls internal
import application_client
}
https://*:{{.HttpsAppServerPort}} {
tls internal
import application_server
}
{{- end }}
{{- end}}

View File

@ -5,6 +5,8 @@ type IndexData struct {
LanMode bool
HttpUrl string
HttpsUrl string
WsUrl string
WssUrl string
DashboardAdminUsername string
DashboardAdminPassword string
MinioAdminKey string
@ -14,9 +16,9 @@ type IndexData struct {
OpenViduSecret string
}
const IndexTemplate = `
<!DOCTYPE html>
const IndexTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@ -35,83 +37,58 @@ const IndexTemplate = `
<body>
<div class="container">
<div>
<h1 class="display-4">Welcome to OpenVidu Local Deployment</h1>
<p class="lead">OpenVidu Version: <strong>{{ .OpenViduVersion }}</strong></p>
<div class="alert alert-warning" role="alert">
<span>This deployment is only for development purposes.</span>
</div>
<hr class="my-4">
{{- if .HttpsUrl }}
<h2>HTTPS URLs</h2>
{{- if .LanMode }}
<div class="alert alert-info" role="alert">
<span>You can access from any device in your local network using the following URLs:</span>
</div>
{{- end}}
<ul>
<li><strong>OpenVidu and Livekit API: </strong><a href="{{ .HttpsUrl }}"
target="_blank">{{ .HttpsUrl }}</a></li>
<li><strong>OpenVidu Dashboard: </strong><a href="{{ .HttpsUrl }}/dashboard"
target="_blank">{{ .HttpsUrl }}/dashboard</a></li>
<li><strong>Minio Console: </strong><a href="{{ .HttpsUrl }}/minio-console"
target="_blank">{{ .HttpsUrl }}/minio-console</a></li>
<li><strong>OpenVidu Call: </strong><a href="{{ .HttpsUrl }}/openvidu-call"
target="_blank">{{ .HttpsUrl }}/openvidu-call</a></li>
<li><strong>Your App: </strong><span>Any App you deploy at port 5442 will be available here: </span>
<ul>
<li><a href="{{ .HttpsUrl }}"
target="_blank">{{ .HttpsUrl }}</a></li>
</ul>
</li>
</ul>
<hr class="my-4">
{{- end }}
<h2>HTTP URLs</h2>
<ul>
<li><strong>OpenVidu and Livekit API: </strong><a href="{{ .HttpUrl }}"
target="_blank">{{ .HttpUrl }}</a></li>
<li><strong>OpenVidu Dashboard: </strong><a href="{{ .HttpUrl }}/dashboard"
target="_blank">{{ .HttpUrl }}/dashboard</a></li>
<li><strong>Minio Console: </strong><a href="{{ .HttpUrl }}/minio-console"
target="_blank">{{ .HttpUrl }}/minio-console</a></li>
{{- if not .HttpsUrl }}
<li><strong>OpenVidu Call: </strong><a href="{{ .HttpUrl }}/openvidu-call"
target="_blank">{{ .HttpUrl }}/openvidu-call</a></li>
{{- end }}
</ul>
<hr class="my-4">
<!-- Section with Credentials -->
<h2>Credentials</h2>
<ul>
<li><strong>OpenVidu (Basic auth):</strong>
<ul>
<li>Username: <code>OPENVIDUAPP</code></li>
<li>Password: <code>{{ .OpenViduSecret }}</code></li>
</ul>
</li>
<li><strong>LiveKit API:</strong>
<ul>
<li>API Key: <code>{{ .LiveKitApiKey }}</code></li>
<li>API Secret: <code>{{ .LiveKitApiSecret }}</code></li>
</ul>
</li>
<li><strong>OpenVidu Dashboard: </strong>
<ul>
<li>Username: <code>{{ .DashboardAdminUsername }}</code></li>
<li>Password: <code>{{ .DashboardAdminPassword }}</code></li>
</ul>
</li>
<li><strong>Minio: </strong>
<ul>
<li>User: <code>{{ .MinioAdminKey }}</code></li>
<li>Password: <code>{{ .MinioAdminSecret }}</code></li>
</ul>
</li>
</ul>
<h1 class="display-4">Welcome to OpenVidu Local Deployment</h1>
<p class="lead">OpenVidu Version: <strong>{{.OpenViduVersion}}</strong></p>
<div class="alert alert-warning" role="alert">
<span>This deployment is only for development purposes.</span>
</div>
<hr class="my-4">
<h2>OpenVidu Server and LiveKit Server API:</h2>
<ul>
<li>From this machine:
<ul>
<li><a href="{{.HttpUrl}}" target="_blank">{{.HttpUrl}}</a></li>
<li><a href="{{.WsUrl}}" target="_blank">{{.WsUrl}}</a></li>
</ul>
</li>
<li>From other devices in your LAN:
<ul>
<li><a href="{{.HttpsUrl}}" target="_blank">{{.HttpsUrl}}</a></li>
<li><a href="{{.WssUrl}}" target="_blank">{{.WssUrl}}</a></li>
</ul>
</li>
</ul>
<hr class="my-4">
<h2>Services and passwords:</h2>
<ul>
<li><b>OpenVidu API:</b>
<ul>
<li>Username: <code>OPENVIDUAPP</code></li>
<li>Password: <code>{{.OpenViduSecret}}</code></li>
</ul>
</li>
<li>LiveKit API:
<ul>
<li>API Key: <code>{{.LiveKitApiKey}}</code></li>
<li>API Secret: <code>{{.LiveKitApiSecret}}</code></li>
</ul>
</li>
<li>Minio: <a href="{{.HttpUrl}}/minio-console" target="_blank">{{.HttpUrl}}/minio-console</a>
<ul>
<li>Username: <code>{{.MinioAdminKey}}</code></li>
<li>Password: <code>{{.MinioAdminSecret}}</code></li>
</ul>
</li>
<li>OpenVidu Dashboard: <a href="{{.HttpUrl}}/dashboard" target="_blank">{{.HttpUrl}}/dashboard</a>
<ul>
<li>Username: <code>{{.DashboardAdminUsername}}</code></li>
<li>Password: <code>{{.DashboardAdminPassword}}</code></li>
</ul>
</li>
<li>OpenVidu Call: <a href="{{.HttpUrl}}/openvidu-call" target="_blank">{{.HttpUrl}}/openvidu-call</a></li>
</ul>
</div>
</body>
</html>
`

View File

@ -0,0 +1,16 @@
#!/bin/sh
getPrivateIp() {
ip="$(ip route get 8.8.8.8 | sed -n '/src/{s/.*src *\([^ ]*\).*/\1/p;q}')"
echo "$ip"
}
LAN_PRIVATE_IP=$(getPrivateIp)
if [ -z "$LAN_PRIVATE_IP" ]; then
echo "No LAN private IP found"
echo "Specify the LAN private IP in the .env file"
exit 1
fi
# Replace the LAN_PRIVATE_IP in the .env file
sed -i "s/LAN_PRIVATE_IP=.*/LAN_PRIVATE_IP=$LAN_PRIVATE_IP/g" .env

View File

@ -0,0 +1,16 @@
#!/bin/sh
getPrivateIp() {
ip=$(ipconfig getifaddr $(route -n get default | grep interface | awk '{print $2}'))
echo "$ip"
}
LAN_PRIVATE_IP=$(getPrivateIp)
if [ -z "$LAN_PRIVATE_IP" ]; then
echo "No LAN private IP found"
echo "Specify the LAN private IP in the .env file"
exit 1
fi
# Replace the LAN_PRIVATE_IP in the .env file
sed -i "s/LAN_PRIVATE_IP=.*/LAN_PRIVATE_IP=$LAN_PRIVATE_IP/g" .env

View File

@ -0,0 +1,30 @@
@echo off
call :getPrivateIp
if "%ip%"=="" (
echo No LAN private IP found
echo Specify the LAN private IP in the .env file
exit /b 1
)
:: Replace the LAN_PRIVATE_IP in the .env file
setlocal enabledelayedexpansion
set "tempFile=%temp%\temp_env_%random%.txt"
if exist "%tempFile%" del "%tempFile%"
for /f "tokens=*" %%a in (.env) do (
set "line=%%a"
if "!line:~0,14!"=="LAN_PRIVATE_IP=" (
echo LAN_PRIVATE_IP=%ip%>>"%tempFile%"
) else (
echo !line!>>"%tempFile%"
)
)
move /y "%tempFile%" ".env" >nul
endlocal
exit /b 0
:getPrivateIp
for /f "tokens=4" %%i in ('route print ^| findstr "\<0.0.0.0\>"') do (
set ip=%%i
goto :eof
)
goto :eof

View File

@ -4,7 +4,7 @@ services:
container_name: openvidu-call
restart: on-failure
environment:
- USE_TLS=${USE_TLS:-false}
- USE_HTTPS=${USE_HTTPS:-false}
- LAN_MODE=${LAN_MODE:-false}
- LAN_DOMAIN=${LAN_DOMAIN:-}
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}

View File

@ -10,7 +10,7 @@ services:
- LAN_DOMAIN=${LAN_DOMAIN:-}
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
- LAN_MODE=${LAN_MODE:-false}
- USE_TLS=${USE_TLS:-false}
- USE_HTTPS=${USE_HTTPS:-false}
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY:-}
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET:-}
- DASHBOARD_ADMIN_USERNAME=${DASHBOARD_ADMIN_USERNAME:-}
@ -19,8 +19,10 @@ services:
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-}
- OPENVIDU_SHIM_SECRET=${OPENVIDU_SHIM_SECRET:-}
ports:
- 4443:4443
- 8090:8090
- 5443:5443
- 6443:6443
- 7443:7443
- 7880:7880
depends_on:
setup:
condition: service_completed_successfully
@ -43,14 +45,12 @@ services:
image: bitnami/minio:2024.3.15-debian-12-r0
container_name: minio
restart: unless-stopped
ports:
- 9000:9000
environment:
- MINIO_ROOT_USER=${MINIO_ACCESS_KEY:-}
- MINIO_ROOT_PASSWORD=${MINIO_SECRET_KEY:-}
- MINIO_DEFAULT_BUCKETS=openvidu
- MINIO_CONSOLE_SUBPATH=/minio-console
- MINIO_BROWSER_REDIRECT_URL=http://localhost:4443/minio-console/
- MINIO_BROWSER_REDIRECT_URL=http://localhost:7880/minio-console/
volumes:
- ./minio/data:/bitnami/minio/data
- minio-certs:/certs
@ -139,11 +139,11 @@ services:
container_name: openvidu-v2compatibility
entrypoint: /bin/sh /scripts/entrypoint.sh
environment:
- USE_TLS=${USE_TLS:-false}
- USE_HTTPS=${USE_HTTPS:-false}
- LAN_DOMAIN=${LAN_DOMAIN:-}
- LAN_MODE=${LAN_MODE:-false}
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
- SERVER_PORT=4443
- SERVER_PORT=5080
- OPENVIDU_SHIM_SECRET=${OPENVIDU_SHIM_SECRET:-}
- LIVEKIT_URL_PRIVATE=ws://openvidu:7880
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY:-}
@ -169,7 +169,7 @@ services:
container_name: ready-check
restart: on-failure
environment:
- USE_TLS=${USE_TLS:-false}
- USE_HTTPS=${USE_HTTPS:-false}
- LAN_DOMAIN=${LAN_DOMAIN:-}
- LAN_MODE=${LAN_MODE:-false}
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
@ -202,7 +202,7 @@ services:
- ./egress:/egress
- ./scripts/setup.sh:/scripts/setup.sh
environment:
- USE_TLS=${USE_TLS:-false}
- USE_HTTPS=${USE_HTTPS:-false}
- LAN_MODE=${LAN_MODE:-false}
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
- RUN_WITH_SCRIPT=${RUN_WITH_SCRIPT:-false}

View File

@ -4,8 +4,8 @@ redis:
password: redispassword
db: 0
use_tls: false
api_key: key1
api_secret: abcdefghijklmnopqrstuvwxyz123456
api_key: devkey
api_secret: secret
ws_url: ws://openvidu:7880
health_port: 9091

View File

@ -4,8 +4,8 @@ redis:
password: redispassword
db: 0
use_tls: false
api_key: key1
api_secret: abcdefghijklmnopqrstuvwxyz123456
api_key: devkey
api_secret: secret
ws_url: ws://openvidu:7880
rtmp_port: 1935
whip_port: 8085

View File

@ -25,11 +25,11 @@ turn:
relay_range_start: 40000
relay_range_end: 50000
keys:
key1: abcdefghijklmnopqrstuvwxyz123456
devkey: secret
webhook:
api_key: key1
api_key: devkey
urls:
- http://openvidu-v2compatibility:4443/openvidu/api/webhook
- http://openvidu-v2compatibility:5080/livekit
ingress:
rtmp_base_url: rtmp://localhost:1935/rtmp
whip_base_url: http://localhost:8085/whip

View File

@ -1,81 +0,0 @@
#!/bin/sh
showHelp() {
echo ""
echo "Run OpenVidu Local Deployment in Linux"
echo ""
echo "-------"
echo " Usage "
echo "-------"
echo " $0 <command>"
echo ""
echo "----------"
echo " Commands "
echo "----------"
echo " start - Start OpenVidu"
echo " stop - Stop OpenVidu"
echo " help - Show this help"
echo ""
}
getPrivateIp() {
ip="$(ip route get 8.8.8.8 | sed -n '/src/{s/.*src *\([^ ]*\).*/\1/p;q}')"
echo "$ip"
}
# Flags
START=false
STOP=false
if [ -n "${1:-}" ]; then
while :; do
case "${1:-}" in
start)
START=true
shift 1
break
;;
stop)
STOP=true
shift 1
break
;;
help)
showHelp
exit 0
;;
*)
echo "Not a valid command. For usage information: \"$0 help\""
exit 1
;;
esac
done
else
showHelp
exit
fi
if [ "$START" = "true" ]; then
# Load environment variables
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
if [ "$LAN_PRIVATE_IP" = "auto" ]; then
LAN_PRIVATE_IP="$(getPrivateIp)"
if [ -z "$LAN_PRIVATE_IP" ]; then
LAN_PRIVATE_IP=none
fi
export LAN_PRIVATE_IP
fi
echo "Starting OpenVidu..."
export RUN_WITH_SCRIPT=true
docker compose down --volumes
docker compose up
fi
if [ "$STOP" = "true" ]; then
echo "Stopping OpenVidu"
docker compose down --volumes
fi

View File

@ -1,83 +0,0 @@
#!/bin/sh
showHelp() {
echo ""
echo "Run OpenVidu Local Deployment in Linux"
echo ""
echo "-------"
echo " Usage "
echo "-------"
echo " $0 <command>"
echo ""
echo "----------"
echo " Commands "
echo "----------"
echo " start - Start OpenVidu"
echo " stop - Stop OpenVidu"
echo " help - Show this help"
echo ""
}
getPrivateIp() {
ip=$(ipconfig getifaddr $(route -n get default | grep interface | awk '{print $2}'))
echo "$ip"
}
# Flags
START=false
STOP=false
if [ -n "${1:-}" ]; then
while :; do
case "${1:-}" in
start)
START=true
shift 1
break
;;
stop)
STOP=true
shift 1
break
;;
help)
showHelp
exit 0
;;
*)
echo "Not a valid command. For usage information: \"$0 help\""
exit 1
;;
esac
done
else
showHelp
exit
fi
if [ "$START" = "true" ]; then
# Load environment variables
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
if [ "$LAN_PRIVATE_IP" = "auto" ]; then
LAN_PRIVATE_IP="$(getPrivateIp)"
if [ -z "$LAN_PRIVATE_IP" ]; then
LAN_PRIVATE_IP=none
fi
export LAN_PRIVATE_IP
fi
# MongoDB support on Apple Silicon
export EXPERIMENTAL_DOCKER_DESKTOP_FORCE_QEMU=1
echo "Starting OpenVidu..."
export RUN_WITH_SCRIPT=true
docker compose down --volumes
docker compose up
fi
if [ "$STOP" = "true" ]; then
echo "Stopping OpenVidu"
docker compose down --volumes
fi

View File

@ -1,79 +0,0 @@
@echo off
setlocal enabledelayedexpansion
:: Function to show help
goto :main
:showHelp
echo.
echo Run OpenVidu Local Deployment in Windows
echo.
echo -------
echo Usage
echo -------
echo %~nx0 ^<command^>
echo.
echo ----------
echo Commands
echo ----------
echo start - Start OpenVidu
echo stop - Stop OpenVidu
echo help - Show this help
echo.
exit /b 0
:getPrivateIp
for /f "tokens=4" %%i in ('route print ^| findstr "\<0.0.0.0\>"') do (
set ip=%%i
goto :eof
)
goto :eof
:main
if "%1"=="" (
call :showHelp
goto :eof
)
if /i "%1"=="start" (
call :startOpenVidu
goto :eof
)
if /i "%1"=="stop" (
call :stopOpenVidu
goto :eof
)
if /i "%1"=="help" (
call :showHelp
goto :eof
)
echo Not a valid command. For usage information: ".\%~nx0 help"
exit /b 0
:startOpenVidu
if exist .env (
for /f "usebackq tokens=*" %%a in (".env") do (
echo %%a | findstr /v /b /c:"#" >nul
if not errorlevel 1 set %%a
)
)
if "%LAN_PRIVATE_IP%"=="auto" (
call :getPrivateIp || exit /b 1
if defined ip (
set LAN_PRIVATE_IP=!ip!
) else (
set LAN_PRIVATE_IP=none
)
)
echo Starting OpenVidu...
set RUN_WITH_SCRIPT=true
docker-compose down --volumes || exit /b 1
docker-compose up || exit /b 1
exit /b 0
:stopOpenVidu
echo Stopping OpenVidu...
docker-compose down --volumes || exit /b 1
exit /b 0

View File

@ -35,7 +35,8 @@ wait_for_service 'Minio' 'http://minio:9000/minio/health/live'
wait_for_service 'Minio Console' 'http://minio:9001/minio-console'
wait_for_service 'Mongo' 'http://mongo:27017' --connect-timeout 10 --silent
URL=$(getDeploymentUrl)
LAN_HTTP_URL=$(getDeploymentUrl http)
LAN_WS_URL=$(getDeploymentUrl ws)
for i in $(seq 1 10); do
echo 'Starting OpenVidu... Please be patient...'
@ -43,54 +44,27 @@ for i in $(seq 1 10); do
done;
echo ''
echo ''
echo '------------------------'
echo 'OpenVidu is ready!'
echo '------------------------'
echo '========================================='
echo '🎉 OpenVidu is ready! 🎉'
echo '========================================='
echo ''
echo '🎉🎉🎉 Welcome Page: http://localhost:8090' 🎉🎉🎉
echo 'OpenVidu Server && LiveKit Server URLs:'
echo ''
echo '------------------------'
if [ "${USE_TLS}" = 'true' ]; then
echo '========================'
echo 'HTTPS services:'
echo '========================'
if [ "${LAN_MODE}" = 'true' ]; then
echo 'NOTE: You can access all of these services on any device'
echo 'connected to the same network as this machine'
fi
echo "- OpenVidu and LiveKit API: ${URL}"
echo "- OpenVidu Dashboard: ${URL}/dashboard"
echo "- Minio Console: ${URL}/minio-console"
echo "- OpenVidu Call: ${URL}/openvidu-call"
echo "- Your App*: ${URL}"
echo " *: Any application deployed at port 5442 will be accessible through ${URL}"
fi
echo ' - From this machine:'
echo ''
echo '========================'
echo 'HTTP services:'
echo '========================'
echo "- OpenVidu and LiveKit API: http://localhost:8090"
echo "- OpenVidu Dashboard: http://localhost:8090/dashboard"
echo "- Minio Console: http://localhost:8090/minio-console"
if [ "${USE_TLS}" = 'false' ]; then
echo '- OpenVidu Call: http://localhost:8090/openvidu-call'
fi
echo ' - http://localhost:7880'
echo ' - ws://localhost:7880'
echo ''
echo '========================'
echo 'Credentials:'
echo '========================'
echo 'OpenVidu Basic Auth:'
echo ' - Username: OPENVIDUAPP'
echo " - Password: ${OPENVIDU_SHIM_SECRET}"
echo 'LiveKit API:'
echo " - Username: ${LIVEKIT_API_KEY}"
echo " - Password: ${LIVEKIT_API_SECRET}"
echo 'OpenVidu Dashboard:'
echo " - Username: ${DASHBOARD_ADMIN_USERNAME}"
echo " - Password: ${DASHBOARD_ADMIN_PASSWORD}"
echo 'Minio:'
echo " - Access Key: ${MINIO_ACCESS_KEY}"
echo " - Secret Key: ${MINIO_SECRET_KEY}"
echo '------------------------'
echo ' - From other devices in your LAN:'
echo ''
echo " - $LAN_HTTP_URL"
echo " - $LAN_WS_URL"
echo ''
echo '========================================='
echo ''
echo 'OpenVidu Developer UI (services and passwords):'
echo ''
echo ' - http://localhost:7880'
echo " - $LAN_HTTP_URL"
echo ''
echo '========================================='

View File

@ -1,27 +1,23 @@
#!/bin/sh
if [ "$RUN_WITH_SCRIPT" = 'false' ]; then
if [ -z "$LAN_PRIVATE_IP" ]; then
echo '------------------------'
echo ''
echo 'Do not run this docker-compose file via "docker compose up" directly.'
echo 'Please run it via the provided scripts.'
echo 'LAN_PRIVATE_IP is required in .env file'
echo 'Depending on your OS, you can run the following command to get your LAN private IP:'
echo ''
echo ' - Linux: ./openvidu_linux.sh start'
echo ' - MacOS: ./openvidu_macos.sh start'
echo ' - Windows: ./openvidu_windows.bat start'
echo ' - Linux: ./configure_lan_private_ip_linux.sh'
echo ' - MacOS: ./configure_lan_private_ip_macos.sh'
echo ' - Windows: .\configure_lan_private_ip_windows.bat'
echo ''
echo 'The script will automatically update the .env file with the LAN_PRIVATE_IP'
echo 'If it can'\''t be found, you can manually set it in the .env file'
echo '------------------------'
exit 1
fi
if [ -z "$LAN_PRIVATE_IP" ]; then
echo 'LAN_PRIVATE_IP is required'
echo 'Valid values are: "none", "auto" or a valid IP address'
echo 'Define it in the .env file'
exit 1
fi
if [ "$LAN_MODE" = 'true' ] && [ "$USE_TLS" = 'false' ]; then
echo 'LAN_MODE cannot be "true" if USE_TLS is "false"'
if [ "$LAN_MODE" = 'true' ] && [ "$USE_HTTPS" = 'false' ]; then
echo 'LAN_MODE cannot be "true" if USE_HTTPS is "false"'
exit 1
fi

View File

@ -1,9 +1,10 @@
#!/bin/sh
getDeploymentUrl() {
URL="http://localhost:8090"
if [ "${USE_TLS}" = 'true' ]; then
URL="https://localhost:4443"
schema="${1:-http}"
URL="$schema://localhost:7880"
if [ "${USE_HTTPS}" = 'true' ]; then
URL="${schema}s://localhost:7443"
fi
if [ "${LAN_MODE}" = 'true' ]; then
LAN_DOMAIN=${LAN_DOMAIN:-"openvidu-local.dev"}
@ -11,7 +12,7 @@ getDeploymentUrl() {
# Replace dots with dashes
LAN_DOMAIN="$(echo "$LAN_PRIVATE_IP" | sed 's/\./-/g').openvidu-local.dev"
fi
URL="https://${LAN_DOMAIN}:4443"
URL="${schema}s://${LAN_DOMAIN}:7443"
fi
echo "$URL"
}