TEMP - Multiple engines on same server

Post Reply
User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

TEMP - Multiple engines on same server

Post by LHammonds » Wed Aug 23, 2017 12:57 am

This is a temporary placeholder for my notes as I figure out how to do this correctly and turn it into a useful tutorial.


Goals:

Create vanilla engine
  • User Account: sdtdvan
  • User Group: sdtd
  • Server Path: /opt/sdtdvan/
  • Mods to install: None
  • Backup location: /bak/sdtdvan/
Instance #1
  • Name: vannav
  • Map: Navezgane
  • Base Port: 25000
  • Control Panel Port: 8080
  • Telnet Port: 8081
  • Web Port: 8082 (automatically set to control panel port +2)
Instance #2
  • name: vanrand
  • Map: RandomGen
  • Base Port: 25010
  • Control Panel Port: 8090
  • Telnet Port: 8091
  • Web Port: 8092 (automatically set to control panel port +2)
Create modded engine
  • User Account: sdtdmod
  • User Group: sdtd
  • Server Path: /opt/sdtdmod/
  • Mods to install: ValMod Overhaul, Compopack
  • Backup location: /bak/sdtdmod/
Instance #1
  • Name: modnav
  • Map: Navezgane
  • Base Port: 25020
  • Control Panel Port: 8100
  • Telnet Port: 8101
  • Web Port: 8102 (automatically set to control panel port +2)
Instance #2
  • Name: modrand
  • Map: RandomGen
  • Base Port: 25030
  • Control Panel Port: 8110
  • Telnet Port: 8111
  • Web Port: 8112 (automatically set to control panel port +2)
References
* Alloc's server management scripts wiki
* Alloc's server fixes
* Official 7dtd forums - Original post

User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

Ubuntu Server Install

Post by LHammonds » Wed Aug 23, 2017 12:58 am

I will assume you built an Ubuntu Server according to these instructions.

You don't need to do all the scripting and automation sections but should at least have the LVM partitions configured so they can grow where needed such as the /opt and /bak volumes.

User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

Operating System Preparation

Post by LHammonds » Wed Aug 23, 2017 1:00 am

# Used to compile start daemon

Code: Select all

apt-get install gcc
# Used to manipulate serverconfig.xml

Code: Select all

apt-get install xmlstarlet
# 32-bit library

Code: Select all

apt-get install lib32stdc++6
# Required by SteamCmd (might be included with lib32stdc++6)

Code: Select all

apt-get install lib32gcc1

Code: Select all

mkdir -p /opt/sdtdvan/templates
mkdir -p /opt/sdtdmod/templates
# create new group account

Code: Select all

groupadd -r sdtd
# create new user accounts

Code: Select all

useradd --comment "7 days to Die Server" -d /opt/sdtdvan -m -r -s /bin/bash -g sdtd sdtdvan
useradd --comment "7 days to Die Server" -d /opt/sdtdmod -m -r -s /bin/bash -g sdtd sdtdmod

Code: Select all

chown sdtdvan:sdtd -R /opt/sdtdvan
chown sdtdmod:sdtd -R /opt/sdtdmod

User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

Game Engine, Instances, Mods

Post by LHammonds » Wed Aug 23, 2017 1:02 am

Code: Select all

mkdir /tmp/t
cd /tmp/t
wget http://illy.bz/fi/7dtd/management_scripts.tar.gz
tar xvzf management_scripts.tar.gz

Code: Select all

vi /tmp/t/etc/7dtd.conf
Line 19: export SDTD_BASE=/opt/sdtdvan
Line 25: export SDTD_BACKUP_ROOT=/bak/sdtdvan
Line 34: export SDTD_USER=sdtdvan

Code: Select all

cp /tmp/t/etc/7dtd.conf /tmp/t/etc/7dtdmod.conf
Line 19: export SDTD_BASE=/opt/sdtdmod
Line 25: export SDTD_BACKUP_ROOT=/bak/sdtdmod
Line 34: export SDTD_USER=sdtdmod

Code: Select all

cp /tmp/t/etc/init.d/7dtd.sh /tmp/t/etc/init.d/7dtdmod.sh
Line 32: /usr/local/bin/7dtdmod.sh start "!"
Line 35: /usr/local/bin/7dtdmod.sh kill "!"
Line 38: /usr/local/bin/7dtdmod.sh instances

Code: Select all

cp /tmp/t/etc/cron.d/7dtd-backup /tmp/t/etc/cron.d/7dtdmod-backup
Line 1: #0 * * * * root nice -n 15 /usr/local/bin/7dtdmod.sh backup

Code: Select all

cp /tmp/t/etc/bash_completion.d/7dtd /tmp/t/etc/bash_completion.d/7dtdmod
Line 3: . /usr/local/lib/7dtd/commonmod.sh
Line 27: complete -F _sdtd 7dtdmod.sh

