Fix websocket url load fails and added persistence - #286
Conversation
|
Thanks for working on this. The original logic was indeed over ambitious and I'm surprised I approved the use of apt during an entry point. |
itzg
left a comment
There was a problem hiding this comment.
Looks great. Please also bump the chart version.
|
Can't believe I missed it in my original commit. All done! |
|
As I mentioned in the linked issue, that rcon web admin (which is not mine) doesn't seem to work most of the time. I'm guessing that's why the test deploy is failing. |
itzg
left a comment
There was a problem hiding this comment.
Ah yes, that fix makes total sense
|
There are several issues on the CI side. I have tested this on my own cluster and the rcon-web is able to connect to the server. IssuesMetallb IP Pool AllocationThe default Alternatively we could set an IP for the No Minecraft deployment to Test RCON Connection.Options
|
Fix issue #258 rcon-web-admin chart issues
Problem Description
The rcon-web-admin chart has two critical issues that prevent it from working correctly in Kubernetes environments:
Issue 1: Broken WebSocket URL Configuration
Location: Container startup script
Problem: The container's default ENTRYPOINT script attempts to:
jqviaapt-getto parse Kubernetes API responsesRWA_WEBSOCKET_URLbased on the discovered IPThis fails in most Kubernetes deployments because:
apt-getmay fail due to read-only root filesystems or permission issuesjqinstallation succeeds, the API call may return an empty responsejqfails, it outputs nothing, resulting inRWA_WEBSOCKET_URL=ws://:4327(empty host)Result: The web UI loads but fails to connect to the backend websocket, showing "Invalid url for WebSocket ws://:4327"
Issue 2: No Database Persistence
Location:
values.yaml-persistencesectionProblem: The chart uses an
emptyDirvolume for the database (/opt/rcon-web-admin/db), which means:Result: Users must re-configure their Minecraft servers after every deployment update or pod restart.
Solution
Fix 1: Add Persistent Storage Support
Add proper PVC-based persistence to the values.yaml:
This requires updating the deployment to use a PVC instead of emptyDir.
Fix 2: Add WebSocket URL Environment Variables
Add environment variable support for websocket configuration with sensible defaults:
Why
localhost:4327works: The browser connects to the LoadBalancer IP (e.g.,http://192.168.1.100:8080), which forwards traffic to the pod. The pod's port 4327 is exposed via the same service, solocalhost:4327resolves correctly when accessed through the LoadBalancer.When to override: If using an external proxy or ingress with different hostnames, users can set custom URLs.
Fix 3: Update Deployment for Persistence
The deployment needs to conditionally use a PVC when persistence is enabled:
Fix 4: Remove deployment command
Workaround for Existing Deployments
Users with existing deployments can work around these issues by:
localhostworks when accessed via LoadBalancer):kubectl patch deployment rcon-web-rcon-web-admin \ --namespace minecraft \ --type=strategic \ -p '{"spec":{"template":{"spec":{"containers":[{"name":"rcon-web-admin","env":[{"name":"RWA_WEBSOCKET_URL","value":"ws://localhost:4327"},{"name":"RWA_WEBSOCKET_URL_SSL","value":"wss://localhost:4327"}]}]}}}}'kubectl patch deployment rcon-web-rcon-web-admin \ --namespace minecraft \ --type=strategic \ -p '{"spec":{"template":{"spec":{"volumes":[{"name":"db","persistentVolumeClaim":{"claimName":"rcon-web-db"}}]}}}}'Testing
To verify the fixes:
kubectl rollout restart deployment rcon-web-rcon-web-admin