From a93d3e05fa158f854118f3053f5cad474d9996d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20M=C3=BCller?= Date: Tue, 4 Feb 2025 00:09:46 +0100 Subject: [PATCH] test(minecraft): try to restore lobby in paper --- .../apps/gaming/minecraft-java/flux-sync.yaml | 22 +++ .../minecraft-java/lobby-world-paper/TODO.md | 4 + .../config/paper-global.yaml | 137 ++++++++++++++++ .../lobby-world-paper/config/spigot.yaml | 152 ++++++++++++++++++ .../lobby-world-paper/helm-release.yaml | 92 +++++++++++ .../lobby-world-paper/kustomization.yaml | 22 +++ .../persistent-volume-claim.yaml | 18 +++ .../replication-destination.yaml | 31 ++++ .../lobby-world-paper/replication-source.yaml | 31 ++++ .../lobby-world-paper/secret.sops.yaml | 31 ++++ 10 files changed, 540 insertions(+) create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/TODO.md create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/paper-global.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/spigot.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/helm-release.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/kustomization.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/persistent-volume-claim.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-destination.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-source.yaml create mode 100644 kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/secret.sops.yaml diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/flux-sync.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/flux-sync.yaml index ffffb4708..9e83019aa 100644 --- a/kubernetes/talos-flux/apps/gaming/minecraft-java/flux-sync.yaml +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/flux-sync.yaml @@ -63,6 +63,28 @@ spec: wait: true targetNamespace: gaming +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: minecraft-lobby-world2 + namespace: flux-system + labels: + substitution.flux.home.arpa/enabled: "true" +spec: + dependsOn: + - name: apps-volsync + - name: apps-rook-ceph-cluster + interval: 10m + path: ./kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper + prune: true + sourceRef: + kind: GitRepository + name: home-ops + wait: true + targetNamespace: gaming + --- # yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json apiVersion: kustomize.toolkit.fluxcd.io/v1 diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/TODO.md b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/TODO.md new file mode 100644 index 000000000..e43fbb5d2 --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/TODO.md @@ -0,0 +1,4 @@ +# TODO + +- [ ] setup backup +- [ ] test backup diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/paper-global.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/paper-global.yaml new file mode 100644 index 000000000..ef64d23bf --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/paper-global.yaml @@ -0,0 +1,137 @@ +--- +# This is the global configuration file for Paper. +# As you can see, there's a lot to configure. Some options may impact gameplay, so use +# with caution, and make sure you know what each option does before configuring. +# +# If you need help with the configuration or have any questions related to Paper, +# join us in our Discord or check the docs page. +# +# The world configuration options have been moved inside +# their respective world folder. The files are named paper-world.yml +# +# Docs: https://docs.papermc.io/ +# Discord: https://discord.gg/papermc +# Website: https://papermc.io/ + +_version: 29 +block-updates: + disable-chorus-plant-updates: false + disable-mushroom-block-updates: false + disable-noteblock-updates: false + disable-tripwire-updates: false +chunk-loading-advanced: + auto-config-send-distance: true + player-max-concurrent-chunk-generates: 0 + player-max-concurrent-chunk-loads: 0 +chunk-loading-basic: + player-max-chunk-generate-rate: -1.0 + player-max-chunk-load-rate: 100.0 + player-max-chunk-send-rate: 75.0 +chunk-system: + gen-parallelism: default + io-threads: -1 + worker-threads: -1 +collisions: + enable-player-collisions: true + send-full-pos-for-hard-colliding-entities: true +commands: + fix-target-selector-tag-completion: true + suggest-player-names-when-null-tab-completions: true + time-command-affects-all-worlds: false +console: + enable-brigadier-completions: true + enable-brigadier-highlighting: true + has-all-permissions: false +item-validation: + book: + author: 8192 + page: 16384 + title: 8192 + book-size: + page-max: 2560 + total-multiplier: 0.98 + display-name: 8192 + lore-line: 8192 + resolve-selectors-in-books: false +logging: + deobfuscate-stacktraces: true +messages: + kick: + authentication-servers-down: + connection-throttle: Connection throttled! Please wait before reconnecting. + flying-player: + flying-vehicle: + no-permission: + I'm sorry, but you do not have permission to perform this command. + Please contact the server administrators if you believe that this is in error. + use-display-name-in-quit-message: false +misc: + chat-threads: + chat-executor-core-size: -1 + chat-executor-max-size: -1 + client-interaction-leniency-distance: default + compression-level: default + fix-entity-position-desync: true + load-permissions-yml-before-plugins: true + max-joins-per-tick: 5 + region-file-cache-size: 256 + strict-advancement-dimension-check: false + use-alternative-luck-formula: false + use-dimension-type-for-custom-spawners: false +packet-limiter: + all-packets: + action: KICK + interval: 7.0 + max-packet-rate: 500.0 + kick-message: + overrides: + ServerboundPlaceRecipePacket: + action: DROP + interval: 4.0 + max-packet-rate: 5.0 +player-auto-save: + max-per-tick: -1 + rate: -1 +proxies: + bungee-cord: + online-mode: true + proxy-protocol: false + velocity: + enabled: true + online-mode: true + secret: "TEST" +scoreboards: + save-empty-scoreboard-teams: true + track-plugin-scoreboards: false +spam-limiter: + incoming-packet-threshold: 300 + recipe-spam-increment: 1 + recipe-spam-limit: 20 + tab-spam-increment: 1 + tab-spam-limit: 500 +spark: + enable-immediately: false + enabled: true +timings: + enabled: false + hidden-config-entries: + - database + - proxies.velocity.secret + history-interval: 300 + history-length: 3600 + server-name: Unknown Server + server-name-privacy: false + url: https://timings.aikar.co/ + verbose: true +unsupported-settings: + allow-headless-pistons: false + allow-permanent-block-break-exploits: false + allow-piston-duplication: false + allow-tripwire-disarming-exploits: false + allow-unsafe-end-portal-teleportation: false + compression-format: ZLIB + perform-username-validation: true + skip-vanilla-damage-tick-when-shield-blocked: false +watchdog: + early-warning-delay: 10000 + early-warning-every: 5000 diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/spigot.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/spigot.yaml new file mode 100644 index 000000000..e93fcd46b --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/config/spigot.yaml @@ -0,0 +1,152 @@ +--- +# This is the main configuration file for Spigot. +# As you can see, there's tons to configure. Some options may impact gameplay, so use +# with caution, and make sure you know what each option does before configuring. +# For a reference for any variable inside this file, check out the Spigot wiki at +# http://www.spigotmc.org/wiki/spigot-configuration/ +# +# If you need help with the configuration or have any questions related to Spigot, +# join us at the Discord or drop by our forums and leave a post. +# +# Discord: https://www.spigotmc.org/go/discord +# Forums: http://www.spigotmc.org/ + +messages: + whitelist: You are not whitelisted on this server! + unknown-command: Unknown command. Type "/help" for help. + server-full: The server is full! + outdated-client: Outdated client! Please use {0} + outdated-server: Outdated server! I'm still on {0} + restart: Server is restarting +world-settings: + default: + below-zero-generation-in-existing-chunks: true + verbose: true + growth: + cactus-modifier: 100 + cane-modifier: 100 + melon-modifier: 100 + mushroom-modifier: 100 + pumpkin-modifier: 100 + sapling-modifier: 100 + beetroot-modifier: 100 + carrot-modifier: 100 + potato-modifier: 100 + wheat-modifier: 100 + netherwart-modifier: 100 + vine-modifier: 100 + cocoa-modifier: 100 + bamboo-modifier: 100 + sweetberry-modifier: 100 + kelp-modifier: 100 + twistingvines-modifier: 100 + weepingvines-modifier: 100 + cavevines-modifier: 100 + ticks-per: + hopper-transfer: 8 + hopper-check: 1 + hopper-amount: 1 + hopper-can-load-chunks: false + unload-frozen-chunks: false + merge-radius: + exp: 3.0 + item: 2.5 + mob-spawn-range: 6 + entity-activation-range: + animals: 32 + monsters: 32 + raiders: 48 + misc: 16 + tick-inactive-villagers: true + ignore-spectators: false + entity-tracking-range: + players: 48 + animals: 48 + monsters: 48 + misc: 32 + display: 128 + other: 64 + dragon-death-sound-radius: 0 + seed-village: 10387312 + seed-desert: 14357617 + seed-igloo: 14357618 + seed-jungle: 14357619 + seed-swamp: 14357620 + seed-monument: 10387313 + seed-shipwreck: 165745295 + seed-ocean: 14357621 + seed-outpost: 165745296 + seed-endcity: 10387313 + seed-slime: 987234911 + seed-nether: 30084232 + seed-mansion: 10387319 + seed-fossil: 14357921 + seed-portal: 34222645 + hunger: + jump-walk-exhaustion: 0.05 + jump-sprint-exhaustion: 0.2 + combat-exhaustion: 0.1 + regen-exhaustion: 6.0 + swim-multiplier: 0.01 + sprint-multiplier: 0.1 + other-multiplier: 0.0 + max-tnt-per-tick: 100 + max-tick-time: + tile: 50 + entity: 50 + view-distance: default + simulation-distance: default + thunder-chance: 100000 + item-despawn-rate: 6000 + enable-zombie-pigmen-portal-spawns: true + arrow-despawn-rate: 1200 + trident-despawn-rate: 1200 + wither-spawn-sound-radius: 0 + end-portal-sound-radius: 0 + hanging-tick-frequency: 100 + zombie-aggressive-towards-villager: true + nerf-spawner-mobs: false +commands: + log: true + tab-complete: 0 + send-namespaced: true + spam-exclusions: + - /skill + silent-commandblock-console: false + replace-commands: + - setblock + - summon + - testforblock + - tellraw +settings: + bungeecord: true + sample-count: 12 + player-shuffle: 0 + user-cache-size: 1000 + save-user-cache-on-stop-only: false + moved-wrongly-threshold: 0.0625 + moved-too-quickly-multiplier: 10.0 + timeout-time: 60 + restart-on-crash: true + restart-script: ./start.sh + netty-threads: 4 + attribute: + maxHealth: + max: 2048.0 + movementSpeed: + max: 2048.0 + attackDamage: + max: 2048.0 + log-villager-deaths: true + log-named-deaths: true + debug: false +advancements: + disable-saving: false + disabled: + - minecraft:story/disabled +players: + disable-saving: false +config-version: 12 +stats: + disable-saving: false + forced-stats: {} diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/helm-release.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/helm-release.yaml new file mode 100644 index 000000000..39acd4dab --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/helm-release.yaml @@ -0,0 +1,92 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/helm.toolkit.fluxcd.io/helmrelease_v2.json +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: minecraft-lobby-world2 +spec: + interval: 15m + driftDetection: + mode: enabled + chart: + spec: + chart: minecraft + interval: 15m + version: 4.23.7 + sourceRef: + kind: HelmRepository + name: minecraft-server-charts + namespace: flux-system + install: + createNamespace: true + remediation: + retries: 3 + upgrade: + remediation: + retries: 3 + values: + image: + repository: ghcr.io/itzg/minecraft-server + tag: latest@sha256:9fcc91f052c47c5da7ae280b7cd1603ee7d657867c19fe4d6b5260edfd72db30 + resources: + requests: + cpu: 100m + memory: 1024Mi + minecraftServer: + eula: "TRUE" + version: "1.21.4" + type: PAPER + motd: techtales lobby + difficulty: peaceful + ops: "tyriis,jazzlyin,ForscherAlex,ForscherDominik" + worldSaveName: lobby + enableCommandBlock: true + maxPlayers: 25 + spawnAnimals: false + spawnNPCs: false + spawnProtection: 0 + spawnMonsters: false + allowNether: false + generateStructures: false + viewDistance: 14 + levelType: FLAT + # maxBuildHeight: 256 + gameMode: creative + pvp: false + onlineMode: false + memory: 1024M + rcon: + enabled: true + existingSecret: bungeecord-rcon + secretKey: RCON_PASSWORD + serviceType: ClusterIP + persistence: + dataDir: + enabled: true + existingClaim: minecraft-lobby-world-data2 + + postRenderers: + - kustomize: + patches: + - target: + kind: Deployment + name: minecraft-lobby-world-minecraft2 + patch: |- + - op: add + path: /spec/template/spec/volumes/- + value: + name: config + configMap: + name: minecraft-lobby-world-config2 + - op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: config + mountPath: /data/spigot.yml + subPath: spigot.yml + - op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: config + mountPath: /config/paper-global.yml + subPath: paper-global.yml diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/kustomization.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/kustomization.yaml new file mode 100644 index 000000000..af523ed49 --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/kustomization.yaml @@ -0,0 +1,22 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - secret.sops.yaml + - replication-destination.yaml + - persistent-volume-claim.yaml + # - replication-source.yaml + - helm-release.yaml +commonLabels: + app.kubernetes.io/name: minecraft-lobby-world2 + app.kubernetes.io/instance: minecraft-lobby-world2 +configMapGenerator: + - name: minecraft-lobby-world-config2 + files: + - spigot.yml=config/spigot.yaml + - paper.yml=config/paper.yaml +generatorOptions: + disableNameSuffixHash: true + annotations: + kustomize.toolkit.fluxcd.io/substitute: disabled diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/persistent-volume-claim.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/persistent-volume-claim.yaml new file mode 100644 index 000000000..68b84b60f --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/persistent-volume-claim.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: minecraft-lobby-world-data2 + labels: + kustomize.toolkit.fluxcd.io/prune: disabled +spec: + accessModes: + - ReadWriteOnce + dataSourceRef: + kind: ReplicationDestination + apiGroup: volsync.backube + name: minecraft-lobby-world-data2 + resources: + requests: + storage: 10Gi + storageClassName: ceph-block diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-destination.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-destination.yaml new file mode 100644 index 000000000..45df6c35b --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-destination.yaml @@ -0,0 +1,31 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/volsync.backube/replicationdestination_v1alpha1.json +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationDestination +metadata: + name: minecraft-lobby-world-data2 + labels: + # https://fluxcd.io/flux/components/kustomize/kustomizations/#controlling-the-apply-behavior-of-resources + kustomize.toolkit.fluxcd.io/ssa: IfNotPresent +spec: + trigger: + manual: restore-once + restic: + repository: minecraft-lobby-world-data-volsync2 + copyMethod: Snapshot + volumeSnapshotClassName: csi-ceph-blockpool + cacheStorageClassName: ceph-block + cacheAccessModes: + - ReadWriteOnce + cacheCapacity: 5Gi + storageClassName: ceph-block + accessModes: + - ReadWriteOnce + capacity: 10Gi + moverSecurityContext: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + enableFileDeletion: true + cleanupCachePVC: true + cleanupTempPVC: true diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-source.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-source.yaml new file mode 100644 index 000000000..0a2d707cc --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/replication-source.yaml @@ -0,0 +1,31 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/volsync.backube/replicationsource_v1alpha1.json +apiVersion: volsync.backube/v1alpha1 +kind: ReplicationSource +metadata: + name: minecraft-lobby-world-data2 +spec: + sourcePVC: minecraft-lobby-world-data2 + trigger: + schedule: "0 * * * *" + restic: + copyMethod: Snapshot + pruneIntervalDays: 14 + repository: minecraft-lobby-world-data-volsync2 + volumeSnapshotClassName: csi-ceph-blockpool + cacheCapacity: 5Gi + cacheStorageClassName: ceph-block + cacheAccessModes: + - ReadWriteOnce + storageClassName: ceph-block + accessModes: + - ReadWriteOnce + moverSecurityContext: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + retain: + hourly: 24 + daily: 7 + weekly: 4 + monthly: 3 diff --git a/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/secret.sops.yaml b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/secret.sops.yaml new file mode 100644 index 000000000..1a607faf1 --- /dev/null +++ b/kubernetes/talos-flux/apps/gaming/minecraft-java/lobby-world-paper/secret.sops.yaml @@ -0,0 +1,31 @@ +# yamllint disable +apiVersion: v1 +kind: Secret +metadata: + name: minecraft-lobby-world-data-volsync2 +type: Opaque +stringData: + RESTIC_REPOSITORY: ENC[AES256_GCM,data:AUquy/QUqVlNJIQkS5IBitxvoWtH3pQqMJSC9j/q26I2aZsHd7ycM5+WpyxTm/PplLOstH+4lbrp0+bB/1z869WArPctKjWuET8=,iv:C2NvA7F/PkY20dSnNXk+LTHiyt9MnssSTQHQpswYH60=,tag:gPOteIbYUAxEukj+TXXeMQ==,type:str] + RESTIC_PASSWORD: ENC[AES256_GCM,data:m1leM+zBm9ZtDGmRcElEi4GJwDiRtQ5utA9UxXKk02vEwRgR/7UriWHJl5oY8F06oxeXUvCy1dLa8zn7w28NOg==,iv:2Xwg+hJGt0FT3tJjNW4aUImn2ZDCLPZffRaxoCuaV4k=,tag:pVFkgRg0ZGctj9at/bkhYQ==,type:str] + AWS_ACCESS_KEY_ID: ENC[AES256_GCM,data:JEXZW41lEw==,iv:pduvJsbyBRNMiP6rJ5T7mz79rdW5VLpR/Y3lOXHKU8A=,tag:HZKS59FvxO4FwZrb3LhKmg==,type:str] + AWS_SECRET_ACCESS_KEY: ENC[AES256_GCM,data:aguU70F7QhX2FSEJFmknY8+31PbPIXdF0iGArAkBIihiGhAfOMkD6upDfpZmuZYQcJJgRPpH2jk=,iv:I/9UIpgz0uXHzhhlbV4481gS9KRtm1ZhzvoxJScGsxg=,tag:ax0t2h1ltyPkk+0TgnMCIg==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age16zqeqx5y6ay3flwz0d06rn83yjv9ckys3j8tpkysf9v6295fhc6sf4r0uj + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzYjdZeVptaDlPZW9idmtP + UkRGdmxyb0REM2s4dnZVSERQNFFSRHlqVkcwClJlZHVhQUVnUm16QVloazMyUUFx + Q24vakF5RUEvMTExZ0lPa1RXblFEV3cKLS0tIFNMcGx3NzRQT0U4MTZER0FQUzh3 + SThDODl4ZFFMMUlxM3BneWlrNDdjdUUKm16agevW+HLV4al0q2m5W/SyS84E5SXh + QfWlkG1byRaLRQ+tMeTuCN0tk2A2asmSPygQ1IKo4AO9kMirDEjQ6w== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2025-02-03T23:04:47Z" + mac: ENC[AES256_GCM,data:LHzywiWnv+Q6Qgpadrh8lRgUeFHyocOxfKyH9PIJgId2lQ3XBmMqgZg5E4tLPX0AVs+V7iQxYOYUbUN6B0PNN0aEZ6tBoiciYYOdrvASKOpcnK3N2Z29osDMUjwyRhEk74BCe3EbTv6cBbl+3BNptu+Np6PvKPV/16hBZ8b8I7o=,iv:XsITBYnYBjhqbSG8dBbN5g5Rh3WdqQxp610y4yTFnYU=,tag:7VEkiiGbsdYBPEHle+borQ==,type:str] + pgp: [] + encrypted_regex: ^(data|stringData)$ + version: 3.9.4