networked-aframe / naf-janus-adapter

networked-aframe Janus network adapter
Mozilla Public License 2.0
12 stars 9 forks source link

Add janus deployment documentation #8

Closed vincentfretin closed 3 years ago

vincentfretin commented 3 years ago

@mqp for information, I started writing a doc how to deploy janus sfu from discussions I had with several people on Slack. I'll keep it as draft for now until I have some time to retest all that myself on a new VM. If someone want to give it a try, don't hesitate to give me feedbacks.

mqp commented 3 years ago

Looks reasonable, the only thing that jumps out at me is that in your instructions you both apt-get libsrtp/libnice and then also install them from source. I guess you probably don't mean to apt-get them.

If you use 20.04 I bet you don't need to install some of that stuff from source anymore.

vincentfretin commented 3 years ago

Thanks for the quick review. You're right I'm doing apt-get install libnice-dev libsrtp-dev at the beginning and I'm actually removing them apt-get remove -y libsrtp0-dev libsrtp0 and apt-get remove -y libnice-dev libnice10 before compile them from source. So it's probably unneeded unless it installs other indirect dependencies needed to build the libs from source, I would have to check to be sure. The commands here came from the Dockerfile I'm currently using, based on several documentation I came across. Those commands should be tested on Ubuntu 20.04 to see if some dependencies are new enough and don't need to be compiled from source.

vincentfretin commented 3 years ago

quick check in a ubuntu 18.04 container:

docker run -it --rm ubuntu:18.04
apt-get update
apt-get install -y libmicrohttpd-dev libjansson-dev libssl-dev libglib2.0-dev libopus-dev libogg-dev libconfig-dev libssl-dev pkg-config gengetopt libtool automake build-essential subversion git cmake unzip zip cargo wget sudo
apt-get install libsrtp-dev
# This installs libsrtp0 libsrtp0-dev, so yeah this one seems really unneeded
apt-get install libnice-dev
# This installs dconf-gsettings-backend dconf-service gir1.2-freedesktop gir1.2-glib-2.0 gir1.2-gssdp-1.0 gir1.2-gupnp-1.0 gir1.2-gupnpigd-1.0 gir1.2-harfbuzz-0.0 gir1.2-nice-0.1 gir1.2-soup-2.4 glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas icu-devtools libdconf1 libfreetype6 libgirepository-1.0-1 libgraphite2-3 libgraphite2-dev libgssdp-1.0-3 libgssdp-1.0-dev libgupnp-1.0-4 libgupnp-1.0-dev libgupnp-igd-1.0-4 libgupnp-igd-1.0-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libnice-dev libnice10 libpng16-16 libproxy1v5 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsoup-gnome2.4-1 libsoup2.4-1 libsoup2.4-dev libxml2-dev python python-minimal python2.7 python2.7-minimal uuid-dev
# some of those dev dependencies may be needed to build libnice from source?
vincentfretin commented 3 years ago

The only difference I can see: Without apt-get install libnice-dev, ninja -C build gives

Run-time dependency gupnp-igd-1.0 found: NO (tried pkgconfig and cmake)

With apt-get install libnice-dev, ninja -C build gives

Run-time dependency gupnp-igd-1.0 found: YES 0.2.5

I don't know what this gupnp-igd is about or if this is used at all with janus. I don't think so. So yeah we can get rid of apt-get install libnice-dev libsrtp0-dev entirely I think.

vincentfretin commented 3 years ago

Quick check on package versions on Ubuntu 20.04 libsrtp-dev doesn't exist libwebsockets-dev is at version 3.2.1-3 and I compile 3.2.3 here libnice-dev is at version 0.1.16-1 and I compile 0.1.18 here. So the commands still apply for Ubuntu 20.04

vincentfretin commented 3 years ago

Ok, the build instructions has been updated and tested for Ubuntu 20.04.

mqp commented 3 years ago

libsrtp-dev doesn't exist

This one got renamed to libsrtp2-dev in 20.04 FWIW.

vincentfretin commented 3 years ago

Thanks, and it's the same version 2.3.0 this simplifies the instructions https://github.com/networked-aframe/naf-janus-adapter/pull/8/commits/e5d544f3cae26458231e1ddca772248da02ddc00

vincentfretin commented 3 years ago

Hum, with system libsrtp, janus doesn't work anymore, I have those errors:

[Sun Apr 11 09:15:17 2021] [ERR] [dtls.c:janus_dtls_srtp_incoming_msg:923] [2017202708106755] Oops, error creating inbound SRTP session for component 1 in stream 1??
[Sun Apr 11 09:15:17 2021] [ERR] [dtls.c:janus_dtls_srtp_incoming_msg:924] [2017202708106755]  -- 1 (srtp_err_status_fail)

I put back my build of libsrtp.

PlumCantaloupe commented 3 years ago

I am not sure if this is in scope or not (please excuse if not), but many of us running A-frame are using node.js. For the proxy stuff can you also have nginx running, or is there an alternative way you might suggest to do that with node (on port 80)?

vincentfretin commented 3 years ago

You can have nginx serving the janus websocket and your node.js websocket in the same config yes. You just add a /socket.io rule for example similar to the /janus rule. Say your node.js is on port 3000, you will use proxy_pass http://127.0.0.1:3000; that's it.

PlumCantaloupe commented 3 years ago

Okay great thank you. I’ll try this out.

vincentfretin commented 3 years ago

I tested the last instructions on a Scaleway instance. All is working great. I committed the documentation directly on master https://github.com/networked-aframe/naf-janus-adapter/blob/master/docs/janus-deployment.md