PhValheim is a two-part world and client manager for Valheim (with aspirations of becoming game agnostic), it keeps server and client files in lock-step, ensuring all players have the same experience.
Valheim is a fantastic game and the more we play the more we want. Modding Valheim is simple to do but difficult to manage across all players. Keeping the remote server and clients in-sync are nearly impossible without something like PhValheim. While mod managers work well (Thunderstore and Nexus Mods), they don't work in a federated manner, eventaully resulting in clients being out of sync with each other and the remote server. PhValheim's primary goal is to solve this problem.
Mods are great and PhValheim makes it stupid simple to install them but keep in mind that the primary reason your game may not be working is due to the combination of mods you're using. Not all mods are made equal and most mods become "broken" after a major game update. If you have issues with your game running, please be sure to deploy a vanilla world (no mods selected) before submitting an issue.
As mentioned above, PhValheim Server runs in a docker container. Out-of-the-box the container runs a few services:
All of this is great but useless without a way to ensure the client behaves as expected. This is where PhValheim Client comes in. PhValheim Client is a mandatory companion application that runs on all Windows clients. It's a small C# application that registers a new "phvalheim://" URL to your Windows Registry. This allows your computer to recgonize and understand PhValheim Server payload URLs. When a PhValheim URL is clicked, the PhValheim Client pulls the URL into memory and decodes the information, instructing your PC what to do.
Access to each world is controlled by the PhValheim database. We associate the SteamID of each player to every world we want to grant access to. The PhValheim Server will store SteamIDs to grant access to both the public web UI (library of worlds) and the allowList.txt file associated with each world. This ensures only allowed "citizens" can see the world in the UI and make a logical connection to the world itself (UDP).
docker create \
--name='myPhValheim-server1' \
-p '8080:8080/tcp' \
-p '8081:8081/tcp' \
-p '25000-26000:25000-26000/udp' \
-e 'basePort'='25000' \
-e 'defaultSeed'='szN8qp2lBn' \
-e 'backupsToKeep'='10' \
-e 'phvalheimHost'='phvalheim-dev.phospher.com' \
-e 'gameDNS'='37648-dev1.phospher.com' \
-e 'steamAPIKey'='0123456789' \
-e 'phvalheimClientURL'='https://github.com/brianmiller/phvalheim-client/raw/master/published_build/phvalheim-client-installer.exe' \
-v '/mnt/docker_persistent/phvalheim':'/opt/stateful':Z \
-v '/mnt/phvalheim_backups/':'/opt/stateful/backups':Z \
theoriginalbrian/phvalheim-server:latest``
docker start myPhValheim-server1
Variable | Description |
---|---|
basePort | The port your first world will use. This must be the beginning of the port range passed to the container on start. |
defaultSeed | The seed used when a seed isn't provided during world creation. |
backupsToKeep | How many backups to keep on disk before deleting the oldest. |
phvalheimHost | The FQDN of your PhValheim server your users will connect to. |
gameDNS | The FQDN your users will connected their Valheim client to. This can be the same as phvalheimHost, if needed. |
steamAPIKey | Your SteamAPI key used for player identification and authorization. See Generate Steam API Key for help. |
phvalheimClientURL | The hosted URL for PhValheim Client downloads. You can change this if you prefer to host your own client files. |
Container Path | Description |
---|---|
/opt/stateful | This volume stores all persistent data for your worlds, mods, PhValheim database, and configuration files. |
/opt/stateful/backups | This volume is the destination of world backups. It's a good idea to set this to a different disk for disaster recovery. |
Container Port | Description |
---|---|
8080/tcp | This is the port the internal web service listens on and is the interface you want exposed to the public. Without this, nothing works. |
8081/tcp | This is the port the admin interface listens on. This should not be accessible from the public internet. Do not forward this port in your firewall/router unless you know what you're doing. |
25000-26000/udp | This is the port range used by PhValheim worlds. |
server {
listen 80;
server_name phvalheim.phospher.com;
rewrite ^ https://$http_host$request_uri? permanent;
server_tokens off;
}
server {
listen 443 ssl;
server_name phvalheim.phospher.com phvalheim;
ssl_certificate /mnt/certs/live/phospher.com/fullchain.pem;
ssl_certificate_key /mnt/certs/live/phospher.com/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_stapling on;
ssl_stapling_verify on;
#ssl_verify_client off;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
location / {
proxy_pass http://37648-dev1.phospher.com:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https;
proxy_request_buffering off;
access_log /config/nginx/logs/phvalheim.access.log;
error_log /config/nginx/logs/phvalheim.error.log;
proxy_read_timeout 1200s;
client_max_body_size 0;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}