Skip to content

Commit

Permalink
fix: update for 2.2.0 of irl-srt-server
Browse files Browse the repository at this point in the history
  • Loading branch information
datagutt committed Oct 30, 2024
1 parent eb4a1c5 commit 27ce9b4
Show file tree
Hide file tree
Showing 9 changed files with 915 additions and 929 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20 as builder
FROM alpine:3.20 AS builder
RUN apk update &&\
apk upgrade &&\
apk add --no-cache linux-headers alpine-sdk cmake tcl openssl-dev zlib-dev spdlog spdlog-dev cmake
Expand Down Expand Up @@ -31,7 +31,7 @@ RUN cp /build/srtla/irltk_srtla_rec /usr/local/bin/srtla_rec
# I honestly don't know why this is needed after rebasing with mainstream SRT
RUN cp /build/srt/srtcore/srt_compat.h /usr/local/include/srt/

ENV LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib64
ENV LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib64
ARG SRT_LIVE_SERVER_VERSION=master
# use custom irl srt server from irlserver
RUN set -xe; \
Expand All @@ -48,7 +48,7 @@ RUN set -xe; \
# runtime container with server
#
FROM node:alpine3.20
ENV LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib64
ENV LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib64
RUN apk add --update --no-cache openssl libstdc++ supervisor perl coreutils spdlog spdlog-dev

COPY --from=builder /usr/local/lib /usr/local/lib
Expand Down
1,348 changes: 674 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag datagutt/belabox-receiver .

push:
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag datagutt/belabox-receiver .
build:
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag datagutt/belabox-receiver .

push:
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag datagutt/belabox-receiver .
80 changes: 46 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
# belabox-receiver

A reverse engineered and enhanced Dockerfile for datagutt/belabox-receiver. Has support for multiple streams with per-stream authentication.

Work in progress. A few streamers i know are personally using this image for their Twitch streams but I can't guarantee anything.

**WARNING: This is not an official Belabox project. Please don't spam rationalirl about it!**

We using the following great open-source projects:
- srt-new from https://github.com/IRLServer/srt-new
- srtla_rec from https://github.com/IRLServer/srtla/tree/irltk-fork
- irl-srt-server (srt-live-server fork) from https://github.com/IRLServer/irl-srt-server

## Manual
It requires the following ports to be published:

5000:5000/udp
8181/8181/tcp
8282/8282/udp
3000/3000/tcp

Modify everything in bold below, then start with:

docker run -d --name belabox-receiver -p 5000:5000/udp -p 8181:8181/tcp -p 8282:8282/udp -p 3000:3000/tcp datagutt/belabox-receiver:latest

Configure SRT receiver and SRT port within belabox to point to the docker container's IP address (or a port-forward on your router).
Within Belabox, set "live/stream/belabox?srtauth=belabox" as SRT streamid.

To retrieve the SRT-Stream (via OBS, VLC etc.), open the following URL:
srt://your-public-container-ip:8282/?streamid=play/stream/belabox?srtauth=belabox

Private Statistics-URL (will leak all live stream keys): http://your-public-container-ip:8181/stats

Public Statistics-URL (preferreable): http://your-public-container-ip:3000/stats?streamer=belabox&key=belabox
# belabox-receiver

SRTLA Belabox receiver with support for multiple streams and per-stream authentication.

Work in progress. A few streamers i know are personally using this image for their Twitch streams but I can't guarantee anything.

**WARNING: This is not an official Belabox project. Please don't spam rationalirl about it!**

We using the following great open-source projects:
- srt-new from https://github.com/IRLServer/srt-new
- srtla_rec from https://github.com/IRLServer/srtla/tree/irltk-fork
- irl-srt-server (srt-live-server fork) from https://github.com/IRLServer/irl-srt-server

## Manual
It requires the following ports to be published:

5000:5000/udp
8181/8181/tcp
8282/8282/udp
3000/3000/tcp

