diff --git a/deployments/game-servers/wings-valheim/deployment.yaml b/deployments/game-servers/wings-valheim/deployment.yaml index 5be7709..936b46a 100644 --- a/deployments/game-servers/wings-valheim/deployment.yaml +++ b/deployments/game-servers/wings-valheim/deployment.yaml @@ -9,6 +9,7 @@ metadata: app.kubernetes.io/part-of: pelican game: valheim spec: + replicas: 1 strategy: type: Recreate selector: @@ -22,44 +23,21 @@ spec: spec: nodeSelector: kubernetes.io/arch: amd64 + volumes: + - name: wings-config + secret: + secretName: wings-valheim-config + - name: docker-socket + emptyDir: {} + - name: dind-storage + emptyDir: {} + - name: server-data + persistentVolumeClaim: + claimName: wings-valheim-data + - name: autostart-token + secret: + secretName: pelican-autostart-key containers: - - name: wings - image: ghcr.io/pelican-dev/wings:latest - env: - - name: DOCKER_HOST - value: tcp://localhost:2375 - - name: WINGS_UID - value: "1000" - - name: WINGS_GID - value: "1000" - - name: WINGS_PORT - value: "8081" - - name: WINGS_API_SFTP_PORT - value: "2023" - - name: WINGS_SERVER_UUID - value: "9d09e83d-00c3-4404-07c0522a6c25" - envFrom: - - secretRef: - name: wings-valheim-config - volumeMounts: - - name: docker-socket - mountPath: /var/run/docker.sock - - name: wings-data - mountPath: /var/lib/wings - - name: server-data - mountPath: /mnt/server - readinessProbe: - httpGet: - path: /ready - port: 8081 - initialDelaySeconds: 10 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /health - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 30 - name: dind image: docker:24-dind securityContext: @@ -72,47 +50,62 @@ spec: mountPath: /var/run - name: dind-storage mountPath: /var/lib/docker - readinessProbe: - exec: - command: - - sh - - -c - - '[ -S /var/run/docker.sock ]' - initialDelaySeconds: 5 - periodSeconds: 5 - - name: game-autostart - image: curlimages/curl:latest - env: - - name: PELICAN_API_KEY - valueFrom: - secretKeyRef: - name: pelican-autostart-key - key: api_key - - name: SERVER_UUID - value: "9d09e83d-00c3-4404-07c0522a6c25" + resources: + requests: + cpu: "500m" + memory: "512Mi" + limits: + cpu: "1" + memory: "1Gi" + - name: wings + image: ghcr.io/pelican-dev/wings:latest command: - /bin/sh - -c - | - echo "Waiting for Wings API to be ready..." - while ! curl -sf http://localhost:8081/ready; do - sleep 2 - done - echo "Wings ready. Starting game server..." - while true; do - sleep 60 - echo "Checking game server status..." - done + export DOCKER_HOST=tcp://localhost:2375 + exec wings + env: + - name: DOCKER_HOST + value: tcp://localhost:2375 + - name: WATCHDOG_ENABLED + value: "true" volumeMounts: + - name: wings-config + mountPath: /etc/pterodactyl + readOnly: true + - name: docker-socket + mountPath: /var/run/docker.sock - name: server-data mountPath: /mnt/server - volumes: - - name: docker-socket - emptyDir: {} - - name: dind-storage - emptyDir: {} - - name: wings-data - emptyDir: {} - - name: server-data - persistentVolumeClaim: - claimName: wings-valheim-data + resources: + requests: + cpu: "1" + memory: "2Gi" + limits: + cpu: "4" + memory: "8Gi" + - name: game-autostart + image: curlimages/curl:latest + command: + - /bin/sh + - -c + - | + while true; do + sleep 60 + curl -sf -X POST "https://pelican.khalisio.com/api/client/servers/9d09e83d-00c3-4404-8f81-07c0522a6c25/power" \ + -H "Authorization: Bearer $(cat /etc/secrets/autostart/api_key)" \ + -H "Content-Type: application/json" \ + -d '{"signal":"start"}' > /dev/null 2>&1 || true + done + volumeMounts: + - name: autostart-token + mountPath: /etc/secrets/autostart + readOnly: true + resources: + requests: + cpu: "50m" + memory: "64Mi" + limits: + cpu: "100m" + memory: "128Mi"