From c9ba881ab21d5e601dbd913c339c8f04ca52191d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 27 Nov 2024 05:10:42 +0100 Subject: [PATCH] Add scripts for installing a `terraria` server --- lib/modules/programs/docker.nix | 1 + profiles/machines/manuel/server.nix | 1 + .../services/terraria/docker-compose.base.yml | 8 +++++++ .../terraria/docker-compose.overrides.yml | 8 +++++++ .../docker/services/terraria/main.fish | 24 +++++++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 scripts/Common/Software/docker/services/terraria/docker-compose.base.yml create mode 100644 scripts/Common/Software/docker/services/terraria/docker-compose.overrides.yml create mode 100755 scripts/Common/Software/docker/services/terraria/main.fish diff --git a/lib/modules/programs/docker.nix b/lib/modules/programs/docker.nix index 59d1e418..4f4ed787 100644 --- a/lib/modules/programs/docker.nix +++ b/lib/modules/programs/docker.nix @@ -30,6 +30,7 @@ in { minecraft.enable = mkEnableOption "Minecraft server"; nextcloud.enable = mkEnableOption "Nextcloud server"; teamspeak.enable = mkEnableOption "TeamSpeak server"; + terraria.enable = mkEnableOption "Terraria server"; trackmania.enable = mkEnableOption "TrackMania server"; vaultwarden.enable = mkEnableOption "Vaultwarden server"; woodpecker.enable = mkEnableOption "Woodpecker CI server"; diff --git a/profiles/machines/manuel/server.nix b/profiles/machines/manuel/server.nix index 52601503..83fc3f67 100644 --- a/profiles/machines/manuel/server.nix +++ b/profiles/machines/manuel/server.nix @@ -62,6 +62,7 @@ in { minecraft.enable = true; nextcloud.enable = true; teamspeak.enable = true; + terraria.enable = true; trackmania.enable = true; vaultwarden.enable = true; woodpecker.enable = true; diff --git a/scripts/Common/Software/docker/services/terraria/docker-compose.base.yml b/scripts/Common/Software/docker/services/terraria/docker-compose.base.yml new file mode 100644 index 00000000..8d6d70f0 --- /dev/null +++ b/scripts/Common/Software/docker/services/terraria/docker-compose.base.yml @@ -0,0 +1,8 @@ +services: + terraria: + image: ryshe/terraria:latest + restart: unless-stopped + tty: true + stdin_open: true + volumes: + - ./data:/root/.local/share/Terraria/Worlds diff --git a/scripts/Common/Software/docker/services/terraria/docker-compose.overrides.yml b/scripts/Common/Software/docker/services/terraria/docker-compose.overrides.yml new file mode 100644 index 00000000..04c2168f --- /dev/null +++ b/scripts/Common/Software/docker/services/terraria/docker-compose.overrides.yml @@ -0,0 +1,8 @@ +services: + terraria: + environment: {} + command: + -autocreate 1 + -difficulty 1 + -seed "AwesomeSeed" + -lang "en-US" diff --git a/scripts/Common/Software/docker/services/terraria/main.fish b/scripts/Common/Software/docker/services/terraria/main.fish new file mode 100755 index 00000000..9f866993 --- /dev/null +++ b/scripts/Common/Software/docker/services/terraria/main.fish @@ -0,0 +1,24 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../service.fish" + + function installSW -V dir + set -l root (getServiceRoot $argv) + initializeServiceInstallation $argv + cp -rf "$dir"/docker-compose{.base,.overrides}.yml "$root" + installDockerService $argv + end + + function configureSW -V dir + configureDockerService $argv + end + + function getServiceServers + end + + function getServiceLocations + end + + runInstaller --force $argv +end