Valheim Dedicated Server
-
I actually had no way to test this app after getting the game on steam. I essentially have no GPU which is capable of running that in a way I manage to traverse the UI to the point to connect to a server...not sure how we should proceed here, we probably need a few more people taking this for a test run.
-
@nebulon also we need to talk about my packaging since it's not quite like the cloudron standard.
aka. I get the server binary dynamically at runtime.
echo "=> Create Valheim Server" mkdir -p /run/steamcmd && \ cd /run/steamcmd/ && \ curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf - && \ ./steamcmd.sh +login anonymous +force_install_dir /run/vhserver-steam/ +app_update 896660 +quit
This kinda bypasses the cloudron app version, since the game server will always be up2date with every restart of the app.
I am waiting for feedback from one of the Devs since it's kinda unclear where the binarys does write so I could put it all in
/app/code/
-
@brutalbirdie I have used your app package now for a bit with friends and it works already really well.
I also already saw the server component being updated at least once, this appeared to have worked. So I guess it very much depends on what the upstream strategy is. You seem to have more insight into how they push out updates from the chat conversation we had, so if they have an evergreen approach, maybe it is ok to have the package to not lock down the version, anyways it might cause issues with game clients also being always up-to-date through steam.
If we would keep the evergreen approach, I guess it would make sense though to keep a copy of the server code installed into /app/data instead of run, would that work?
-
@nebulon The question I asked myself was, do I really want the binary game server in
/app/data
and in the backup strategy?
If this would be in/app/code
it would also not be backuped and that is where it should be (if not for the evergreen strategy).As far as I know from the dev the next big milestone will be a complete redesign of their netcode for multiplayer and some other stuff like occlusion culling improving fps for built bases.
I would let the data stay in
/run
since it's not backup worthy.When time comes and mods are supported on linux for servers... hmm
Even then I would work with/run
and automated install of mods on runtime before the server starts. -
The Valheim server binary does read/write on kinda unknown locations. I am still waiting for a proper devs statement from Iron Gate
For example unity wanted to write some stuff to
/root
or/home/cloudron
while runtime (depended on which user started the server).
Symlinking/root
or/home/cloudron
to/app/data
for what?
A binary created fileunity3d/IronGate/Valheim/prefs
with this generated content:# cat unity3d/IronGate/Valheim/prefs <unity_prefs version_major="1" version_minor="1"> <pref name="unity.player_session_count" type="string">NA==</pref> <pref name="unity.player_sessionid" type="string">NDEyNTk2MDkwODkxMTc3NDM4Mw==</pref> </unity_prefs>
this is not backup worthy.
Another thing, I wanted to minimize is the docker image size.
I played around with a local .tar file of the server and copying that into the container.
NO FUN! A build context of 1GB and more, ain't no body got time for that!
Yes I could decrease the build context with installing the server in the Dockerfile, but then again the image would end up with the 1GB+ of the server. This would be ok.But then I got thinking. Game servers depend on being up to date with the upstream.
Steam also has no option (at the moment) for downgrading the version of Valheim.
Since the client is forced on the new version and servers on the old version are incompatible with the new version.
I've decided to get the server while runtime:
https://git.cloudron.io/BrutalBirdie/valheim-gameserver-app/-/blob/master/docker/app/code/start.sh#!/bin/bash set -eu echo "=> Create /app/data/" mkdir -p /app/data/ echo "=> Create nginx dirs" mkdir -p /run/nginx/log /run/nginx/lib echo "=> Creating unity3d dir" mkdir -p /run/unity3d/ echo "=> Copy .env" if [[ ! -f /app/data/.env ]]; then cp -v /app/code/.env /app/data/.env fi echo "=> Create Valheim Server" mkdir -p /run/steamcmd && \ cd /run/steamcmd/ && \ curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf - && \ ./steamcmd.sh +login anonymous +force_install_dir /run/vhserver-steam/ +app_update 896660 +quit echo "=> Start Server" exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon
This way with every restart of the app the server is up to date and is not backuped in
/app/data
since who needs the server binary, I just want my user data in the backup. -
@brutalbirdie hmm, then you probably want nightly restarts unless you're ok doing it manually.
-
@robi said in Valheim Dedicated Server:
@brutalbirdie hmm, then you probably want nightly restarts unless you're ok doing it manually.
Hmm adding a cronjob inside the app the restart that service from supervisord?
Should be doable.
Also I just deployed another Valheim server on a different port and can report this works as well.
So hosting multible valheim apps can be checked -
Update
https://git.cloudron.io/BrutalBirdie/valheim-gameserver-app
[0.0.11] * Updated Server Parameters * Fixed spelling mistake for supervisord * Updated App icon * Fixed Output of Server to display paramters of `/app/data/.env` [0.0.12] * Better readable output of server start * Updated README
-
. . .
Hotfix
[0.0.13]
- -savedir path was wrong resulting in new world generation, no
/app/data
effected by this.
- -savedir path was wrong resulting in new world generation, no
-
Update 0.0.14
- Added BepInEx Mod Support
Git Diff to 0.0.13
https://git.cloudron.io/BrutalBirdie/valheim-gameserver-app/-/commit/b8852be63a5c7b44d49a4602d7ea95773d1e1213
Have fun and happy modding
Cheers
~BrutalBirdie -
Update 0.0.15
- Fixed typo
- Better unzip
-
@brutalbirdie not that I didn’t believe you but just to add a vouch for this: I put up a server and a friend was able to connect. I’ll give it a shot after work and see if I notice any issues.
-
@atrilahiji I know that @nebulon is running the Valheim App and playing with his friends
Still I don't know if's OK for the app store.
-
I think it would be nice to get into the store...I can confirm that it is pretty stable.
Still I am not sure if it makes sense to rely on downloading the server binary on every app restart. This makes it heavily dependent on upstream server download location.
Also when a valheim update is out, I essentially have no means with the current package to roll back if the new version has issues. -
@nebulon is there even an option to rollback the client?
Because if client and server are out of sync from versions, you simply can't connect.As far as I know Valheim is only sold on Steam which does not provide version selection.
-
@brutalbirdie you are the expert on this
Then I guess the main outstanding issue is the always-on downloading during app start.
This might be similar to the minecraft packages, where it might makes sense to stash the binaries in /app/data/ to both achieve an evergreen state as well as avoiding downloading and installing on every restart.Question I guess is, how we can determine when an update is needed or not, do you think there is some way besides manually triggering that through some sort of UI?
-
@nebulon actually I checked the restart process.
On a normal app restart neither/run
or/tmp
is deleted.That's why I had to do the
0.0.15
update because otherwise the unzip process in/tmp
would get stuck because it expected an interaction to override existing files in/tmp
. I added the-u
aka update option to the unzip to mitigate that issue.Also viewing from that, on a normal restart there is no 'new download' just a verification of integrity of the server.
Can be seen in my restart from 06.03.2021
2021-03-06T23:32:27.000Z => Create Valheim Server 2021-03-06T23:32:27.000Z steamcmd.sh 2021-03-06T23:32:27.000Z linux32/steamcmd 2021-03-06T23:32:27.000Z linux32/steamerrorreporter 2021-03-06T23:32:27.000Z linux32/libstdc++.so.6 2021-03-06T23:32:27.000Z linux32/crashhandler.so 2021-03-06T23:32:27.000Z Redirecting stderr to '/root/Steam/logs/stderr.txt' 2021-03-06T23:32:27.000Z [ 0%] Checking for available updates... 2021-03-06T23:32:28.000Z [----] Verifying installation... 2021-03-06T23:32:28.000Z [ 0%] Downloading update... 2021-03-06T23:32:28.000Z [ 0%] Checking for available updates... 2021-03-06T23:32:29.000Z [----] Download complete. 2021-03-06T23:32:29.000Z [----] Extracting package... 2021-03-06T23:32:30.000Z [----] Extracting package... 2021-03-06T23:32:31.000Z [----] Extracting package... 2021-03-06T23:32:31.000Z [----] Extracting package... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Installing update... 2021-03-06T23:32:31.000Z [----] Cleaning up... 2021-03-06T23:32:31.000Z [----] Update complete, launching Steamcmd... 2021-03-06T23:32:31.000Z Redirecting stderr to '/root/Steam/logs/stderr.txt' 2021-03-06T23:32:31.000Z /tmp/dumps insufficient permissions - delete and recreate 2021-03-06T23:32:31.000Z [ 0%] Checking for available updates... 2021-03-06T23:32:32.000Z [----] Verifying installation... 2021-03-06T23:32:32.000Z Steam Console Client (c) Valve Corporation 2021-03-06T23:32:32.000Z -- type 'quit' to exit -- 2021-03-06T23:32:32.000Z Loading Steam API...src/clientdll/applicationmanager.cpp (4255) : Assertion Failed: CApplicationManager::GetMountVolume: invalid index 2021-03-06T23:32:32.000Z crash_20210306233232_8.dmp[40]: Uploading dump (out-of-process) 2021-03-06T23:32:32.000Z /tmp/dumps/crash_20210306233232_8.dmp 2021-03-06T23:32:32.000Z 2021-03-06T23:32:32.000Z src/clientdll/applicationmanager.cpp (4255) : Assertion Failed: CApplicationManager::GetMountVolume: invalid index 2021-03-06T23:32:32.000Z crash_20210306233232_8.dmp[40]: Finished uploading minidump (out-of-process): success = no 2021-03-06T23:32:32.000Z 2021-03-06T23:32:32.000Z crash_20210306233232_8.dmp[40]: error: libcurl.so: cannot open shared object file: No such file or directory 2021-03-06T23:32:32.000Z 2021-03-06T23:32:32.000Z crash_20210306233232_8.dmp[40]: file ''/tmp/dumps/crash_20210306233232_8.dmp'', upload no: ''libcurl.so: cannot open shared object file: No such file or directory'' 2021-03-06T23:32:32.000Z 2021-03-06T23:32:32.000Z src/clientdll/applicationmanager.cpp (4420) : Assertion Failed: m_vecInstallBaseFolders.Count() > 0 2021-03-06T23:32:32.000Z OK. 2021-03-06T23:32:32.000Z 2021-03-06T23:32:34.000Z Connecting anonymously to Steam Public...Logged in OK 2021-03-06T23:32:44.000Z Waiting for user info...OK 2021-03-06T23:32:44.000Z src/clientdll/applicationmanager.cpp (4420) : Assertion Failed: m_vecInstallBaseFolders.Count() > 0 2021-03-06T23:32:44.000Z Update state (0x3) reconfiguring, progress: 0.00 (0 / 0) 2021-03-06T23:32:46.000Z Update state (0x5) verifying install, progress: 2.94 (30918564 / 1051599543) 2021-03-06T23:32:48.000Z Update state (0x5) verifying install, progress: 58.67 (616989652 / 1051599543) 2021-03-06T23:32:50.000Z Update state (0x61) downloading, progress: 100.00 (1051599532 / 1051599543) 2021-03-06T23:32:50.000Z Success! App '896660' fully installed.
For a fresh install it would look like this
=> Create Valheim Server steamcmd.sh linux32/steamcmd linux32/steamerrorreporter linux32/libstdc++.so.6 linux32/crashhandler.so Redirecting stderr to '/root/Steam/logs/stderr.txt' ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt". [ 0%] Checking for available update... [----] Downloading update (0 of 51728 KB)... [ 0%] Downloading update (1903 of 51728 KB)... [ 3%] Downloading update (4630 of 51728 KB)... [ 8%] Downloading update (6511 of 51728 KB)... [ 12%] Downloading update (8350 of 51728 KB)... [ 16%] Downloading update (9902 of 51728 KB)... [ 19%] Downloading update (11396 of 51728 KB)... [ 22%] Downloading update (12903 of 51728 KB)... [ 24%] Downloading update (14671 of 51728 KB)... [ 28%] Downloading update (16247 of 51728 KB)... [ 31%] Downloading update (17765 of 51728 KB)... [ 34%] Downloading update (19310 of 51728 KB)... [ 37%] Downloading update (21095 of 51728 KB)... [ 40%] Downloading update (22583 of 51728 KB)... [ 43%] Downloading update (24247 of 51728 KB)... [ 46%] Downloading update (25847 of 51728 KB)... [ 49%] Downloading update (27277 of 51728 KB)... [ 52%] Downloading update (28925 of 51728 KB)... [ 55%] Downloading update (30358 of 51728 KB)... [ 58%] Downloading update (31747 of 51728 KB)... [ 61%] Downloading update (32473 of 51728 KB)... [ 62%] Downloading update (33266 of 51728 KB)... [ 64%] Downloading update (34088 of 51728 KB)... [ 65%] Downloading update (34765 of 51728 KB)... [ 67%] Downloading update (35439 of 51728 KB)... [ 68%] Downloading update (36313 of 51728 KB)... [ 70%] Downloading update (37129 of 51728 KB)... [ 71%] Downloading update (37933 of 51728 KB)... [ 73%] Downloading update (38863 of 51728 KB)... [ 75%] Downloading update (39685 of 51728 KB)... [ 76%] Downloading update (40583 of 51728 KB)... [ 78%] Downloading update (41670 of 51728 KB)... [ 80%] Downloading update (42639 of 51728 KB)... [ 82%] Downloading update (43607 of 51728 KB)... [ 84%] Downloading update (44633 of 51728 KB)... [ 86%] Downloading update (45447 of 51728 KB)... [ 87%] Downloading update (46440 of 51728 KB)... [ 89%] Downloading update (47350 of 51728 KB)... [ 91%] Downloading update (48248 of 51728 KB)... [ 93%] Downloading update (49081 of 51728 KB)... [ 94%] Downloading update (50279 of 51728 KB)... [ 97%] Downloading update (51181 of 51728 KB)... [ 98%] Downloading update (51728 of 51728 KB)... [100%] Download Complete. [----] Applying update... [----] Extracting package... [----] Extracting package... [----] Extracting package... [----] Extracting package... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Cleaning up... [----] Update complete, launching... Redirecting stderr to '/root/Steam/logs/stderr.txt' /tmp/dumps insufficient permissions - delete and recreate [ 0%] Checking for available updates... [----] Verifying installation... [ 0%] Downloading update... [ 0%] Checking for available updates... [----] Download complete. [----] Extracting package... [----] Extracting package... [----] Extracting package... [----] Extracting package... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Installing update... [----] Cleaning up... [----] Update complete, launching Steamcmd... Redirecting stderr to '/root/Steam/logs/stderr.txt' [ 0%] Checking for available updates... [----] Verifying installation... Steam Console Client (c) Valve Corporation -- type 'quit' to exit --
Question I guess is, how we can determine when an update is needed or not, do you think there is some way besides manually triggering that through some sort of UI?
Hmm the normal install of the server via steamcmd also just check for updates on app restart.
But to do that successful the valheim server needs to be offline | existed.@robi said in Valheim Dedicated Server:
hmm, then you probably want nightly restarts unless you're ok doing it manually.
I played around with a supervisord restart service X which resulted in a stuck app which needed to be restarted anyway.
-
@brutalbirdie I guess that makes sense then, /tmp and /run will be persistent across restarts, however /tmp will have a tmpreaper, so that might not be good to put thing there then.
Also using supervisor to restart the server on a time interval might also not be ideal, since in my experience it makes sense to not randomly restart it while players are logged-in.
-
-