From b28bffadfaf6079a050d0240ebfed9bf8570fc29 Mon Sep 17 00:00:00 2001 From: blukai <20866892+blukai@users.noreply.github.com> Date: Fri, 29 Nov 2024 03:46:18 +0100 Subject: [PATCH] add vortex voice server --- .gitignore | 1 + Caddyfile | 11 +++++++++++ README.md | 2 +- compose.yml | 13 +++++++++++++ generate_config.sh | 11 +++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f6a80ee..3d821a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ data* .env .env.web +.env.vortex Revolt.toml compose.override.yml diff --git a/Caddyfile b/Caddyfile index 1a0ca48..92ce119 100644 --- a/Caddyfile +++ b/Caddyfile @@ -24,5 +24,16 @@ reverse_proxy http://january:14705 } + route /vortex* { + @upgrade { + header Connection *Upgrade* + header Upgrade websocket + } + + uri strip_prefix /vortex + reverse_proxy http://vortex:8080 + reverse_proxy @upgrade http://vortex:8080 + } + reverse_proxy http://web:5000 } diff --git a/README.md b/README.md index 57c4aa0..eb361f8 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ cd revolt Generate a configuration file by running: ```bash -./generate_config.sh your.domain +./generate_config.sh ``` You can find [more options here](https://github.com/revoltchat/backend/blob/df074260196f5ed246e6360d8e81ece84d8d9549/crates/core/config/Revolt.toml), some noteworthy configuration options: diff --git a/compose.yml b/compose.yml index 7f9a785..55988e2 100644 --- a/compose.yml +++ b/compose.yml @@ -106,3 +106,16 @@ services: /usr/bin/mc mb minio/revolt-uploads; exit 0; " + + # Voice server (vortex) + vortex: + image: ghcr.io/revoltchat/vortex:0.3.0-alpha.1 + restart: always + env_file: .env.vortex + # NOTE: default range is 10000-11000 which seems like too much for a small + # self hosted instance + environment: + - RTC_MIN_PORT=10000 + - RTC_MAX_PORT=10100 + ports: + - "10000-10100:10000-10100" diff --git a/generate_config.sh b/generate_config.sh index c4476e4..2397274 100755 --- a/generate_config.sh +++ b/generate_config.sh @@ -11,6 +11,8 @@ echo "api = \"https://$1/api\"" >> Revolt.toml echo "events = \"wss://$1/ws\"" >> Revolt.toml echo "autumn = \"https://$1/autumn\"" >> Revolt.toml echo "january = \"https://$1/january\"" >> Revolt.toml +echo "voso_legacy = \"https://$1/vortex\"" >> Revolt.toml +echo "voso_legacy_ws = \"wss://$1/vortex\"" >> Revolt.toml # VAPID keys echo "" >> Revolt.toml @@ -24,3 +26,12 @@ rm vapid_private.pem echo "" >> Revolt.toml echo "[files]" >> Revolt.toml echo "encryption_key = \"$(openssl rand -base64 32)\"" >> Revolt.toml + +# configure vortex +vortex_manage_token=$(openssl rand -base64 32) +echo "WS_URL=wss://$1/vortex" > .env.vortex +echo "MANAGE_TOKEN=$vortex_manage_token" >> .env.vortex +echo "RTC_IPS=$2" >> .env.vortex +echo "" >> Revolt.toml +echo "[api.security]" >> Revolt.toml +echo "voso_legacy_token = \"$vortex_manage_token\"" >> Revolt.toml