Skip to content

2. Docker Setup

If you have any trouble following the guide. Please send us a message in Discord we are more than happy to help you out!

2.1 Requirements and Pre-requisites

  • GIT installed in your system;
  • GIT LFS installed in your system;
  • Docker and Docker-Compose installed in your system;
  • Broadband internet connection;
  • Router with the ability to port forward;
  • Min. 2 GB RAM;
  • Min. 64-bit Linux Operating System.

2.2 System Setup

2.2.1 Installing GIT and GIT Large file system

.pak files are large and we need to install Git Lfs in order to download them

Run the following commands according to your chosen system:

Ubuntu/Debian
sudo apt update
sudo apt install git git-lfs
Arch-Linux
sudo pacman -Sy
sudo pacman -S git git-lfs
Fedora
sudo yum update
sudo yum install git git-lfs

2.2.2 Installing Docker

Ubuntu/Debian

Begin by adding dependencies needed by the installation process:

sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

Begin by adding dependencies needed by the installation process:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Begin by adding dependencies needed by the installation process:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Now you can install Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io

Start and enable docker service:

sudo systemctl start docker && sudo systemctl enable docker

Add your user account to the docker group:

sudo usermod -aG docker $USER
newgrp docker
Fedora

Add Docker’s package repository:

sudo dnf -y install yum-utils device-mapper-persistent-data lvm2 dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

Install Docker:

sudo dnf install docker-ce docker-ce-cli containerd.io

Start and enable docker service:

sudo systemctl start docker && sudo systemctl enable docker

Add your user account to the docker group:

sudo usermod -aG docker $USER
newgrp docker
Arch Linux

Install Docker using an AUR-Helper:

sudo paru -S --noconfirm --needed docker

Add your user account to the docker group:

sudo usermod -aG docker $USER
newgrp docker

2.3 Port-forwarding and Firewalls

If you are running this in your home network it will be necessary to do port forwarding or open ports in your firewall. For port forwarding instructions, please refer to the information/documentation provided by your ISP or router/modem manufacturer.

For opening ports in your linux machine use the following depending on the firewall software you are using:

Warning

In other tutorials it is asked to open the TCP Port 7777, do not do it. Unreal Engine doesn't use TCP connections - you would be leaving a unused port open by doing so!

IPTables

sudo iptables -I INPUT -p udp --dport 7777 -j ACCEPT
sudo iptables -I INPUT -p udp --dport 27016 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 27016 -j ACCEPT
sudo iptables -I INPUT -p udp --dport 27015 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 27015 -j ACCEPT

Uncomplicated Firewall (UFW)

sudo ufw allow 7777/udp
sudo ufw allow 27016
sudo ufw allow 27015

2.4 Setting up the container

2.4.1 Downloading the container

Downloading the container can be done by either using git (recommended), or by clicking the green Code button on this page and using the Download ZIP option on the Docker Image Github. To download the container configuration using git, use the command below

git clone https://github.com/tvandoorn/longvinter-docker-server.git

2.4.2 Creating the data directory

In order to keep game progress between container restarts a data directory needs to be created. Create this directory in the same directory as the docker-compose.yaml file. Use the following commands to create the directory and set the appropriate rights.

mkdir data
chown -R 1200:1200 data/

2.4.3 Configuring the server settings

The server settings can be changed by opening the docker-compose.yaml file. Settings that may be changed are shown below:

Setting name Used for Default value
CFG_SERVER_NAME Setting the server name that is displayed in the server list. Unnamed Island
CFG_MAX_PLAYERS The maximum amount of players the server will allow at the same time. 32
CFG_SERVER_MOTD A Message Of The Day that will be displayed to the player. Welcome to Longvinter Island!
CFG_PASSWORD Use this setting to require a password to join the server. (empty)
CFG_COMMUNITY_WEBSITE When the server or community has a website, enter it here to display it to the player. www.longvinter.com
CFG_ADMIN_STEAM_ID Add the SteamID64 values for the players that have admin rights to this setting. When there are multiple admins, add the SteamID64 values to this setting separated by a space. (empty)
CFG_ENABLE_PVP When this setting is set to "true", PvP will be enabled on the server. Set to "false" to disable PvP. true
CFG_GAME_PORT This setting is used to change the game port when multiple servers are running on the same (public) IP address. When changing this setting, make sure to also change the port number under the ports section of the docker-compose.yaml file. 7777
CFG_QUERY_PORT This setting is used to change the query port when multiple servers are running on the same (public) IP address. When changing this setting, make sure to also change the port number under the ports section of the docker-compose.yaml file. 27016

With the default values above, the environment part of the docker-compose.yaml file should look like this:

  environment:
    CFG_SERVER_NAME: "Unnamed Island"
    CFG_MAX_PLAYERS: "32"
    CFG_SERVER_MOTD: "Welcome to Longvinter Island!"
    CFG_PASSWORD: ""
    CFG_COMMUNITY_WEBSITE: "www.longvinter.com"
    CFG_ADMIN_STEAM_ID: ""
    CFG_ENABLE_PVP: "true"
    CFG_GAME_PORT: "7777"
    CFG_QUERY_PORT: "27016"

2.4.4 Changing the port numbers

In order to run the server with different port numbers than the default ports 7777 and 27016, the new port numbers have to be edited in two places in the docker-compose.yaml file.

  ports:
    - "7777:7777"
    - "27016:27016"
  environment:
    CFG_GAME_PORT: "7777"
    CFG_QUERY_PORT: "27016"

Note

Even though changing the ports is possible, it is currently not supported by the game!

2.5 Starting the container

When the setup and configuration is done, the container is ready to be started. Open the command line and navigate to the directory (using the cd command) that contains the Dockerfile, docker-compose.yaml and run.sh files.

Start the container using the following command:

docker-compose up -d

This command will do the following:

  1. Build the container image (if not present)
  2. Create the container
  3. Start the container
  4. Run the included startup script (run.sh) inside the container
  5. Clone or update the longvinter-linux-server repository
  6. Create or update the Game.ini file with the settings provided in the docker-compose.yaml file
  7. Start the Longvinter server

2.6 Stopping the container

To stop the container, run the command below. Note that this removes the container from Docker, but the save data will be saved in the data directory and will be loaded when the server is started again next time.

docker-compose down

2.7 Updating the container

When a new version of the container is released, make sure to update the files using git pull, or manually update the files by downloading the code as ZIP from Github. Run the command below to build the new container image and restart the container.

docker-compose up -d --build
Note that these commands have to be run from the same directory as the Dockerfile, docker-compose.yaml and run.sh files.

2.8 Updating the Longvinter server

Updating the Longvinter server is as easy as restarting the container:

docker-compose restart

2.9 Running multiple Longvinter containers on one Docker server

Running multiple Longvinter containers on one Docker server is very easy. Follow the Setting up the container steps again, but this time set up the server to use a different directory for the new server.

git clone https://github.com/tvandoorn/longvinter-docker-server.git new-name-here
The command above will download the container files in a directory named new-name-here. Make sure to change the server ports using the Changing the port numbers step.

Note

This works in theory but, remember, that even though changing the ports is possible, it is currently not supported by the game!


Last update: 2022-11-29
Created: 2022-11-29