So, I am working on a program that requires incoming http and rtmp to the server to be processed by LXD containers on the same server. I can forward the incoming rtmp to the correct container where the rtmp segments are being stored as .ts segments and the m3u8 file. HAproxy handles this fine.
My problem is the getting the stream ID play. This is done by http and works fine without using containers.
However does not work from the container.
The following network screen grab are for the working case that is not using containers. Can this be duplicated using haproxy in the case of using containers to store the video and play it?
Here is the current haproxy.cfg I am using to forward the rtmp requests. I have redacted the host IP for obvious reasons. Note that I can ping out from the containers to the host as well as to the internet (yahoo, google, etc).
So, I have a REACT application video player on the host that uses port 3000. But now I am wondering if I should create another container and install the player there?
The Media Server appears to be working properly as I can see the live video segments being created. The broadcaster points his rtmp to the host server, for example rtmp://”host IP”:1935/container1 and is forwarded via host HAproxy to container1, port 1935 where the media server is listening.
I can create an MP4 from the .ts segments that the media server creates, using ffmpeg which pretty much proves the front end of this process is working.
However I need to be able to view the video from the internet to confirm things are working from beginning to end, end being viewing the broadcast from the internet.
My next experiment will be to use iptables in the host to port-forward incoming http://server IP/container1 on port 80 to the HAPROXY container where HAproxy will then forward the request to either the video player on the host, or the player in it’s own container?
I don’t know if having the video player in its own container buys me anything?
Note that I am doing this locally. This configuration is for testing only. Eventually I will be using CDN to distribute the live stream.
So disclaimer, I am not a programmer at all. I am technical savvy and just trying to get an idea to work.
Forgot to include that I am running nginx. I have not touched the nginx configuration.
So the broadcast viewer would browse to http://“server IP”/LPC1 for example.
The server has HAproxy running and should forward this http to the container Player. I know very little about HAproxy so you help would be much appreciated.
mode http
option forwardfor
no option httpclose
option http-server-close
option forceclose
server Player 10.106.37.166:3000/embed/0x35e01199F8137077346FDD476191f1967A52BDb5 check
backend LPC2
mode http
option forwardfor
no option httpclose
option http-server-close
option forceclose
server Player 10.106.37.166:3000/embed/0x45e0111238137077346FDD476191f1967A52AC23 check
This is not a valid configuration. You don’t specify the URI or parts of it here. After the port number there must come a space with additional keywords, like check, or end of line.
404 not found is generated by the backend server, haproxy never generates this error.