Skip to content

Worker Setup

Joscha Henningsen edited this page May 12, 2021 · 1 revision

Setting up a new Worker

This guide assumes your workdir is /home/joscha

Install required dependencies on your System

apt update
sudo apt install git make wget
wget https://golang.org/dl/go1.16.4.linux-amd64.tar.gz # check if there is a newer version of go here: https://golang.org/doc/install
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz
echo 'PATH="$PATH:/usr/local/go/bin"' >> .profile

Then log back in to your vm

Create a folder for recordings and logs

mkdir -p /recordings/vod
chmod 777 /recordings/vod
mkdir /var/log/live-worker

Get and install the worker

git clone https://github.com/joschahenningsen/TUM-Live-Worker.git
cd TUM-Live-Worker
make all
sudo make install

Get ssl certificates

Use rbg-cert, Let’s Encrypt or whatever else floats your boat.

Edit environment variables:

Create the file /home/joscha/worker.env

LRZ_USER=Joscha Henningsen
[email protected]
LRZ_PHONE=0158123456
LRZ_SUBDIR=RBG
LRZ_UPLOAD_URL=https://uploadPortal.lrz.de/video_upload.cgi 
CERT=/var/lib/rbg-cert/live/my.fullchain.pem
KEY=/var/lib/rbg-cert/live/my.privkey.pem
WORKERID=t9gjgersv98e5mjhtz95ezsjz89nh
MAIN_BASE=https://live.mm.rbg.tum.de
INGEST_BASE=rtmp://user:[email protected]:1935/livetum/

Create a system service

Edit the file /etc/systemd/system/live-worker.service

[Unit]
Description=TUM-Live-Worker
After=network.target

[Service]
EnvironmentFile=/home/joscha/TUM-Live-Worker/worker.env
Type=simple
ExecStart=/bin/liveworker
TimeoutStopSec=5
KillMode=mixed
Restart=on-failure
StandardOutput=append:/var/log/live-worker/logs.log
StandardError=append:/var/log/live-worker/error.log

[Install]
WantedBy=multi-user.target

Start the worker

sudo systemctl daemon-reload
sudo systemctl enable live-worker.service
sudo systemctl start live-worker.service