Code: Select all

cp /tmp/t/usr/local/bin/7dtd.sh /tmp/t/usr/local/bin/7dtdmod.sh
Line 18: . /usr/local/lib/7dtd/commonmod.sh

Code: Select all

cp /tmp/t/usr/local/lib/common.sh /tmp/t/usr/local/lib/commonmod.sh
Line 26: . /etc/7dtdmod.conf

Copy files to their final destination

Code: Select all

chown root:root -R /tmp/t/*
chmod 0600 /tmp/t/etc/*
cp -R /tmp/t/etc/* /etc/.
cp -R /tmp/t/usr/* /usr/.
cp /tmp/t/home/sdtd/templates/* /opt/sdtdvan/templates/.
cp /tmp/t/home/sdtd/templates/* /opt/sdtdmod/templates/.
chown sdtdvan:sdtd -R /opt/sdtdvan
chown sdtdmod:sdtd -R /opt/sdtdmod
Compile the daemon

Code: Select all

cd /usr/local/lib/7dtd/start-stop-daemon
make
Uninstall the compiler

Code: Select all

apt-get remove gcc
Install the game engines

Code: Select all

7dtd.sh updateengine
7dtdmod.sh updateengine
Install Alloc's server fixes

Code: Select all

mkdir /tmp/sf
cd /tmp/sf
wget http://illy.bz/fi/7dtd/server_fixes.tar.gz
tar xvzf server_fixes.tar.gz
cp -R /tmp/sf/Mods /opt/sdtdvan/engine/.
cp -R /tmp/sf/Mods /opt/sdtdmod/engine/.
chown -R sdtdvan:sdtd /opt/sdtdvan/*
chown -R sdtdmod:sdtd /opt/sdtdmod/*
Create the vanilla Navezgane game instances

Code: Select all

7dtd.sh instances create
Answer the questions however you like but make sure the following are set as follows to avoid conflicts with the other instances:
  • Instance name: vannav
  • Base port 25000
  • Control panel port: 8080
  • Telnet port: 8081
Create the vanilla RandomGen game instances

Code: Select all

7dtd.sh instances create
Answer the questions however you like but make sure the following are set as follows to avoid conflicts with the other instances:
  • Instance name: vanrand
  • Base port 25010
  • Control panel port: 8090
  • Telnet port: 8091
Create the modded Navezgane game instances

Code: Select all

7dtdmod.sh instances create
Answer the questions however you like but make sure the following are set as follows to avoid conflicts with the other instances:
  • Instance name: modnav
  • Base port 25020
  • Control panel port: 8100
  • Telnet port: 8101
Create the modded RandomGen game instances

Code: Select all

7dtdmod.sh instances create
Answer the questions however you like but make sure the following are set as follows to avoid conflicts with the other instances:
  • Instance name: modrand
  • Base port 25030
  • Control panel port: 8110
  • Telnet port: 8111
Install ValMod Overhaul mod
Download mod here
Extract archive
Config folder on server is /opt/sdtdmod/engine/Data/Config
Prefabs folder on server is /opt/sdtdmod/engine/Data/Prefabs

Install the Compopack mod
Download mod here
Extract archive
Config folder on server is /opt/sdtdmod/engine/Data/Config
Prefabs folder on server is /opt/sdtdmod/engine/Data/Prefabs

Make the web map visible

Code: Select all

vi /opt/sdtdvan/instances/vannav/webpermissions.xml
Line 13: <permission module="web.map" permission_level="1000" />

Code: Select all

vi /opt/sdtdvan/instances/vanrand/webpermissions.xml
Line 13: <permission module="web.map" permission_level="1000" />

Code: Select all

vi /opt/sdtdmod/instances/modnav/webpermissions.xml
Line 13: <permission module="web.map" permission_level="1000" />

Code: Select all

vi /opt/sdtdmod/instances/modrand/webpermissions.xml
Line 13: <permission module="web.map" permission_level="1000" />

List of all instances before startup

Code: Select all

root@ubuntu:/opt# 7dtd.sh instances list
Instance name        | Running  | Players | Port
---------------------+----------+---------+------
vannav               |       no |    -/ 4 | 25000
vanrand              |       no |    -/ 4 | 25010

root@ubuntu:/opt# 7dtdmod.sh instances list
Instance name        | Running  | Players | Port
---------------------+----------+---------+------
modnav               |       no |    -/ 4 | 25020
modrand              |       no |    -/ 4 | 25030
Start all instances

Code: Select all

7dtd.sh start vannav
7dtd.sh start vanrand
7dtdmod.sh start modnav
7dtdmod.sh start modrand
List of all instances after startup

Code: Select all

root@ubuntu:/opt# 7dtd.sh instances list
Instance name        | Running  | Players | Port
---------------------+----------+---------+------
vannav               |      yes |    ?/ 4 | 25000
vanrand              |      yes |    ?/ 4 | 25010

root@ubuntu:/opt# 7dtdmod.sh instances list
Instance name        | Running  | Players | Port
---------------------+----------+---------+------
modnav               |      yes |    0/ 4 | 25020
modrand              |      yes |    0/ 4 | 25030
Visit each instances web map

Let's assume your server's IP is 192.168.1.100 for this example. Use a web browser and check each instances web server map:

Web map before login
7dtd-webmap1.jpg
7dtd-webmap1.jpg (28.96 KiB) Viewed 63 times

Web map after login
7dtd-webmap2.jpg
7dtd-webmap2.jpg (81.2 KiB) Viewed 63 times

User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

Firewall Rules

Post by LHammonds » Wed Aug 23, 2017 1:03 am

Raise shields! (add firewall rules)

## Reset Firewall to factory default

Code: Select all

echo y | ufw reset
ufw default deny incoming
ufw default allow outgoing
## Allow SSH from only LAN connections (set as appropriate)

Code: Select all

ufw allow from 192.168.0.0/24 to any port 22 comment 'SSH for LAN'
ufw allow from 192.168.1.0/24 to any port 22 comment 'SSH for LAN'
## Add Steam rules

Code: Select all

ufw allow proto udp to any port 27000:27015 comment 'Steam game client'
ufw allow proto tcp to any port 27000:27015 comment 'Steam game client'
ufw allow out proto udp to any port 27016:27030 comment 'Steam matchmaking'
ufw allow proto udp to any port 27031:27036 comment 'Steam in-home stream'
ufw allow proto tcp to any port 27036:27037 comment 'Steam in-home stream'
ufw allow proto tcp to any port 27015 comment 'Steam SRCDS rcon'
ufw allow out proto udp to any port 3478 comment 'Steam P2P Net / Voice'
ufw allow out proto udp to any port 4379 comment 'Steam P2P Net / Voice'
ufw allow out proto udp to any port 4380 comment 'Steam P2P Net / Voice'
## Add 7DTD rules

Code: Select all

ufw allow proto tcp to any port 25000 comment '7dtd base vannav'
ufw allow proto udp to any port 25000 comment '7dtd base vannav'
ufw allow proto udp to any port 25001:25005 comment '7dtd base+5 vannav'
ufw allow proto tcp to any port 25010 comment '7dtd base vanrand'
ufw allow proto udp to any port 25010 comment '7dtd base vanrand'
ufw allow proto udp to any port 25011:25015 comment '7dtd base+5 vanrand'
ufw allow proto tcp to any port 25020 comment '7dtd base modnav'
ufw allow proto udp to any port 25020 comment '7dtd base modnav'
ufw allow proto udp to any port 25021:25025 comment '7dtd base+5 modnav'
ufw allow proto tcp to any port 25020 comment '7dtd base modrand'
ufw allow proto udp to any port 25020 comment '7dtd base modrand'
ufw allow proto udp to any port 25021:25025 comment '7dtd base+5 modrand'
ufw allow proto tcp to any port 8082  comment '7dtd web map vannav'
ufw allow proto tcp to any port 8092  comment '7dtd web map vanrand'
ufw allow proto tcp to any port 8102  comment '7dtd web map modnav'
ufw allow proto tcp to any port 8112  comment '7dtd web map modrand'
## Enable firewall

Code: Select all

echo y | ufw enable

User avatar
LHammonds
Quality 2 - Faulty
Quality 2 - Faulty
Posts: 26
Joined: Wed Jun 07, 2017 1:31 am

Crontab Schedule

Post by LHammonds » Wed Aug 23, 2017 1:48 am

Edit the crontab schedule for the root user

Code: Select all

crontab -e -u root

Code: Select all

## Backup 7dtd vanilla engine instances
0 22 * * * /usr/local/bin/7dtd.sh backup > /dev/null 2>&1
## Backup 7dtd modded engine instances
0 22 * * * /usr/local/bin/7dtdmod.sh backup > /dev/null 2>&1
## Remove 7dtd backups older than 10 days
0 23 * * * find /bak/sdtdvan/* -type d -ctime +10 -exec rm -rf {} + > /dev/null 2>&1
0 23 * * * find /bak/sdtdmod/* -type d -ctime +10 -exec rm -rf {} + > /dev/null 2>&1
## 7dtd: Make sure the expected instances are running after a reboot.
@reboot /usr/local/bin/7dtd.sh start vannav
@reboot /usr/local/bin/7dtd.sh start vanrand
@reboot /usr/local/bin/7dtdmod.sh start modnav
@reboot /usr/local/bin/7dtdmod.sh start modrand

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest