Skip to content

Commit

Permalink
Allow custom server.properties per environment
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianValente committed Dec 25, 2023
1 parent 586c3c9 commit abe2311
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions chart/templates/stateful-set.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
env:
- name: CMD
value: {{ .Values.cmd }}
- name: ENVIRONMENT
value: {{ .Values.environment }}
imagePullSecrets:
- name: regcred
volumes:
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ image: docker.home.valente.ar/svc-minecraft
port: 25565

cmd: java -Xms1G -Xmx1G -jar /app/paper*.jar nogui
environment: staging

pvc:
storage: 5Gi
Expand Down
3 changes: 3 additions & 0 deletions src/server.properties.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
motd=Brian's Server (staging)
view-distance=10
simulation-distance=10
12 changes: 12 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@ rm -rf /app-data/plugins/*.jar
# ProtectionStones
rm -rf /app-data/plugins/ProtectionStones

# server.properties
rm /app-data/server.properties*

# Copy all files from /app/data inside /app-data, replacing if needed, recursively
cp -r /app/data/* /app-data/

# Merge server.properties
if [ -f /app-data/server.properties.$ENVIRONMENT ]; then
cat /app-data/server.properties.$ENVIRONMENT /app-data/server.properties > /app-data/server.properties.tmp
mv /app-data/server.properties.tmp /app-data/server.properties
fi

# Delete server.properties.*
rm /app-data/server.properties.*

# Start the server
eval "exec $CMD"
6 changes: 3 additions & 3 deletions values-staging.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmd: java -Xms512M -Xmx512M -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 /app/paper*.jar nogui
cmd: java -Xms2G -Xmx2G -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 /app/paper*.jar nogui

pvc:
storage: 5Gi

resources:
requests:
memory: "1Gi"
memory: "3Gi"
limits:
memory: "1.5Gi"
memory: "3Gi"

prometheus:
enabled: true
Expand Down

0 comments on commit abe2311

Please sign in to comment.