image::docs/submarine-whale.svg["Good Luck"]
link:README.zh.adoc[>> 中文文档 <<]
This repo is inspired by https://github.com/CM2Walki/steamcmd[CM2Walki] and https://github.com/gnoeley/barotrauma-dedicated-server-docker[gnoeley], with different approaches.
See https://hub.docker.com/r/yanwk/barotrauma-server[Docker Hub Page].
dockerful
>>.slim
and <<prepare-your-files,follow the steps>>.Barotrauma Dedicated Server is basically a core subset of the game, without assets like images and sounds. The game is program-data mixed, so is the Server, which brings more to consider when deploy in container-style.
Most importantly, is whether you need Modding or not.
For different scenario, we have three flavors:
<<how-to-run-slim-flavor,slim
>> would run container in an "old fashioned", "non-dockerful", yet robust way.
It only come with .NET runtime and SteamCMD (Official Steam Client CLI).
It will download & install the game server on first start.
It will update the game server (via SteamCMD) on every container restart.
It mounts the whole game server folder as a docker volume.
So you can thoroughly modding your game (out of Mods folder).
Restarting/Redeploying of container won't replace your files (But Be Careful Of Game Updates ;-)
** No environment variables. Just edit settings files.
<<how-to-run-preload-flavor,preload
>> is just slim
with the server installed.
It will update the game server (via SteamCMD) on every container start.
Use it when you prefer slim
but your server has a slow connection to Steam.
** If you're familiar with docker build
, you could use this Dockerfile.preload
to build your own image, preloading all your files into it.
<<how-to-run-dockerful-flavor,dockerful
>> is "containerized" at best.
No SteamCMD included. Won't check update when start (so starts fast and won't stuck at connecting Steam).
If the game updates, you'll need to run a new container with an up-to-date yanwk/barotrauma-server:dockerful
image (this repo auto-builds weekly).
Certain files (including your settings, mods, submarines and campaign saves) are mounted to a docker volume for persistence.
You can set Server Name, Server Password, Server Publicity and Admin's SteamID by setting ENV variables.
Will be a mess if Barotrauma makes a break change. So short-term game is preferred.
Dockerfile.dockerful
also pre-load Mods files into image like preload
. But will try copy(no overwrite) to persistence storage on every start. Could be messy if not clean it afterwards properly.
[[prepare-your-files]]
NOTE: If you choose dockerful
, and have no mods/submarines/saves to upload, just jump to <<how-to-run-dockerful-flavor,Run dockerful>>.
.Main settings for server serversettings.xml
.All player-settings, we only need language and mods settings in it. config_player.xml
.Client permissions, mark you as the owner. Data/clientpermissions.xml
.Karma settings, don't need if not changed. Data/karmasettings.xml
Addtionally, you may want to copy:
.Mods folder (including Submarine files) LocalMods/
"%localappdata%\Daedalic Entertainment GmbH\Barotrauma\Multiplayer"
Copy these files into a convenient place.
TIP: You could also https://ignis05.github.io/baro-save-editor/[conver a singleplayer campaign to multiplayer].
config_player.xml
We only need language setting (affect bots chat, outpost names, server log, etc):
language="English"
and mods settings:
You could in theory just replace server-side config_player.xml
with your local one. Settings like graphics and sounds may not have effect on server. However it's better not doing that.
[[how-to-run-slim-flavor]]
slim
dockerful
>>.docker run
[source,sh]docker compose
[source,sh]27015/udp
& 27016/udp
is open.Note, make sure no player is in server, or just stop the server.
Upload & replace the files mentioned above. You can find them in docker volume.
If you need absolute path:
"/home/runner/Steam/steamapps/common/Barotrauma Dedicated Server"
Multiplayer campaign save:
"/home/runner/Steam/steamapps/common/Barotrauma Dedicated Server/Daedalic Entertainment GmbH/Barotrauma/Multiplayer"
Finally, restart the server in order for your changes to take effect.
.A. Using docker restart
docker restart barotrauma-server-slim
.B. Using docker compose
docker compose -f docker-compose.slim.yml restart
If you chekced "public server", you could see it on the list now.
Also, if you need to update the server, just restart it.
[[how-to-run-preload-flavor]]
preload
Same as <<how-to-run-slim-flavor,slim
>>, just replace the image tag:
docker run
[source,sh]docker compose
[source,sh][[how-to-run-dockerful-flavor]]
dockerful
docker run
[source,sh]STEAMNAME is your Steam displayed name, NOT your account.
STEAMID can be found via: https://steamid.io/
STEAMNAME and STEAMID should be used together.
docker compose
[source,sh]git clone https://github.com/YanWenKun/barotrauma-server-docker.git
The server is now good to go. Steps below are optional.
Access your docker volume, there are four subfolders. Upload to them accordingly:
[cols=2] |=== |Folder Name |Description
|configs |Server Settings
|mods |Same as LocalMods/ Folder (including submarines)
|multiplayer-saves |Multiplayer Campaign Save
|===
You may want to check <<prepare-your-files,file list>>.
[[restart-dockerful]]
You need to restart the server for changes to take effect.
You can restart the container, or just create a new one:
docker rm --force barotrauma-server-dockerful
Just set ENV variables and start a new container:
docker rm --force barotrauma-server-dockerful
If you use Docker Compose, just edit the Compose file.
After you force-updated new settings, it's better to <<restart-dockerful,start a new container (again) without ENV variables>> to avoid accidental overwrite in future.
[[build-your-own]]
In this ultimate way, you build your own docker image pre-loaded with all settings, mods, submarines and saves. This could be useful if you don't have access to your container's volume. But you still need to find a way to backup your saves.
NOTE: Update files in docker image won't affect volume. If you need to update mods on server frequently, you may want to edit Dockerfile.preload or Dockerfile.dockerful to meet your own needs (Focus on config_player.xml and LocalMods/ ).
Clone this repo
git clone https://github.com/YanWenKun/barotrauma-server-docker.git
<<prepare-your-files,Prepare your files>>.
Replace the files in link:preloads/[preloads/]
Build & Run
A. Using docker compose
(edit docker-compose.preload.yml
)
docker compose --file docker-compose.preload.yml up --build
B. Using docker build
and docker run
Since the Dockerfile here is using CMD as entry, you can easily override it, like:
This will start a container in root bash without starting the server.
Check link:docs/Dockerfile.exmaple[Dockerfile.exmaple].
$STEAMAPPID
, $GAMEDIR
and DedicatedServerApp
. link:docs/submarine-whale.svg[This image] is derived from https://www.maxpixel.net/Sperm-Whale-Valentines-Day-Wal-Heart-Blast-600387[here] and https://www.svgrepo.com/svg/193183/submarine[here] with https://creativecommons.org/publicdomain/zero/1.0/[CC0].
Source code under link:LICENSE[MIT License].