Splamy / TS3AudioBot

Advanced Musicbot for Teamspeak 3
https://splamy.de/TSAudioBot/Home
Open Software License 3.0
682 stars 138 forks source link

TS3AudioBot on raspberry #1029

Open DAIIIIIIIIIIIIII opened 1 year ago

DAIIIIIIIIIIIIII commented 1 year ago

hello, i wanted to download the bot to my raspberry pi 4, but i am not sure if i can do it. i have installed raspberry pi os lite, but i am uncertain about the type of processor the raspberry mounts (armv7 - armv8)

Snogard commented 1 year ago

I'm running mine on a docker container, i used the arm64 build

paradox-sp commented 1 year ago

I'm running mine on a docker container, i used the arm64 build

can you please share docker compose or docker image The one you have given in the repo doent work

Snogard commented 1 year ago

I use podman to build and run the container, i did try to use alpine but i don't remember the issues i was having so arch it is.

first, dowload the nightly build from here -> https://splamy.de/nightly
then make a folder with those files, and while inside that folder, launch build.sh.

when the build is completed run install.sh

Hope it helps!

tree:

.
├── build.sh
├── install.sh
├── Dockerfile
├── src
│   └── entrypoint.sh
├── ts3audiobot-amd64.tar.gz
└── ts3audiobot-arm64.tar.gz

build.sh:

#!/bin/bash
dockerfile=Dockerfile
tag=ts3audiobot:0.13.0-alpha.41

chmod +x -R src/*

mkdir -p ts3audiobot

file=ts3audiobot-amd64.tar.gz

if [ $(uname -m) == "aarch64" ]; then
    file=ts3audiobot-arm64.tar.gz
else
    file=ts3audiobot-amd64.tar.gz
fi

cp $file ./ts3audiobot/ts3audiobot.tar.gz

cd ts3audiobot
tar xf ts3audiobot.tar.gz
rm ts3audiobot.tar.gz
cd ..

podman pull docker.io/lopsided/archlinux
podman build -f ./$dockerfile -t $tag

Dockerfile:

FROM docker.io/lopsided/archlinux

RUN pacman -Sy --noconfirm icu opus yt-dlp ffmpeg
RUN ln -s /usr/bin/yt-dlp /usr/bin/youtube-dl

RUN mkdir /bot
RUN mkdir /config
RUN mkdir /logs

COPY ts3audiobot /bot

RUN ln -s /logs /bot/logs

ADD src /src
RUN ls /src

ENTRYPOINT "/src/entrypoint.sh"

entrypoint.sh:

#!/bin/bash

fileArray=("bots" "Nlog.config" "rights.toml" "ts3audiobot.db" "ts3audiobot.toml" )

for file in ${fileArray[@]}; do
    src=/bot/$file
    dst=/config/$file

    if [ -e $dst ]; then
        if [ ! -L $src ]; then
            ln -s $dst $src
            echo "Creating symklink $src -> $dst"
        fi
    elif [ -e $src ]; then 
        if [ ! -L $src ]; then
            mv $src $dst
            echo "Moving $src to $dst"
            ln -s $dst $src
            echo "Creating symlink $src $dst"
        else
            rm $src
            echo "Removing broken link $src"
        fi
    fi
done

cd /bot
/bot/TS3AudioBot

install.sh

#!/bin/bash

containerName=ts3audiobot
imageName=localhost/ts3audiobot:0.13.0-alpha.41

dstConfigPath=/mnt/storage/containers/$containerName/config
dstLogsPath=/mnt/storage/containers/$containerName/logs

if [ ! -d  "${dstConfigPath}" ]; then
    echo "Creating folder path at ${dstConfigPath}"
    mkdir -p $dstConfigPath
fi

if [ ! -d  "${dstLogsPath}" ]; then
    echo "Creating folder path at ${dstLogsPath}"
    mkdir -p $dstLogsPath
fi

if podman ps --all | grep -qi ${containerName}; then
    podman stop $containerName
    podman rm $containerName
fi

if [ ! -f $dstConfigPath/rights.toml ] || [ ! -f $dstConfigPath/ts3audiobot.toml ]; then
    echo "The admin uid is the user id that will have admin powers over the bot"
    podman run -it \
        --name $containerName \
        -v $dstConfigPath:/config \
        -v $dstLogsPath:/logs \
        -p 58913:58913/tcp \
        $imageName
else
    podman create \
        --name $containerName \
        -v $dstConfigPath:/config \
        -v $dstLogsPath:/logs \
        -p 58913:58913/tcp \
        $imageName
fi