Add scripts for installing TeamSpeak

This commit is contained in:
Manuel Thalmann 2024-11-13 18:18:15 +01:00
parent 179da24cd1
commit ddef21cf08
3 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,19 @@
services:
teamspeak:
image: teamspeak
restart: unless-stopped
depends_on:
- db
environment:
TS3SERVER_DB_PLUGIN: ts3db_mariadb
TS3SERVER_DB_SQLCREATEPATH: create_mariadb
TS3SERVER_DB_HOST: db
TS3SERVER_DB_WAITUNTILREADY: 30
TS3SERVER_LICENSE: accept
db:
image: mariadb
restart: unless-stopped
environment:
MARIADB_RANDOM_ROOT_PASSWORD: "yes"
volumes:
- ./database:/var/lib/mysql

View file

@ -0,0 +1,6 @@
services:
teamspeak:
ports:
- 9987:9987/udp
- 10011:10011
- 30033:30033

View file

@ -0,0 +1,49 @@
#!/bin/env fish
begin
set -l dir (status dirname)
set -l source "$dir/docker-compose.secrets.yml"
source "$dir/../service.fish"
function installSW -V dir -V domain -V source
set -l service "teamspeak"
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l db "TeamSpeak"
set -l tsEnv "$(getServiceKey "$service").environment"
set -l dbEnv "$(getServiceKey db).environment"
initializeServiceInstallation $argv
cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
USER="$service" begin
yq "$tsEnv.TS3SERVER_DB_USER = env.USER" "$source" | \
yq "$dbEnv.MARIADB_USER = env.USER"
end | \
PW="$pw" begin
yq "$tsEnv.TS3SERVER_DB_PASSWORD = env.PW" | \
yq "$dbEnv.MARIADB_PASSWORD = env.PW"
end | \
DB="$db" begin
yq "$tsEnv.TS3SERVER_DB_NAME = env.DB" | \
yq "$dbEnv.MARIADB_DATABASE = env.DB"
end | \
yq . | \
sudo tee (getServiceSecretsConfig $argv) >/dev/null
installDockerService $argv
end
function configureSW -V dir
configureDockerService $argv
end
function getServiceServers -V server
end
function getServiceLocations
end
function getBackupArgs
printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" (getServiceRoot $argv)
end
runInstaller --force $argv
end