From d086bb61ed1e2d2df0b2f68965e974d7b39071a9 Mon Sep 17 00:00:00 2001 From: lucalise Date: Sun, 25 Jan 2026 00:13:23 -0800 Subject: [PATCH] feat(homelab): add old server --- nix/homelab/cli/src/commands/minecraft.rs | 6 ++-- nix/homelab/cli/src/reporter.rs | 18 +++++++++--- nix/homelab/helm/helmfile.yaml | 7 +++++ nix/homelab/helm/values/minecraft/old.yaml | 29 +++++++++++++++++++ nix/homelab/helm/values/minecraft/router.yaml | 3 ++ 5 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 nix/homelab/helm/values/minecraft/old.yaml diff --git a/nix/homelab/cli/src/commands/minecraft.rs b/nix/homelab/cli/src/commands/minecraft.rs index a0d62e2..cc3ed58 100644 --- a/nix/homelab/cli/src/commands/minecraft.rs +++ b/nix/homelab/cli/src/commands/minecraft.rs @@ -48,7 +48,7 @@ pub async fn backup_world(state: State, world: &str) -> Result<()> { let reporter = Reporter::new(); let job_name = format!("minecraft-{}-backup", world); - reporter.status(format!("Scaling deployment minecraft-{world}")); + reporter.log(format!("Scaling deployment minecraft-{world}")); scale_deployment(&state.client, NAMESPACE, &format!("minecraft-{world}"), 0).await?; reporter.status("Creating backup job..."); @@ -71,7 +71,7 @@ pub async fn backup_world(state: State, world: &str) -> Result<()> { let succeeded = status.and_then(|s| s.succeeded).unwrap_or(0); let failed = status.and_then(|s| s.failed).unwrap_or(0); - reporter.status(format!("Scaling deployment minecraft-{world}, replicas: 1")); + reporter.log(format!("Scaling deployment minecraft-{world}, replicas: 1")); scale_deployment(&state.client, NAMESPACE, &format!("minecraft-{world}"), 1).await?; if succeeded > 0 { reporter.success("Backup complete"); @@ -137,7 +137,7 @@ async fn stream_pod_logs(pods: &Api, pod_name: &str, reporter: &Reporter) - let mut lines = stream.lines(); while let Some(line) = lines.try_next().await? { - reporter.log(&line); + reporter.log_event(&line); } Ok(()) diff --git a/nix/homelab/cli/src/reporter.rs b/nix/homelab/cli/src/reporter.rs index c93122c..ef3d10b 100644 --- a/nix/homelab/cli/src/reporter.rs +++ b/nix/homelab/cli/src/reporter.rs @@ -1,16 +1,22 @@ +use std::fmt::Display; + use indicatif::{ProgressBar, ProgressStyle}; pub struct Reporter { spinner: ProgressBar, } +pub const TICK_CHARS: &str = "⣷⣯⣟⡿⢿⣻⣽⣾"; + impl Reporter { pub fn new() -> Self { let spinner = ProgressBar::new_spinner(); spinner.set_style( - ProgressStyle::default_spinner() - .template("{spinner:.cyan} {msg}") - .unwrap(), + ProgressStyle::with_template( + "{prefix:.dim}{msg:>8.214/yellow} {spinner} [{elapsed_precise}]", + ) + .unwrap() + .tick_chars(TICK_CHARS), ); spinner.enable_steady_tick(std::time::Duration::from_millis(100)); Self { spinner } @@ -20,12 +26,16 @@ impl Reporter { self.spinner.set_message(msg.into()); } - pub fn log(&self, line: &str) { + pub fn log_event(&self, line: &str) { self.spinner.suspend(|| { println!(" │ {}", line); }); } + pub fn log(&self, text: T) { + self.spinner.suspend(|| println!("{}", text)) + } + pub fn success(&self, msg: &str) { self.spinner.finish_with_message(format!("✓ {}", msg)); } diff --git a/nix/homelab/helm/helmfile.yaml b/nix/homelab/helm/helmfile.yaml index 2113de0..b4c40b1 100644 --- a/nix/homelab/helm/helmfile.yaml +++ b/nix/homelab/helm/helmfile.yaml @@ -95,6 +95,13 @@ releases: values: - values/minecraft/creative.yaml + - name: minecraft-old + namespace: minecraft + chart: minecraft-charts/minecraft + version: 5.0.0 + values: + - values/minecraft/old.yaml + - name: home-assistant namespace: home chart: home-assistant/home-assistant diff --git a/nix/homelab/helm/values/minecraft/old.yaml b/nix/homelab/helm/values/minecraft/old.yaml new file mode 100644 index 0000000..f5e34a3 --- /dev/null +++ b/nix/homelab/helm/values/minecraft/old.yaml @@ -0,0 +1,29 @@ +resources: + requests: + cpu: 500m + memory: 512Mi + limits: + memory: 2Gi + cpu: 1 + +minecraftServer: + eula: "TRUE" + type: "VANILLA" + version: "1.7.10" + difficulty: hard + motd: "A Minecraft Server." + memory: 4G + rcon: + enabled: true + withGeneratedPassword: false + port: 25575 + existingSecret: rcon-credentials + secretKey: rcon-password + +nodeSelector: + kubernetes.io/hostname: rufus + +persistence: + dataDir: + enabled: true + Size: 2Gi diff --git a/nix/homelab/helm/values/minecraft/router.yaml b/nix/homelab/helm/values/minecraft/router.yaml index b315a8f..abf8222 100644 --- a/nix/homelab/helm/values/minecraft/router.yaml +++ b/nix/homelab/helm/values/minecraft/router.yaml @@ -14,3 +14,6 @@ minecraftRouter: - externalHostname: "mc-rocket-creative.duckdns.org" host: "minecraft-creative" port: 25565 + - externalHostname: "mc-rocket-old.privatedns.org" + host: "minecraft-old" + port: 25565