Add scripts from Minecraft server
This commit is contained in:
parent
ac68724a9b
commit
0696a11c0a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
configs/vaultwarden.json
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# infra
|
||||||
|
|
||||||
|
some personal infrastructure configuration stuff, including kubernetes config for
|
||||||
|
my personal cluster and mc-invites, along with some misc scripts i find useful.
|
5
scripts/add-ssh-keys.sh
Normal file
5
scripts/add-ssh-keys.sh
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# simply pull keys down from sourcehut.
|
||||||
|
# i would use github, but my keys are a bit of a mess there, and it doesn't
|
||||||
|
# really matter.
|
||||||
|
mkdir -p $HOME/.ssh
|
||||||
|
curl https://meta.sr.ht/~gmem.keys >> $HOME/.ssh/authorized_keys
|
8
scripts/backup-mc-server.sh
Normal file
8
scripts/backup-mc-server.sh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# backs up minecraft server, assuming it's using a systemd socket.
|
||||||
|
# see /systemd
|
||||||
|
echo "Backing up server world"
|
||||||
|
echo "say Backing up world, please wait..." > /home/ubuntu/mc/minecraft.control
|
||||||
|
echo "save-off" > /home/ubuntu/mc/minecraft.control
|
||||||
|
rclone sync /home/ubuntu/mc hetzner: -P
|
||||||
|
echo "save-on" > /home/ubuntu/mc/minecraft.control
|
||||||
|
echo "say World backed up, saving re-enabled" > /home/ubuntu/mc/minecraft.control
|
9
scripts/start-mc-server.sh
Normal file
9
scripts/start-mc-server.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# start minecraft server with optimised jvm flags from https://mcflags.emc.gs
|
||||||
|
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 \
|
||||||
|
-XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch \
|
||||||
|
-XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M \
|
||||||
|
-XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
|
||||||
|
-XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 \
|
||||||
|
-XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem \
|
||||||
|
-XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true \
|
||||||
|
-jar paper.jar --nogui
|
23
systemd/minecraft.service
Normal file
23
systemd/minecraft.service
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Minecraft Server
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
# Replace the following with correct values
|
||||||
|
ExecStart=/bin/bash /home/ubuntu/mc/start.sh
|
||||||
|
User=ubuntu
|
||||||
|
Group=ubuntu
|
||||||
|
WorkingDirectory=/home/ubuntu/mc
|
||||||
|
ExecStop=/bin/sh -c "echo stop > /home/ubuntu/mc/minecraft.control"
|
||||||
|
KillSignal=SIGCONT
|
||||||
|
|
||||||
|
Sockets=minecraft.socket
|
||||||
|
StandardInput=socket
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=60s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
10
systemd/minecraft.socket
Normal file
10
systemd/minecraft.socket
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
BindsTo=minecraft.service
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
# Replace the following with correct values
|
||||||
|
ListenFIFO=/home/ubuntu/mc/minecraft.control
|
||||||
|
RemoveOnStop=true
|
||||||
|
SocketMode=0660
|
||||||
|
SocketUser=ubuntu
|
||||||
|
SocketGroup=ubuntu
|
|
@ -1,32 +0,0 @@
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: StatefulSet
|
|
||||||
metadata:
|
|
||||||
name: mystatefulset
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: myapp
|
|
||||||
serviceName: <ServiceName>
|
|
||||||
replicas: 2
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: myapp
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: myapp
|
|
||||||
image: k8s.gcr.io/nginx-slim:0.8
|
|
||||||
ports:
|
|
||||||
- containerPort: 80
|
|
||||||
name: web
|
|
||||||
volumeMounts:
|
|
||||||
- name: www
|
|
||||||
mountPath: /usr/share/nginx/html
|
|
||||||
volumeClaimTemplates:
|
|
||||||
- metadata:
|
|
||||||
name: www
|
|
||||||
spec:
|
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 1Gi
|
|
Loading…
Reference in a new issue