Skip to content

Commit

Permalink
feat(minecraft): configure persistence for creative world
Browse files Browse the repository at this point in the history
  • Loading branch information
tyriis committed Feb 5, 2025
1 parent 8554fc8 commit 398c638
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: minecraft-creative-world-env
data:
EULA: "true"
DIFFICULTY: peaceful
OPS: "tyriis,jazzlyin"
MAX_PLAYERS: "25"
ALLOW_NETHER: "false"
ENABLE_COMMAND_BLOCK: "true"
GENERATE_STRUCTURES: "false"
SPAWN_ANIMALS: "false"
SPAWN_MONSTERS: "false"
SPAWN_NPCS: "false"
SPAWN_PROTECTION: "0"
VIEW_DISTANCE: "14"
MODE: creative
MOTD: hello minecraft creative world
PVP: "false"
LEVEL_TYPE: DEFAULT
ONLINE_MODE: "false"
CF_PARALLEL_DOWNLOADS: "4"
ENABLE_RCON: "true"
MAX_BUILD_HEIGHT: "256"
ENABLE_ROLLING_LOGS: "true"
LOG_TIMESTAMP: "true"
SNOOPER_ENABLED: "true"
LEVEL: creative-world
SERVER_NAME: creative-world
STOP_SERVER_ANNOUNCE_DELAY: "30"
STOP_DURATION: "30"
USE_AIKAR_FLAGS: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,16 @@ spec:
name: minecraft-rcon
- secretRef:
name: curseforge-api-key
- configMapRef:
name: minecraft-creative-world-env
env:
# https://docker-minecraft-server.readthedocs.io/en/latest/variables
TZ: ${SETTING_TZ}
EULA: "true"
TYPE: "PAPER"
# TODO renovate
VERSION: "1.21.4"
DIFFICULTY: normal
OPS: "tyriis,jazzlyin"
MAX_PLAYERS: "25"
VIEW_DISTANCE: "14"
MODE: creative
MOTD: "hello minecraft creative world"
PVP: "false"
LEVEL_TYPE: DEFAULT
ONLINE_MODE: "false"
MEMORY: "1024M"
ENABLE_RCON: "true"
CF_PARALLEL_DOWNLOADS: "4"
MODS_FILE: /config/plugins.txt
LEVEL: creative-world
STOP_SERVER_ANNOUNCE_DELAY: "30"
STOP_DURATION: "30"
LOG_TIMESTAMP: "true"
REPLACE_ENV_DURING_SYNC: "true"
CFG_PROXY_SECRET:
Expand Down Expand Up @@ -150,6 +137,12 @@ spec:
interval: 1m

persistence:
data:
existingClaim: minecraft-creative-world-data
advancedMounts:
minecraft:
app:
- path: /data
config:
type: configMap
name: minecraft-creative-world-config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helm-release.yaml
commonLabels:
app.kubernetes.io/name: minecraft-creative-world
app.kubernetes.io/instance: minecraft-creative-world
- config-map.yaml
- secret.sops.yaml
- replication-destination.yaml
- persistent-volume-claim.yaml
- replication-source.yaml
- helm-release.yaml
configMapGenerator:
- name: minecraft-creative-world-config
files:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minecraft-creative-world-data
labels:
kustomize.toolkit.fluxcd.io/prune: disabled
spec:
accessModes:
- ReadWriteOnce
dataSourceRef:
kind: ReplicationDestination
apiGroup: volsync.backube
name: minecraft-creative-world-data
resources:
requests:
storage: 10Gi
storageClassName: ceph-block
Original file line number Diff line number Diff line change
@@ -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-creative-world-data
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-creative-world-data-volsync
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
Original file line number Diff line number Diff line change
@@ -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-creative-world-data
spec:
sourcePVC: minecraft-creative-world-data
trigger:
schedule: "0 * * * *"
restic:
copyMethod: Snapshot
pruneIntervalDays: 14
repository: minecraft-creative-world-data-volsync
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# yamllint disable
apiVersion: v1
kind: Secret
metadata:
name: minecraft-creative-world-data-volsync
type: Opaque
stringData:
RESTIC_REPOSITORY: ENC[AES256_GCM,data:I78cc8FKGTK/ei/wBDvxEYCjeLBcNEOhzvDnVUzdhuAsUeAMFnqRiTFR7s3Q+++j8P0S5CiAhY2PfPdY1DBPPbuUrwmt6Drtb1kT2aM=,iv:Orkyb+FaUeQEbdq/QAcGTi8GzYdRMbeu0Em7ysD1L14=,tag:hAMPb9qtMNItJjV8WT7UfQ==,type:str]
RESTIC_PASSWORD: ENC[AES256_GCM,data:3UHkZkvo6C5ISl+K9Jt99MNkcYr51lnAnpI+x0EPRz5j3KDYbtsT/09XGHFRUei6b28Ed4OyeC64eosjifmT2g==,iv:r7mU2+Iop/kJrn6NmOziKWkzNndzEzWp/kcHUUyiSj4=,tag:SNZ5IoeNTkSwFdEhwovF1w==,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-05T10:21:40Z"
mac: ENC[AES256_GCM,data:FOwa237uRnIs6BKBEOmn0b4Y0qUj47MAWiXAOj6Fae+XY7JxfGvWkLIg/uy82ZOm2O2dEJMxZP6EGWuS3us68nNsi4nFRHAE8FR5IoNjo3BEt+HNkOIzpeF7HW2QJPkMrlORzMRDxv2khIykN/6AUwaEdyR9bEEE1Vrt0jlbc9g=,iv:wkjkHTLllpSKHRWtI9W8so7ke72Q48X2TF9/bs0BE+4=,tag:5IHhSkTdj45DWx5tnMkMng==,type:str]
pgp: []
encrypted_regex: ^(data|stringData)$
version: 3.9.4

0 comments on commit 398c638

Please sign in to comment.