Skip to content

Create a livesim2 server on Linode

Torbjörn Einarson edited this page Apr 9, 2024 · 6 revisions

Since livesim2 comes with some small piece of test content, it is very easy to set up your own server. We first list all the manual steps, but one can also run a Linode script listed further below

Manually with livesim-content

apt update
apt install -y build-essential

snap install --classic go


# Clone livesim2 repo
cd /root
git clone https://github.com/Dash-Industry-Forum/livesim2
  
# Build livesim2 app
cd livesim2
go mod tidy
make build

# Download livesim-content and unpack it

cd /root
apt install git-lfs
git clone https://github.com/Dash-Industry-Forum/livesim-content
cd livesim-content
apt install unzip
./unpack_all.sh

# Start livesim2 server (interactive) with HTTPS to your automatic Linode domain (based on IP address) via Let's Encrypt
cd ../livesim2
./out/livesim2 --vodroot ../livesim-content --domains=192-46-234-23.ip.linodeusercontent.com

To make a service, create a systemd service as below in the Linode stack script. Some useful options are: --maxrequests=1000 --logformat=json where the first one limits the number of requests for every IP address per 24h.

Using stackscript

One particular example is the following Linode stack script by Peter Chave who sets up a livesim2 service:

https://cloud.linode.com/stackscripts/1189972

Note, the required Go version is now 1.21 (has been changed below)!

#!/bin/bash

  
# Install build tools
apt update
apt install -y build-essential
  
# Install GO
cd /root
wget https://go.dev/dl/go1.21-3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
  
# Clone livesim2 repo
git clone https://github.com/Dash-Industry-Forum/livesim2
  
# Build livesim2 app
cd livesim2
go mod tidy
make build
  
# Create systemd service
cat > /etc/systemd/system/livesim2.service << "EOF"
[Unit]
Description=Livesim2 Service
Wants=network-online.target
After=network-online.target
  
[Service]
Restart=always
RestartSec=30s
ExecStart=/root/livesim2/out/livesim2 --vodroot=/root/livesim2/cmd/livesim2/app/testdata/assets
  
[Install]
WantedBy=multi-user.target
EOF
  
# Start livesim2 at boot and now...
systemctl enable livesim2
systemctl start livesim2

One could also add more content by downloading content to an appropriate folder before the service is started and change the --vodroot parameter to point to that folder.