Create a config.json file containing:
```json
{
"auth": [
{
"user": "belabox",
"key": "belabox"
}
]
}
``

Modify everything in bold below, then start with:

docker run -d --name belabox-receiver -p 5000:5000/udp -p 8181:8181/tcp -p 8282:8282/udp -p 3000:3000/tcp -v ./config.json:/app/config.json datagutt/belabox-receiver:latest

Configure SRT receiver and SRT port within belabox to point to the docker container's IP address (or a port-forward on your router).
Within Belabox, set "live/stream/belabox?srtauth=belabox" as SRT streamid.

To retrieve the SRT-Stream (via OBS, VLC etc.), open the following URL:
srt://your-public-container-ip:8282/?streamid=play/stream/belabox?srtauth=belabox

Statistics-URL: http://your-public-container-ip:8181/stats?publisher=live/stream/belabox?srtauth=belabox

Legacy Statistics-URL: http://your-public-container-ip:3000/stats?streamer=belabox&key=belabox
16 changes: 8 additions & 8 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"auth": [
{
"user": "belabox",
"key": "belabox"
}
]
}
{
"auth": [
{
"user": "belabox",
"key": "belabox"
}
]
}
44 changes: 22 additions & 22 deletions files/logprefix
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/usr/bin/env bash

### prefix-log script #####################################################
# This script prefixes all output lines with the $SUPERVISOR_PROCESS_NAME
# It is borrowed from https://serverfault.com/a/946271
###########################################################################

# setup fd-3 to point to the original stdout
exec 3>&1
# setup fd-4 to point to the original stderr
exec 4>&2

# get the prefix from SUPERVISOR_PROCESS_NAME environement variable
printf -v PREFIX "%-25.25s" ${SUPERVISOR_PROCESS_NAME}

# reassign stdout and stderr to a preprocessed and redirected to the original stdout/stderr (3 and 4) we have create eralier
exec 1> >(perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&3)
exec 2> >(perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&4)

# from here on everthing that outputs to stdout/stderr will be go through the perl script

exec "$@"
#!/usr/bin/env bash

### prefix-log script #####################################################
# This script prefixes all output lines with the $SUPERVISOR_PROCESS_NAME
# It is borrowed from https://serverfault.com/a/946271
###########################################################################

# setup fd-3 to point to the original stdout
exec 3>&1
# setup fd-4 to point to the original stderr
exec 4>&2

# get the prefix from SUPERVISOR_PROCESS_NAME environement variable
printf -v PREFIX "%-25.25s" ${SUPERVISOR_PROCESS_NAME}

# reassign stdout and stderr to a preprocessed and redirected to the original stdout/stderr (3 and 4) we have create eralier
exec 1> >(perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&3)
exec 2> >(perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&4)

# from here on everthing that outputs to stdout/stderr will be go through the perl script

exec "$@"
114 changes: 57 additions & 57 deletions files/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
[supervisord]
logfile=/var/log/supervisord.log
logfile_maxbytes=10MB
logfile_backups=3
loglevel=error
pidfile=/var/run/supervisord.pid
nodaemon=true
minfds=1024
minprocs=200
user=root
childlogdir=/var/log/
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:sls-live-server]
priority=50
autostart=true
autorestart=unexpected
redirect_stderr=true
user=root
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/local/bin/srt_server -c /etc/sls/sls.conf
[program:srtla_rec]
priority=150
autostart=true
autorestart=unexpected
redirect_stderr=true
user=nobody
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/bin/sh -c "sleep 3 && /usr/local/bin/srtla_rec --srtla_port=5000 --srt_hostname=localhost --srt_port=8282 --verbose"
[program:server]
priority=200
autostart=true
autorestart=unexpected
redirect_stderr=true
user=root
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
directory=/app
command=npm start
[supervisord]
logfile=/var/log/supervisord.log
logfile_maxbytes=10MB
logfile_backups=3
loglevel=error
pidfile=/var/run/supervisord.pid
nodaemon=true
minfds=1024
minprocs=200
user=root
childlogdir=/var/log/

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[program:sls-live-server]
priority=50
autostart=true
autorestart=unexpected
redirect_stderr=true
user=root
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/local/bin/srt_server -c /etc/sls/sls.conf

[program:srtla_rec]
priority=150
autostart=true
autorestart=unexpected
redirect_stderr=true
user=nobody
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/bin/sh -c "sleep 3 && /usr/local/bin/srtla_rec --srtla_port=5000 --srt_hostname=localhost --srt_port=8282 --verbose"

[program:server]
priority=200
autostart=true
autorestart=unexpected
redirect_stderr=true
user=root
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
directory=/app
command=npm start
46 changes: 23 additions & 23 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/bin/bash

[ ! -f $PWD/config.json ] && echo "config.json missing! (see config.json.example)" && exit 1

docker build . -t belabox-receiver
docker run --rm -it --name belabox-receiver \
-p 5000:5000/udp \
-p 8181:8181/tcp \
-p 8282:8282/udp \
-p 3000:3000/tcp \
-v $PWD/config.json:/app/config.json belabox-receiver

# SLS stats page:
# http://localhost:8181/stats
#
# Belabox
# host: <ip>
# port: 5000
# stream-id: live/stream/belabox
#
# OBS MediaSource:
# srt://<ip>:8282/?streamid=play/stream/belabox
#
#!/bin/bash

[ ! -f $PWD/config.json ] && echo "config.json missing! (see config.json.example)" && exit 1

docker build . -t belabox-receiver
docker run --rm -it --name belabox-receiver \
-p 5000:5000/udp \
-p 8181:8181/tcp \
-p 8282:8282/udp \
-p 3000:3000/tcp \
-v $PWD/config.json:/app/config.json belabox-receiver

# SLS stats page:
# http://localhost:8181/stats
#
# Belabox
# host: <ip>
# port: 5000
# stream-id: live/stream/belabox
#
# OBS MediaSource:
# srt://<ip>:8282/?streamid=play/stream/belabox
#
Loading

0 comments on commit 27ce9b4

Please sign in to comment.