Remove docker-compose.override files and caddy-proxy folders
This commit is contained in:
parent
4aa647f3cd
commit
9a0c5ba797
@ -1,23 +0,0 @@
|
||||
FROM golang:1.22.1 as builder
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETARCH
|
||||
|
||||
WORKDIR /workspace
|
||||
COPY . .
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build
|
||||
|
||||
FROM caddy/caddy:2.7.6-alpine
|
||||
|
||||
ARG VERSION
|
||||
RUN test -n "$VERSION" || (echo "VERSION arg is not set" && false)
|
||||
ENV VERSION $VERSION
|
||||
|
||||
COPY --from=builder /workspace/local-caddy-generate /usr/bin/local-caddy-generate
|
||||
COPY --from=builder /workspace/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /usr/bin/local-caddy-generate /entrypoint.sh
|
||||
|
||||
# Run the binary.
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/usr/bin/caddy", "run", "--config", "/config/caddy/Caddyfile"]
|
||||
@ -1,7 +0,0 @@
|
||||
# OpenVidu Local Deployment - Cadddy Proxy
|
||||
|
||||
If you want to modify any of the rules at the caddy-proxy container, just build the image again and run the local deployment with the new image.
|
||||
|
||||
```bash
|
||||
docker build --build-arg VERSION=custom -t caddy-proxy .
|
||||
```
|
||||
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Generate Caddyfile and index.html
|
||||
CURRENT_DIR="$(pwd)"
|
||||
TMP_DIR="/tmp/caddy-local"
|
||||
mkdir -p "$TMP_DIR"
|
||||
cd "$TMP_DIR"
|
||||
/usr/bin/local-caddy-generate
|
||||
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/app502client.html ]; then
|
||||
mkdir -p /var/www
|
||||
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
|
||||
cp "$TMP_DIR/Caddyfile" /config/caddy/Caddyfile
|
||||
fi
|
||||
cd "$CURRENT_DIR"
|
||||
rm -rf /tmp/caddy-local
|
||||
|
||||
# Start Caddy
|
||||
exec "$@"
|
||||
@ -1,3 +0,0 @@
|
||||
module local-caddy-generate
|
||||
|
||||
go 1.22.1
|
||||
@ -1,249 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"local-caddy-generate/templates"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type TemplateData any
|
||||
|
||||
var indexData = &templates.IndexData{}
|
||||
var caddyData = &templates.CaddyData{}
|
||||
var app502ClientData = &templates.App502Data{}
|
||||
var app502ServerData = &templates.App502Data{}
|
||||
|
||||
func main() {
|
||||
err := Initialize()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawIndex, err := GenerateTemplate(templates.IndexTemplate, indexData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = WriteStringToFile("index.html", rawIndex)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawCaddyfile, err := GenerateTemplate(templates.CaddyfileTemplate, caddyData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = WriteStringToFile("Caddyfile", rawCaddyfile)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawAppClient502, err := GenerateTemplate(templates.App502Template, app502ClientData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Initialize() error {
|
||||
// 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")
|
||||
}
|
||||
|
||||
rawUseHTTPS := os.Getenv("USE_HTTPS")
|
||||
if rawUseHTTPS == "" {
|
||||
rawUseHTTPS = "false"
|
||||
}
|
||||
useTLS, err := strconv.ParseBool(rawUseHTTPS)
|
||||
if err != nil {
|
||||
return fmt.Errorf("USE_HTTPS is not a boolean")
|
||||
}
|
||||
|
||||
lanMode := os.Getenv("LAN_MODE")
|
||||
if lanMode == "" {
|
||||
lanMode = "false"
|
||||
}
|
||||
|
||||
lanPrivateIP := os.Getenv("LAN_PRIVATE_IP")
|
||||
if lanPrivateIP == "" {
|
||||
return fmt.Errorf("LAN_PRIVATE_IP is not set")
|
||||
}
|
||||
|
||||
lanDomain := os.Getenv("LAN_DOMAIN")
|
||||
if lanDomain == "" {
|
||||
lanDomain = "openvidu-local.dev"
|
||||
}
|
||||
|
||||
if lanPrivateIP != "none" && lanDomain == "openvidu-local.dev" {
|
||||
ipDashes := strings.ReplaceAll(lanPrivateIP, ".", "-")
|
||||
lanDomain = fmt.Sprintf("%s.%s", ipDashes, lanDomain)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
livekitApiKey := os.Getenv("LIVEKIT_API_KEY")
|
||||
if livekitApiKey == "" {
|
||||
return fmt.Errorf("LIVEKIT_API_KEY is not set")
|
||||
}
|
||||
livekitApiSecret := os.Getenv("LIVEKIT_API_SECRET")
|
||||
if livekitApiSecret == "" {
|
||||
return fmt.Errorf("LIVEKIT_API_SECRET is not set")
|
||||
}
|
||||
openviduSecret := os.Getenv("OPENVIDU_SHIM_SECRET")
|
||||
if openviduSecret == "" {
|
||||
return fmt.Errorf("OPENVIDU_SHIM_SECRET is not set")
|
||||
}
|
||||
dashboadAdminUsername := os.Getenv("DASHBOARD_ADMIN_USERNAME")
|
||||
if dashboadAdminUsername == "" {
|
||||
return fmt.Errorf("DASHBOARD_ADMIN_USERNAME is not set")
|
||||
}
|
||||
dashboardAdminPassword := os.Getenv("DASHBOARD_ADMIN_PASSWORD")
|
||||
if dashboardAdminPassword == "" {
|
||||
return fmt.Errorf("DASHBOARD_ADMIN_PASSWORD is not set")
|
||||
}
|
||||
minioAccessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||
if minioAccessKey == "" {
|
||||
return fmt.Errorf("MINIO_ACCESS_KEY is not set")
|
||||
}
|
||||
minioSecretKey := os.Getenv("MINIO_SECRET_KEY")
|
||||
if minioSecretKey == "" {
|
||||
return fmt.Errorf("MINIO_SECRET_KEY is not set")
|
||||
}
|
||||
|
||||
indexData = &templates.IndexData{
|
||||
OpenViduVersion: version,
|
||||
LanMode: lanMode == "true",
|
||||
HttpUrl: httpUrl,
|
||||
HttpsUrl: httpsUrl,
|
||||
WsUrl: wsUrl,
|
||||
WssUrl: wssUrl,
|
||||
LiveKitApiKey: livekitApiKey,
|
||||
LiveKitApiSecret: livekitApiSecret,
|
||||
OpenViduSecret: openviduSecret,
|
||||
DashboardAdminUsername: dashboadAdminUsername,
|
||||
DashboardAdminPassword: dashboardAdminPassword,
|
||||
MinioAdminKey: minioAccessKey,
|
||||
MinioAdminSecret: minioSecretKey,
|
||||
}
|
||||
|
||||
caddyData = &templates.CaddyData{
|
||||
LanMode: lanMode == "true",
|
||||
LanDomain: lanDomain,
|
||||
// Main OpenVidu and LiveKit API ports
|
||||
HttpPort: strconv.Itoa(httpPort),
|
||||
HttpsPort: strconv.Itoa(httpsPort),
|
||||
// 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,
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
func GenerateTemplate(templateString string, data TemplateData) (string, error) {
|
||||
funcs := map[string]any{
|
||||
"contains": strings.Contains,
|
||||
"hasPrefix": strings.HasPrefix,
|
||||
"hasSuffix": strings.HasSuffix}
|
||||
|
||||
tmpl, err := template.New("template").Funcs(funcs).Parse(templateString)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := tmpl.Execute(&buf, data); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func WriteStringToFile(filePath string, data string) error {
|
||||
file, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_, err = file.WriteString(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package templates
|
||||
|
||||
type App502Data struct {
|
||||
Title string
|
||||
Message string
|
||||
}
|
||||
|
||||
const App502Template = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>502 - Application Not Found</title>
|
||||
<!-- Bootstrap CSS CDN -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<!-- Custom styles -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 50px;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.container {
|
||||
padding: 40px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
.error-code {
|
||||
font-size: 45px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div>
|
||||
<div class="error-code">502 - Bad Gateway</div>
|
||||
<h1 class="display-5">{{.Title}}</h1>
|
||||
<hr class="my-4">
|
||||
<p>{{ .Message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
@ -1,160 +0,0 @@
|
||||
package templates
|
||||
|
||||
type CaddyData struct {
|
||||
LanMode bool
|
||||
LanDomain string
|
||||
// Main OpenVidu and LiveKit API ports
|
||||
HttpPort string
|
||||
HttpsPort 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 = `
|
||||
(index) {
|
||||
# Default /
|
||||
handle_path /* {
|
||||
root * /var/www/
|
||||
file_server
|
||||
}
|
||||
}
|
||||
(general_rules) {
|
||||
# LiveKit API
|
||||
@openvidu path /twirp/* /rtc/* /rtc
|
||||
handle @openvidu {
|
||||
reverse_proxy http://openvidu:7880
|
||||
}
|
||||
|
||||
# OpenVidu v2 API
|
||||
@openvidu_v2 path /openvidu/api/* /openvidu/ws/*
|
||||
handle @openvidu_v2 {
|
||||
reverse_proxy http://host.docker.internal:4443
|
||||
}
|
||||
|
||||
# OpenVidu v2 Custom layout
|
||||
redir /openvidu/layouts /openvidu/layouts/
|
||||
handle_path /openvidu/layouts/* {
|
||||
uri strip_prefix /openvidu/layouts
|
||||
root * /var/www/custom-layout
|
||||
file_server
|
||||
}
|
||||
|
||||
# Minio console
|
||||
redir /minio-console /minio-console/
|
||||
handle_path /minio-console/* {
|
||||
uri strip_prefix /minio-console
|
||||
reverse_proxy http://minio:9001
|
||||
}
|
||||
|
||||
# OpenVidu Dashboard
|
||||
redir /dashboard /dashboard/
|
||||
handle_path /dashboard/* {
|
||||
rewrite * {path}
|
||||
reverse_proxy http://dashboard:5000
|
||||
}
|
||||
|
||||
# OpenVidu Call (Default App)
|
||||
redir /openvidu-call /openvidu-call/
|
||||
handle_path /openvidu-call/* {
|
||||
rewrite * {path}
|
||||
reverse_proxy http://default-app:5442
|
||||
}
|
||||
|
||||
}
|
||||
(application_client) {
|
||||
handle_errors {
|
||||
@502 expression {http.error.status_code} == 502
|
||||
rewrite @502 /app502client.html
|
||||
file_server {
|
||||
root /var/www
|
||||
}
|
||||
}
|
||||
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
|
||||
:{{.HttpPort}} {
|
||||
import general_rules
|
||||
import index
|
||||
}
|
||||
|
||||
{{- if .HttpsUrl }}
|
||||
|
||||
{{- if .LanMode }}
|
||||
|
||||
{{ .HttpsUrl }} {
|
||||
{{- if hasSuffix .LanDomain ".openvidu-local.dev" }}
|
||||
tls internal {
|
||||
get_certificate http https://certs.openvidu-local.dev/caddy.pem
|
||||
}
|
||||
{{- else }}
|
||||
tls internal
|
||||
{{- end }}
|
||||
import general_rules
|
||||
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 index
|
||||
}
|
||||
|
||||
https://*:{{.HttpsAppClientPort}} {
|
||||
tls internal
|
||||
import application_client
|
||||
}
|
||||
|
||||
https://*:{{.HttpsAppServerPort}} {
|
||||
tls internal
|
||||
import application_server
|
||||
}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- end}}
|
||||
`
|
||||
@ -1,100 +0,0 @@
|
||||
package templates
|
||||
|
||||
type IndexData struct {
|
||||
OpenViduVersion string
|
||||
LanMode bool
|
||||
HttpUrl string
|
||||
HttpsUrl string
|
||||
WsUrl string
|
||||
WssUrl string
|
||||
DashboardAdminUsername string
|
||||
DashboardAdminPassword string
|
||||
MinioAdminKey string
|
||||
MinioAdminSecret string
|
||||
LiveKitApiKey string
|
||||
LiveKitApiSecret string
|
||||
OpenViduSecret string
|
||||
}
|
||||
|
||||
const IndexTemplate = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>OpenVidu Local Deployment</title>
|
||||
<!-- Bootstrap CSS CDN -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<!-- Custom styles -->
|
||||
<style>
|
||||
.container {
|
||||
padding-top: 50px;
|
||||
padding-left: 100px;
|
||||
padding-right: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<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>
|
||||
{{- if .HttpsUrl }}
|
||||
{{- if .LanMode }}
|
||||
<li>From other devices in your LAN:
|
||||
{{- else }}
|
||||
<li>Using HTTPS:
|
||||
{{- end }}
|
||||
<ul>
|
||||
<li><a href="{{.HttpsUrl}}" target="_blank">{{.HttpsUrl}}</a></li>
|
||||
<li><a href="{{.WssUrl}}" target="_blank">{{.WssUrl}}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{{- end }}
|
||||
</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><a href="/minio-console" target="_blank">MinIO</a>
|
||||
<ul>
|
||||
<li>Username: <code>{{.MinioAdminKey}}</code></li>
|
||||
<li>Password: <code>{{.MinioAdminSecret}}</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/dashboard" target="_blank">OpenVidu Dashboard</a>
|
||||
<ul>
|
||||
<li>Username: <code>{{.DashboardAdminUsername}}</code></li>
|
||||
<li>Password: <code>{{.DashboardAdminPassword}}</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/openvidu-call" target="_blank">OpenVidu Call</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
`
|
||||
@ -1,26 +0,0 @@
|
||||
services:
|
||||
default-app:
|
||||
image: docker.io/wcm65pck/openvidu-call-demo:main
|
||||
container_name: openvidu-call
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_HTTPS=${USE_HTTPS:-false}
|
||||
- LAN_MODE=${LAN_MODE:-false}
|
||||
- LAN_DOMAIN=${LAN_DOMAIN:-}
|
||||
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
|
||||
- SERVER_PORT=5442
|
||||
- LIVEKIT_URL_PRIVATE=ws://openvidu:7880/
|
||||
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
|
||||
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
|
||||
- CALL_PRIVATE_ACCESS=DISABLED
|
||||
- CALL_USER=${CALL_USER:-}
|
||||
- CALL_SECRET=${CALL_SECRET:-}
|
||||
- CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET:-}
|
||||
- CALL_RECORDING=${CALL_RECORDING:-}
|
||||
volumes:
|
||||
- ./scripts/entrypoint_default_app.sh:/scripts/entrypoint.sh
|
||||
- ./scripts/utils.sh:/scripts/utils.sh
|
||||
entrypoint: /bin/sh /scripts/entrypoint.sh
|
||||
depends_on:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
@ -1,5 +1,4 @@
|
||||
services:
|
||||
|
||||
caddy-proxy:
|
||||
image: docker.io/wcm65pck/openvidu-caddy-local:main
|
||||
container_name: caddy-proxy
|
||||
@ -145,6 +144,32 @@ services:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
|
||||
default-app:
|
||||
image: docker.io/wcm65pck/openvidu-call-demo:main
|
||||
container_name: openvidu-call
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_HTTPS=${USE_HTTPS:-false}
|
||||
- LAN_MODE=${LAN_MODE:-false}
|
||||
- LAN_DOMAIN=${LAN_DOMAIN:-}
|
||||
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
|
||||
- SERVER_PORT=5442
|
||||
- LIVEKIT_URL_PRIVATE=ws://openvidu:7880/
|
||||
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
|
||||
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
|
||||
- CALL_PRIVATE_ACCESS=DISABLED
|
||||
- CALL_USER=${CALL_USER:-}
|
||||
- CALL_SECRET=${CALL_SECRET:-}
|
||||
- CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET:-}
|
||||
- CALL_RECORDING=${CALL_RECORDING:-}
|
||||
volumes:
|
||||
- ./scripts/entrypoint_default_app.sh:/scripts/entrypoint.sh
|
||||
- ./scripts/utils.sh:/scripts/utils.sh
|
||||
entrypoint: /bin/sh /scripts/entrypoint.sh
|
||||
depends_on:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
|
||||
ready-check:
|
||||
image: curlimages/curl:8.6.0
|
||||
container_name: ready-check
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
FROM golang:1.22.1 as builder
|
||||
|
||||
ARG TARGETOS
|
||||
ARG TARGETPLATFORM
|
||||
ARG TARGETARCH
|
||||
|
||||
WORKDIR /workspace
|
||||
COPY . .
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build
|
||||
|
||||
FROM caddy/caddy:2.7.6-alpine
|
||||
|
||||
ARG VERSION
|
||||
RUN test -n "$VERSION" || (echo "VERSION arg is not set" && false)
|
||||
ENV VERSION $VERSION
|
||||
|
||||
COPY --from=builder /workspace/local-caddy-generate /usr/bin/local-caddy-generate
|
||||
COPY --from=builder /workspace/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /usr/bin/local-caddy-generate /entrypoint.sh
|
||||
|
||||
# Run the binary.
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["/usr/bin/caddy", "run", "--config", "/config/caddy/Caddyfile"]
|
||||
@ -1,7 +0,0 @@
|
||||
# OpenVidu Local Deployment - Cadddy Proxy
|
||||
|
||||
If you want to modify any of the rules at the caddy-proxy container, just build the image again and run the local deployment with the new image.
|
||||
|
||||
```bash
|
||||
docker build --build-arg VERSION=custom -t caddy-proxy .
|
||||
```
|
||||
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Generate Caddyfile and index.html
|
||||
CURRENT_DIR="$(pwd)"
|
||||
TMP_DIR="/tmp/caddy-local"
|
||||
mkdir -p "$TMP_DIR"
|
||||
cd "$TMP_DIR"
|
||||
/usr/bin/local-caddy-generate
|
||||
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/app502client.html ]; then
|
||||
mkdir -p /var/www
|
||||
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
|
||||
cp "$TMP_DIR/Caddyfile" /config/caddy/Caddyfile
|
||||
fi
|
||||
cd "$CURRENT_DIR"
|
||||
rm -rf /tmp/caddy-local
|
||||
|
||||
# Start Caddy
|
||||
exec "$@"
|
||||
@ -1,3 +0,0 @@
|
||||
module local-caddy-generate
|
||||
|
||||
go 1.22.1
|
||||
@ -1,249 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"local-caddy-generate/templates"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type TemplateData any
|
||||
|
||||
var indexData = &templates.IndexData{}
|
||||
var caddyData = &templates.CaddyData{}
|
||||
var app502ClientData = &templates.App502Data{}
|
||||
var app502ServerData = &templates.App502Data{}
|
||||
|
||||
func main() {
|
||||
err := Initialize()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawIndex, err := GenerateTemplate(templates.IndexTemplate, indexData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = WriteStringToFile("index.html", rawIndex)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawCaddyfile, err := GenerateTemplate(templates.CaddyfileTemplate, caddyData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = WriteStringToFile("Caddyfile", rawCaddyfile)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
rawAppClient502, err := GenerateTemplate(templates.App502Template, app502ClientData)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Initialize() error {
|
||||
// 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")
|
||||
}
|
||||
|
||||
rawUseHTTPS := os.Getenv("USE_HTTPS")
|
||||
if rawUseHTTPS == "" {
|
||||
rawUseHTTPS = "false"
|
||||
}
|
||||
useTLS, err := strconv.ParseBool(rawUseHTTPS)
|
||||
if err != nil {
|
||||
return fmt.Errorf("USE_HTTPS is not a boolean")
|
||||
}
|
||||
|
||||
lanMode := os.Getenv("LAN_MODE")
|
||||
if lanMode == "" {
|
||||
lanMode = "false"
|
||||
}
|
||||
|
||||
lanPrivateIP := os.Getenv("LAN_PRIVATE_IP")
|
||||
if lanPrivateIP == "" {
|
||||
return fmt.Errorf("LAN_PRIVATE_IP is not set")
|
||||
}
|
||||
|
||||
lanDomain := os.Getenv("LAN_DOMAIN")
|
||||
if lanDomain == "" {
|
||||
lanDomain = "openvidu-local.dev"
|
||||
}
|
||||
|
||||
if lanPrivateIP != "none" && lanDomain == "openvidu-local.dev" {
|
||||
ipDashes := strings.ReplaceAll(lanPrivateIP, ".", "-")
|
||||
lanDomain = fmt.Sprintf("%s.%s", ipDashes, lanDomain)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
livekitApiKey := os.Getenv("LIVEKIT_API_KEY")
|
||||
if livekitApiKey == "" {
|
||||
return fmt.Errorf("LIVEKIT_API_KEY is not set")
|
||||
}
|
||||
livekitApiSecret := os.Getenv("LIVEKIT_API_SECRET")
|
||||
if livekitApiSecret == "" {
|
||||
return fmt.Errorf("LIVEKIT_API_SECRET is not set")
|
||||
}
|
||||
openviduSecret := os.Getenv("OPENVIDU_SHIM_SECRET")
|
||||
if openviduSecret == "" {
|
||||
return fmt.Errorf("OPENVIDU_SHIM_SECRET is not set")
|
||||
}
|
||||
dashboadAdminUsername := os.Getenv("DASHBOARD_ADMIN_USERNAME")
|
||||
if dashboadAdminUsername == "" {
|
||||
return fmt.Errorf("DASHBOARD_ADMIN_USERNAME is not set")
|
||||
}
|
||||
dashboardAdminPassword := os.Getenv("DASHBOARD_ADMIN_PASSWORD")
|
||||
if dashboardAdminPassword == "" {
|
||||
return fmt.Errorf("DASHBOARD_ADMIN_PASSWORD is not set")
|
||||
}
|
||||
minioAccessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||
if minioAccessKey == "" {
|
||||
return fmt.Errorf("MINIO_ACCESS_KEY is not set")
|
||||
}
|
||||
minioSecretKey := os.Getenv("MINIO_SECRET_KEY")
|
||||
if minioSecretKey == "" {
|
||||
return fmt.Errorf("MINIO_SECRET_KEY is not set")
|
||||
}
|
||||
|
||||
indexData = &templates.IndexData{
|
||||
OpenViduVersion: version,
|
||||
LanMode: lanMode == "true",
|
||||
HttpUrl: httpUrl,
|
||||
HttpsUrl: httpsUrl,
|
||||
WsUrl: wsUrl,
|
||||
WssUrl: wssUrl,
|
||||
LiveKitApiKey: livekitApiKey,
|
||||
LiveKitApiSecret: livekitApiSecret,
|
||||
OpenViduSecret: openviduSecret,
|
||||
DashboardAdminUsername: dashboadAdminUsername,
|
||||
DashboardAdminPassword: dashboardAdminPassword,
|
||||
MinioAdminKey: minioAccessKey,
|
||||
MinioAdminSecret: minioSecretKey,
|
||||
}
|
||||
|
||||
caddyData = &templates.CaddyData{
|
||||
LanMode: lanMode == "true",
|
||||
LanDomain: lanDomain,
|
||||
// Main OpenVidu and LiveKit API ports
|
||||
HttpPort: strconv.Itoa(httpPort),
|
||||
HttpsPort: strconv.Itoa(httpsPort),
|
||||
// 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,
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
func GenerateTemplate(templateString string, data TemplateData) (string, error) {
|
||||
funcs := map[string]any{
|
||||
"contains": strings.Contains,
|
||||
"hasPrefix": strings.HasPrefix,
|
||||
"hasSuffix": strings.HasSuffix}
|
||||
|
||||
tmpl, err := template.New("template").Funcs(funcs).Parse(templateString)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if err := tmpl.Execute(&buf, data); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func WriteStringToFile(filePath string, data string) error {
|
||||
file, err := os.Create(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_, err = file.WriteString(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package templates
|
||||
|
||||
type App502Data struct {
|
||||
Title string
|
||||
Message string
|
||||
}
|
||||
|
||||
const App502Template = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>502 - Application Not Found</title>
|
||||
<!-- Bootstrap CSS CDN -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<!-- Custom styles -->
|
||||
<style>
|
||||
body {
|
||||
padding-top: 50px;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.container {
|
||||
padding: 40px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
.error-code {
|
||||
font-size: 45px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div>
|
||||
<div class="error-code">502 - Bad Gateway</div>
|
||||
<h1 class="display-5">{{.Title}}</h1>
|
||||
<hr class="my-4">
|
||||
<p>{{ .Message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
`
|
||||
@ -1,160 +0,0 @@
|
||||
package templates
|
||||
|
||||
type CaddyData struct {
|
||||
LanMode bool
|
||||
LanDomain string
|
||||
// Main OpenVidu and LiveKit API ports
|
||||
HttpPort string
|
||||
HttpsPort 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 = `
|
||||
(index) {
|
||||
# Default /
|
||||
handle_path /* {
|
||||
root * /var/www/
|
||||
file_server
|
||||
}
|
||||
}
|
||||
(general_rules) {
|
||||
# LiveKit API
|
||||
@openvidu path /twirp/* /rtc/* /rtc
|
||||
handle @openvidu {
|
||||
reverse_proxy http://openvidu:7880
|
||||
}
|
||||
|
||||
# OpenVidu v2 API
|
||||
@openvidu_v2 path /openvidu/api/* /openvidu/ws/*
|
||||
handle @openvidu_v2 {
|
||||
reverse_proxy http://host.docker.internal:4443
|
||||
}
|
||||
|
||||
# OpenVidu v2 Custom layout
|
||||
redir /openvidu/layouts /openvidu/layouts/
|
||||
handle_path /openvidu/layouts/* {
|
||||
uri strip_prefix /openvidu/layouts
|
||||
root * /var/www/custom-layout
|
||||
file_server
|
||||
}
|
||||
|
||||
# Minio console
|
||||
redir /minio-console /minio-console/
|
||||
handle_path /minio-console/* {
|
||||
uri strip_prefix /minio-console
|
||||
reverse_proxy http://minio:9001
|
||||
}
|
||||
|
||||
# OpenVidu Dashboard
|
||||
redir /dashboard /dashboard/
|
||||
handle_path /dashboard/* {
|
||||
rewrite * {path}
|
||||
reverse_proxy http://dashboard:5000
|
||||
}
|
||||
|
||||
# OpenVidu Call (Default App)
|
||||
redir /openvidu-call /openvidu-call/
|
||||
handle_path /openvidu-call/* {
|
||||
rewrite * {path}
|
||||
reverse_proxy http://default-app:5442
|
||||
}
|
||||
|
||||
}
|
||||
(application_client) {
|
||||
handle_errors {
|
||||
@502 expression {http.error.status_code} == 502
|
||||
rewrite @502 /app502client.html
|
||||
file_server {
|
||||
root /var/www
|
||||
}
|
||||
}
|
||||
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
|
||||
:{{.HttpPort}} {
|
||||
import general_rules
|
||||
import index
|
||||
}
|
||||
|
||||
{{- if .HttpsUrl }}
|
||||
|
||||
{{- if .LanMode }}
|
||||
|
||||
{{ .HttpsUrl }} {
|
||||
{{- if hasSuffix .LanDomain ".openvidu-local.dev" }}
|
||||
tls internal {
|
||||
get_certificate http https://certs.openvidu-local.dev/caddy.pem
|
||||
}
|
||||
{{- else }}
|
||||
tls internal
|
||||
{{- end }}
|
||||
import general_rules
|
||||
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 index
|
||||
}
|
||||
|
||||
https://*:{{.HttpsAppClientPort}} {
|
||||
tls internal
|
||||
import application_client
|
||||
}
|
||||
|
||||
https://*:{{.HttpsAppServerPort}} {
|
||||
tls internal
|
||||
import application_server
|
||||
}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- end}}
|
||||
`
|
||||
@ -1,100 +0,0 @@
|
||||
package templates
|
||||
|
||||
type IndexData struct {
|
||||
OpenViduVersion string
|
||||
LanMode bool
|
||||
HttpUrl string
|
||||
HttpsUrl string
|
||||
WsUrl string
|
||||
WssUrl string
|
||||
DashboardAdminUsername string
|
||||
DashboardAdminPassword string
|
||||
MinioAdminKey string
|
||||
MinioAdminSecret string
|
||||
LiveKitApiKey string
|
||||
LiveKitApiSecret string
|
||||
OpenViduSecret string
|
||||
}
|
||||
|
||||
const IndexTemplate = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>OpenVidu Local Deployment</title>
|
||||
<!-- Bootstrap CSS CDN -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<!-- Custom styles -->
|
||||
<style>
|
||||
.container {
|
||||
padding-top: 50px;
|
||||
padding-left: 100px;
|
||||
padding-right: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<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>
|
||||
{{- if .HttpsUrl }}
|
||||
{{- if .LanMode }}
|
||||
<li>From other devices in your LAN:
|
||||
{{- else }}
|
||||
<li>Using HTTPS:
|
||||
{{- end }}
|
||||
<ul>
|
||||
<li><a href="{{.HttpsUrl}}" target="_blank">{{.HttpsUrl}}</a></li>
|
||||
<li><a href="{{.WssUrl}}" target="_blank">{{.WssUrl}}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{{- end }}
|
||||
</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><a href="/minio-console" target="_blank">MinIO</a>
|
||||
<ul>
|
||||
<li>Username: <code>{{.MinioAdminKey}}</code></li>
|
||||
<li>Password: <code>{{.MinioAdminSecret}}</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/dashboard" target="_blank">OpenVidu Dashboard</a>
|
||||
<ul>
|
||||
<li>Username: <code>{{.DashboardAdminUsername}}</code></li>
|
||||
<li>Password: <code>{{.DashboardAdminPassword}}</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/openvidu-call" target="_blank">OpenVidu Call</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
`
|
||||
@ -1,26 +0,0 @@
|
||||
services:
|
||||
default-app:
|
||||
image: docker.io/wcm65pck/openvidu-call-demo:main
|
||||
container_name: openvidu-call
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_HTTPS=${USE_HTTPS:-false}
|
||||
- LAN_MODE=${LAN_MODE:-false}
|
||||
- LAN_DOMAIN=${LAN_DOMAIN:-}
|
||||
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
|
||||
- SERVER_PORT=5442
|
||||
- LIVEKIT_URL_PRIVATE=ws://openvidu:7880/
|
||||
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
|
||||
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
|
||||
- CALL_PRIVATE_ACCESS=DISABLED
|
||||
- CALL_USER=${CALL_USER:-}
|
||||
- CALL_SECRET=${CALL_SECRET:-}
|
||||
- CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET:-}
|
||||
- CALL_RECORDING=${CALL_RECORDING:-}
|
||||
volumes:
|
||||
- ./scripts/entrypoint_default_app.sh:/scripts/entrypoint.sh
|
||||
- ./scripts/utils.sh:/scripts/utils.sh
|
||||
entrypoint: /bin/sh /scripts/entrypoint.sh
|
||||
depends_on:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
@ -1,5 +1,4 @@
|
||||
services:
|
||||
|
||||
caddy-proxy:
|
||||
image: docker.io/wcm65pck/openvidu-caddy-local:main
|
||||
container_name: caddy-proxy
|
||||
@ -147,6 +146,32 @@ services:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
|
||||
default-app:
|
||||
image: docker.io/wcm65pck/openvidu-call-demo:main
|
||||
container_name: openvidu-call
|
||||
restart: on-failure
|
||||
environment:
|
||||
- USE_HTTPS=${USE_HTTPS:-false}
|
||||
- LAN_MODE=${LAN_MODE:-false}
|
||||
- LAN_DOMAIN=${LAN_DOMAIN:-}
|
||||
- LAN_PRIVATE_IP=${LAN_PRIVATE_IP:-}
|
||||
- SERVER_PORT=5442
|
||||
- LIVEKIT_URL_PRIVATE=ws://openvidu:7880/
|
||||
- LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
|
||||
- LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
|
||||
- CALL_PRIVATE_ACCESS=DISABLED
|
||||
- CALL_USER=${CALL_USER:-}
|
||||
- CALL_SECRET=${CALL_SECRET:-}
|
||||
- CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET:-}
|
||||
- CALL_RECORDING=${CALL_RECORDING:-}
|
||||
volumes:
|
||||
- ./scripts/entrypoint_default_app.sh:/scripts/entrypoint.sh
|
||||
- ./scripts/utils.sh:/scripts/utils.sh
|
||||
entrypoint: /bin/sh /scripts/entrypoint.sh
|
||||
depends_on:
|
||||
setup:
|
||||
condition: service_completed_successfully
|
||||
|
||||
openvidu-v2compatibility:
|
||||
image: docker.io/wcm65pck/openvidu-v2compatibility:main
|
||||
restart: unless-stopped
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user