Running our SFU

Since you have some dependencies such as GCC, FFMPEG, libsrt, its easier to run it using docker.

# Build the image
docker build -t sfu .
 
# Create and start a container
docker run -d -p 5000:5000 -p 1935:1935 -p 7000:7000 -p 50051:50051 sfu
 
# With whip
docker run --rm -p 5000:5000 -p 1935:1935 -p 7000:7000 -p 50051:50051 -p 8989:8989 -p 5000-5200:5000-5200/udp sfu
 
# Check that its running
docker container ps -a

When running in Docker you are using a NAT, so you have to configure things further, just to make it work locally you can add this:

You can then run the example located in examples/publish-webrtc go run main.go

Testing with Galene

Endpoint: http://localhost:8443/group/test/

Running from WSL2

  1. Install go
    1. Download it: curl -OL https://go.dev/dl/go1.19.linux-amd64.tar.gz
    2. Install it sudo tar -C /usr/local -xvf go1.19.linux-amd64.tar.gz
    3. Add it to the path sudo nano ~/.profile, add export PATH=$PATH:/usr/local/go/bin at the end, save and close and refresh source ~/.profile
    4. Test go version
  2. Install dependencies for our project sudo apt install ffmpeg gcc musl libavfilter-dev libavdevice-dev libavformat-dev libavcodec-dev
  3. Build SRT manually:
    1. Install deps sudo apt-get install make tclsh pkg-config cmake libssl-dev build-essential
    2. Clone the repo git clone https://github.com/Haivision/srt.git
    3. Build and install ./configure then make install, with that it’ll be added to the path.
    4. You might need to add export LD_LIBRARY_PATH=/usr/local/lib/ to the path.
  4. You can run the project go run cmd/main.go

If you need to find whats the IP from outside wsl, type this in pshell:

wsl -- ip -o -4 -json addr list eth0 `
| ConvertFrom-Json `
| %{ $_.addr_info.local } `
| ?{ $_ }