diff --git a/scripts/Common/Software/docker/services/teamspeak/docker-compose.base.yml b/scripts/Common/Software/docker/services/teamspeak/docker-compose.base.yml new file mode 100644 index 00000000..c3b47c59 --- /dev/null +++ b/scripts/Common/Software/docker/services/teamspeak/docker-compose.base.yml @@ -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 diff --git a/scripts/Common/Software/docker/services/teamspeak/docker-compose.secrets.yml b/scripts/Common/Software/docker/services/teamspeak/docker-compose.secrets.yml new file mode 100644 index 00000000..5c7deae1 --- /dev/null +++ b/scripts/Common/Software/docker/services/teamspeak/docker-compose.secrets.yml @@ -0,0 +1,6 @@ +services: + teamspeak: + ports: + - 9987:9987/udp + - 10011:10011 + - 30033:30033 diff --git a/scripts/Common/Software/docker/services/teamspeak/main.fish b/scripts/Common/Software/docker/services/teamspeak/main.fish new file mode 100644 index 00000000..13242b6e --- /dev/null +++ b/scripts/Common/Software/docker/services/teamspeak/main.fish @@ -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 -V root + printf "%s\n" --hidden --no-ignore . --exclude "docker-compose.yml" "$root" + end + + runInstaller --force $argv +end