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..e3f060a 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ apt-get update && apt-get upgrade -y ufw allow ssh ufw allow http ufw allow https +ufw allow 10000:10100/tcp +ufw allow 10000:10100/udp ufw default deny ufw enable @@ -124,9 +126,11 @@ cd revolt Generate a configuration file by running: ```bash -./generate_config.sh your.domain +./generate_config.sh <your.domain> <vortex rtc ips> ``` +For `<vortex rtc ips>`, you will likely want to specify `0.0.0.0,your.external.ip.address`; For more information, see the [vortex's readme](https://github.com/revoltchat/vortex). + You can find [more options here](https://github.com/revoltchat/backend/blob/df074260196f5ed246e6360d8e81ece84d8d9549/crates/core/config/Revolt.toml), some noteworthy configuration options: - Email verification 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