-
-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
we will create a new user for the bot and the gameserver, creating their own home-directory and adding them to the sudoers group, then taking steps to make the shell look good (optional)!
sudo useradd -m -d /opt/pve_cw pve_cw
sudo passwd pve_cw
sudo nano -w /etc/sudoers.d/pve_cw
pve_cw ALL=(ALL:ALL) NOPASSWD:ALL
sudo chmod 0440 /etc/sudoers.d/pve_cw
sudo cp /root/.bashrc /opt/pve_cw
sudo chown pve_cw:pve_cw /opt/pve_cw/.bashrc
If it ain't looking good now, you might need to add the standard shell to your /etc/passwd file. Find your user and take care that it ends like this one:
sudo nano -w /etc/passwd
pve_cw:x:1000:1000:PvE Chrani World Administrator:/opt/pve_cw:/bin/bash
we will become our new user, download steamcmd, create a directory for it, not arguing if it already exists (-p) and then extract steamcmd into it. we will then remove the steamcmd archive
su - pve_cw
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz
mkdir -p steamcmd && tar xvzf steamcmd_linux.tar.gz -C ./steamcmd/
rm steamcmd_linux.tar.gz
mkdir -p 7dtd_a18
./steamcmd/steamcmd.sh
login anonymous
force_install_dir /opt/pve_cw/7dtd_a18
app_update 294420 validate
quit
mkdir -p 7dtd_a18_UserData 7dtd_a18_SaveGames 7dtd_a18_Logs
cp 7dtd_a18/serverconfig.xml 7dtd_a18_SaveGames/pve_cw_xxxxxxxx.xml
GameName must NOT contain any spaces! The bot will not work correctly with spaces in GameName
nano -w 7dtd_a18_SaveGames/pve_cw_xxxxxxxx.xml
<property name="TelnetPort" value="26902"/> <property name="TelnetPassword" value="supersecret"/>
<property name="AdminFileName" value="pve_cw_admin.xml"/>
<property name="UserDataFolder" value="/opt/pve_cw/7dtd_a18_UserData" />
<property name="SaveGameFolder" value="/opt/pve_cw/7dtd_a18_SaveGames" />
<property name="GameName" value="pve_cw_xxxxxxxx" />
tmux new-session -s pve_cw
CTRL+b followed by , -> rename current window to chrani-bot-tng
git clone https://github.com/wwevo/chrani-bot-tng.git
cd chrani-bot-tng && git pull origin development && cd ..
python -m venv cb-tng-venv
source cb-tng-venv/bin/activate
pip install --upgrade pip
pip install -r chrani-bot-tng/requirements.txt
host would be your IP address, or if the bot is on the same machine, localhost
port + password is what you have set up in your 7dtd serverconfig
chrani-bot-tng/bot/options/module_telnet.json
{
"host": "127.0.0.1",
"port": 26902,
"password": "supersecret"
}
You might want to set the telnet buffer to a higher value if you have a high-pop server or are using mods like Darkness Falls. the standard 16k is too small for extensive amount of entities
"max_telnet_buffer": 32768
host would be your servers public IP address port and secret-key can be whatever you feel is clever
chrani-bot-tng/bot/options/module_webserver.json
{
"host": "YOUR PUBLIC SERVER IP",
"port": 26905,
"Flask_secret_key": "whateverisclever"
}
With those two files in place and some sensible data to populate them, the bot should start up and provide it's webinterface and should start listening to the games telnet.
CTRL+b followed by c -> creates new window CTRL+b followed by w -> opens window selection select the new window
CTRL+b followed by , -> rename window to 7dtd_a18
7dtd_a18/startserver.sh -configfile=/opt/pve_cw/7dtd_a18_SaveGames/pve_cw_xxxxxxxx.xml
CTRL+b followed by w -> opens window selection select chrani-bot-tng window
python /opt/pve_cw/chrani-bot-tng/app.py
CTRL+b followed by d -> exit tmux
exit
To get back to our shell, all we have to do is to log in as our pve_cw user and get tmux back with
tmux attach
nano -w 7dtd_a18/startserver_loop.sh
#!/bin/bash
export LD_LIBRARY_PATH=/opt/pve_cw/7dtd_a18count=1
printf "%s\n\n" "starting infinite serverloop"while true
do
printf "%s\n\n" "current-loop = $count"
7dtd_a18/7DaysToDieServer.x86_64 -logfile /opt/pve_cw/7dtd_a18_Logs/pve_cw_xxxxxxxx_`date +%Y-%m-%d_%H-%M-%S`.txt -quit -batchmode -nographics -dedicated -configfile=/opt/pve_cw/7dtd_a18_SaveGames/pve_cw_xxxxxxxx.xml
printf "%s\n\n" "waiting for server to settle down"
sleep 10
count=$((count + 1))
done
7dtd_a18/startserver_loop.sh
nothing much here for now. You could always open up another tmux window and run a tail on the latest logs
tail -f -- "$(find ./7dtd_a18_Logs/ -maxdepth 1 -type f -printf '%T@.%p\0' | sort -znr -t. -k1,2 | while IFS= read -r -d '' -r record ; do printf '%s' "$record" | cut -d. -f3- ; break ; done)"