Dedicated server

From Pavlov VR Wiki
Jump to: navigation, search

Setting up a dedicated server

There are no Windows binaries, this guide is exclusively for Ubuntu Linux.


Minimum Specs

2GB RAM
2.8Ghz CPU for a 10 player server
4.2Ghz i7 CPU for a 50 player server

Prerequisites

sudo apt update
sudo apt install -y gdb curl lib32gcc1

We need to create a user without privileges otherwise the server won't let us execute it, we also install some needed packages first.

sudo useradd -m steam
sudo su -l steam

After this you'll be logged in with the new user and your working directory will be /home/steam - this is important to remember.

Install Steam directly from Valve mirror.

mkdir ~/Steam && cd ~/Steam
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

Now that we have Steam installed we can install the Pavlov Dedicated Server app.

cd ~/Steam
./steamcmd.sh +login anonymous +force_install_dir /home/steam/pavlovserver +app_update 622970 +exit

The command above is essentially the update command too, if you run it again it will check if there's a new version and update it, keep this in mind if you're planning to create an auto-update script.

Set executable permissions, you only need to do this once.

chmod +x /home/steam/pavlovserver/PavlovServer.sh

Server Configuration

Before starting the server we need to configure it, create a file at /home/steam/pavlovserver/Pavlov/Saved/Config/LinuxServer/Game.ini and open it with your preferred text editor, Vim in this case.

mkdir -p /home/steam/pavlovserver/Pavlov/Saved/Config/LinuxServer
vim /home/steam/pavlovserver/Pavlov/Saved/Config/LinuxServer/Game.ini

Below is an example of a server config file.

[/Script/Pavlov.DedicatedServer]
bEnabled=true
ServerName="My dedicated server"
MaxPlayers=50
bSecured=true
MapRotation=(MapId="UGC1668673188")
MapRotation=(MapId="datacenter", GameMode="SND")
MapRotation=(MapId="sand", GameMode="DM")
MapRotation=(MapId="bridge", GameMode="TDM")
  • bEnabled - whether the server appears in the server list (unconfirmed)
  • ServerName - name it will be listed as. (approx 35 chars max)
  • MaxPlayers - See suggested specs for limits
  • bSecured - enabled Valve Anti-Cheat (VAC)
  • MapRotation - you can add multiple of these. The MapId must be “UGC” followed by the map ID. you can find the map id in the URL of the steam workshop page.

Available game modes as of 10th of May 2019: SND, TDM, DM, GUN.

Maps running a Custom Game Mode (TTT, BR, Duel, etc.) don't care which GameMode you chose.

Admin/Moderator list

In order to manage your server in-game, you gotta create a mods.txt with steamids on each line, optionally a comment after #

mods.txt has to be placed in Pavlov/Saved/Config/mods.txt

90000000000000111 #this is an invalid steamid

Steam ID finder: https://steamidfinder.com/lookup/


Firewall Rules

Inbound IP Range: 0.0.0.0/0

Inbound Ports:

  • 7 - UDP - ICMP - used for pinging
  • 7000 - UDP
  • 7200 - UDP
  • 7777 - UDP

Starting the server

cd /home/steam/pavlovserver
./PavlovServer.sh

That's it, your server will be automatically broadcast to the master server! :)


Hosting Providers

Google Cloud Platform

To Put A Google Cloud Server Online...

Menu -> Vpc network -> firewall rules
[Create firewall rule]
Name: pavlov server
Target Tags: pavlov-server
Source IP Ranges: 0.0.0.0/0
Protocols and Ports -> Specified protocols and ports -> UDP: 7, 7000, 7200, 7777
[save]

Menu -> compute engine -> VM instances
create instance
- region: wherever you like
- machine type: 1 vCPU
- boot disk: Ubuntu 18.04
- boot disk -> size: 50gb
- network tags: pavlov-server
- [create]

Advanced Server Administration

Running multiple servers on one host

  • Make multiple server installs by defining a separate install dir for each server.
  • Run each server with a unique port. eg: ./PavlovServer.sh -PORT="Desired Port"
  • Ensure the ports are forwarded and opened in your firewall

To duplicate directories:

be in the steam home folder

cp -R pavlovserver pavlovserver1

/home/steam/pavlovserver1/PavlovServer.sh -PORT=whatever



Supervising the server

Running ./PavlovServer.sh in your interactive shell is easy, but the server will shut down when you close your terminal. If you want to run the server in the background, you'll want to run it under a supervisor. There are many options, ranging from the simple (nohup, screen or tmux), to the more robust (supervisord, systemd).

Using Systemd

Systemd is running by default on Ubuntu Linux, so we'll use that here.

To run the server as a systemd service, create the file /etc/systemd/system/pavlovserver.service (as root) with the contents

[Unit]
Description=Pavlov VR dedicated server

[Service]
Type=simple
WorkingDirectory=/home/steam/pavlovserver
ExecStart=/home/steam/pavlovserver/PavlovServer.sh
RestartSec=30
Restart=on-failure
User=steam
Group=steam

[Install]
WantedBy = multi-user.target

Change the user or paths as appropriate. After saving the service file, to start, restart, stop, or monitor the server:

sudo systemctl start pavlovserver
sudo systemctl restart pavlovserver
sudo systemctl stop pavlovserver
sudo systemctl status pavlovserver

To view the logs:

sudo journalctl -u pavlovserver
# to live-tail the logs
sudo journalctl -u pavlovserver -f

If you want to run the pavlov server as soon as your server boots (e.g. a VPS you turn on and off), add pavlov as a startup service:

sudo systemctl enable pavlovserver

Troubleshooting

To run the server without outputting the heartbeat:

./PavlovServer.sh | sed '/heartbeat/d'

To monitor the logs (without heartbeat) from another terminal:

tail -f -n10000 /home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov.log | grep -v 'Sending heartbeat to masterserver'