diff --git a/.devcontainer/docker-compose.dev.yaml b/.devcontainer/docker-compose.dev.yaml index 8294003..d48e29e 100644 --- a/.devcontainer/docker-compose.dev.yaml +++ b/.devcontainer/docker-compose.dev.yaml @@ -43,12 +43,24 @@ services: image: livekit/livekit-server:v1.3 command: --config /etc/livekit.yaml restart: unless-stopped + depends_on: + - redis ports: - "7881:7881" - "7882:7882/udp" volumes: - ./livekit.yaml:/etc/livekit.yaml:ro + egress: + image: livekit/egress:v1.5 + restart: unless-stopped + depends_on: + - redis + environment: + - EGRESS_CONFIG_FILE=/etc/egress.yaml + volumes: + - ./egress.yaml:/etc/egress.yaml:ro + caddy: image: caddy:2 restart: unless-stopped diff --git a/.devcontainer/egress.yaml b/.devcontainer/egress.yaml new file mode 100644 index 0000000..c7f7728 --- /dev/null +++ b/.devcontainer/egress.yaml @@ -0,0 +1,11 @@ +# required fields +api_key: devkey +api_secret: secret +ws_url: ws://livekit:7880 +redis: + address: redis:6379 + db: 1 + +# optional fields +template_base: https://audon.localhost/egress +insecure: true diff --git a/.devcontainer/livekit.yaml b/.devcontainer/livekit.yaml index ee4e875..90d20c5 100644 --- a/.devcontainer/livekit.yaml +++ b/.devcontainer/livekit.yaml @@ -18,6 +18,10 @@ webhook: urls: - http://devcontainer:8100/app/webhook +redis: + address: redis:6379 + db: 1 + room: auto_create: false empty_timeout: 30 diff --git a/.env.production.sample b/.env.production.sample index ed1c19d..902a526 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -37,3 +37,9 @@ BOT_SERVER= BOT_CLIENT_ID= BOT_CLIENT_SECRET= BOT_ACCESS_TOKEN= + +### Archive Settings ### +# Leave the following fields empty to disable archiving. +PEERTUBE_SERVER= +PEERTUBE_USER= +PEERTUBE_PASSWORD= diff --git a/.gitmodules b/.gitmodules index e69de29..7f3e573 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "peertube"] + path = peertube + url = https://framagit.org/framasoft/peertube/clients/go.git diff --git a/archive.go b/archive.go new file mode 100644 index 0000000..06ab7d0 --- /dev/null +++ b/archive.go @@ -0,0 +1 @@ +package main diff --git a/config.go b/config.go index ed9f59d..35764c1 100644 --- a/config.go +++ b/config.go @@ -16,6 +16,7 @@ type ( AppConfig struct { AppConfigBase Livekit *LivekitConfig + PeerTube *PeerTubeConfig MongoURL *url.URL Database *DBConfig Redis *RedisConfig @@ -31,6 +32,16 @@ type ( LogoImageFront image.Image } + PeerTubeConfig struct { + Enable bool + Server *url.URL + User string + Password string + ClientID string + ClientSecret string + AccessToken string + } + LivekitConfig struct { APIKey string `validate:"required,ascii"` APISecret string `validate:"required,ascii"` @@ -205,5 +216,21 @@ func loadConfig(envname string) (*AppConfig, error) { } appConf.Bot = botConf + // Setup PeerTube config + ptHost := os.Getenv("PEERTUBE_SERVER") + ptConf := &PeerTubeConfig{ + Enable: ptHost != "", + User: os.Getenv("PEERTUBE_USER"), + Password: os.Getenv("PEERTUBE_PASSWORD"), + } + if ptConf.Enable { + ptConf.Server = &url.URL{ + Host: ptHost, + Scheme: "https", + Path: "/", + } + } + appConf.PeerTube = ptConf + return &appConf, nil } diff --git a/config/egress.sample.yaml b/config/egress.sample.yaml new file mode 100644 index 0000000..ec16348 --- /dev/null +++ b/config/egress.sample.yaml @@ -0,0 +1,11 @@ +# required fields +api_key: devkey +api_secret: secret +ws_url: wss://livekit.example.com:7880 +redis: + address: 127.0.0.1:6379 + db: 1 + +# optional fields +template_base: https://example.com/egress +insecure: false diff --git a/peertube b/peertube new file mode 160000 index 0000000..f53e807 --- /dev/null +++ b/peertube @@ -0,0 +1 @@ +Subproject commit f53e8075f7f9ec8a26ce09747f95e9a725f5b19f