diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb039a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +configs/vaultwarden.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..4b47fcc --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file diff --git a/scripts/add-ssh-keys.sh b/scripts/add-ssh-keys.sh new file mode 100644 index 0000000..b15dc5f --- /dev/null +++ b/scripts/add-ssh-keys.sh @@ -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 diff --git a/scripts/backup-mc-server.sh b/scripts/backup-mc-server.sh new file mode 100644 index 0000000..dc2238a --- /dev/null +++ b/scripts/backup-mc-server.sh @@ -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 \ No newline at end of file diff --git a/scripts/start-mc-server.sh b/scripts/start-mc-server.sh new file mode 100644 index 0000000..ceaccc5 --- /dev/null +++ b/scripts/start-mc-server.sh @@ -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 \ No newline at end of file diff --git a/systemd/minecraft.service b/systemd/minecraft.service new file mode 100644 index 0000000..d100f53 --- /dev/null +++ b/systemd/minecraft.service @@ -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 \ No newline at end of file diff --git a/systemd/minecraft.socket b/systemd/minecraft.socket new file mode 100644 index 0000000..97d0d58 --- /dev/null +++ b/systemd/minecraft.socket @@ -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 \ No newline at end of file diff --git a/wlm/statefulset.yml b/wlm/statefulset.yml deleted file mode 100644 index d69d06f..0000000 --- a/wlm/statefulset.yml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: mystatefulset -spec: - selector: - matchLabels: - app: myapp - 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