feat(homelab): add old server
This commit is contained in:
@@ -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>, 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(())
|
||||
|
||||
@@ -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<T: Display>(&self, text: T) {
|
||||
self.spinner.suspend(|| println!("{}", text))
|
||||
}
|
||||
|
||||
pub fn success(&self, msg: &str) {
|
||||
self.spinner.finish_with_message(format!("✓ {}", msg));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
29
nix/homelab/helm/values/minecraft/old.yaml
Normal file
29
nix/homelab/helm/values/minecraft/old.yaml
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user