You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be wonderful (but not trivial!) to add support for starting the container+server via systemd socket activation. It would allow starting the server on-demand, while leaving it not running most of the time. This is a good match for servers that are rarely used and which shouldn't be left on 24/7 consuming system resources.
Since, to my knowledge, Valheim itself does not support socket activation, support would have to be "grafted on" by using proxies such as systemd-socket-proxyd to intercept and buffer the connection while the container and server are launching. From my reading, I get the impression this is possible, but that the easiest way is to have support built-in to the container image itself -- hence this feature request.
Some prior art on adding support to services that do not natively support socket activation:
This all hinges on how Valheim's Windows client behaves when a server doesn't respond within a certain amount of time. It's going to take anywhere from 10 to around 40 seconds for the server to start up, load the world and accept connections. During that time the client's UDP packages wouldn't get any response. Systemd would buffer them and eventually forward to the server, but the client might just assume a server that doesn't respond within seconds to be dead.
I don't use Docker but I'm commenting here since this is one of the discussions I stumbled upon while working on socket activation for my Valheim dedicated server, in the interest that this is somehow useful to you. I ended up writing a small UDP proxy in Node.js (but it could be any language really) to manage the socket. I detailed it all in a blog post at https://blog.nytsoi.net/2024/07/18/valheim-systemd-socket-activation and the code repo is https://git.ahlcode.fi/nicd/valproxy.
The caveat is that as you mentioned, the server takes time to start, and on my server it's not quick enough to respond to the first connection attempt. So the first user will need to connect twice. I deem this acceptable in my use case, which is just a server for some friends.
It would be wonderful (but not trivial!) to add support for starting the container+server via systemd socket activation. It would allow starting the server on-demand, while leaving it not running most of the time. This is a good match for servers that are rarely used and which shouldn't be left on 24/7 consuming system resources.
Since, to my knowledge, Valheim itself does not support socket activation, support would have to be "grafted on" by using proxies such as
systemd-socket-proxyd
to intercept and buffer the connection while the container and server are launching. From my reading, I get the impression this is possible, but that the easiest way is to have support built-in to the container image itself -- hence this feature request.Some prior art on adding support to services that do not natively support socket activation:
General background reading:
Of course, another option would be to ask the upstream game developers for native support...
Would also address #687, as mentioned in the comments.
The text was updated successfully, but these errors were encountered: