Jump to content

Native Linux server (with management scripts)


Alloc

Recommended Posts

Anyone have a version of this for Windows Server?

I suppose someone could write some batch files to do something similar for Windows. The problem is that Windows would likely find a way to screw it up, and there is a lot of variation between builds. (Unlike Linux)

 

Maybe some powershell scripts could do it. Most likely you'd want to end up designing a whole GUI for it.

 

I have some ideas for using Excel, Macros, and Powershell to automate some tasks for setting up and configuring instances on Windows. I could even develop a basic GUI for installing and updating the server. I don't have any time to work on them though.

Link to comment
Share on other sites

  • 2 weeks later...
Anyone have a version of this for Windows Server?

Well....technically yes. Install Oracle VirtualBox on the Windows Server, install Ubuntu Server 16.04 LTS and enjoy. ;-)

 

Here is how I install a Ubuntu Server (long-living production-quality). Steps are pretty-much the same if installing under VMware or VirtualBox now that the virtualization tools are built into the install process.

 

LHammonds

Edited by LHammonds
Added install link (see edit history)
Link to comment
Share on other sites

Right now there is Alpha 16 b1 running on my server. I want to deploy another instance for example with Alpha 15.2 or Alpha 16 b1 modded. How do I do this? There is only one 'engine' folder, where the 7dtd files/mods are stored.

Hmmm...that is a good question. Sure would be nice if Alloc's script could handle that but I know it is designed for a single engine with multiple instances...so if you modify XML of the engine, it affects all instances.

 

I'll see if I can figure out the best way to setup a single server that can host multiple modded engines using Alloc's fixes...and then post back here with my documentation on how to do the same for yourself.

 

I look into setting up the following:

 

- vanilla engine (no mods), Navezgane map on port 25000, RandomGen map on port 25010

- modded engine, ValMod Overhaul + Compopack, Navezgane map on port 25020, RandomGen map onport 25030

 

EDIT #1: Looking good so far. I have 2 engines installed in different folders. Still need to create instances and test but I have to go for now. Will publish dox after testing.

 

EDIT #2: Went to install the serverfixes and it only worked for the 1st server. So either it won't work or I missed editing a file somewhere or need to manually install the fixes rather than using the management script.

 

EDIT #3: Here is a copy of my notes so far. They are no way to be considered a "tutorial" at the moment. Once I get all the steps figured out, I'll create an actual tutorial people can follow.

 

EDIT #4: Success! I now have 2 separate engines running on the same server. One vanilla, one modded. Each has two instances running Navezgane and RandomGen and all of them have their own web server map running.

 

LHammonds

Edited by LHammonds
Update (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
Hmmm...that is a good question. Sure would be nice if Alloc's script could handle that but I know it is designed for a single engine with multiple instances...so if you modify XML of the engine, it affects all instances.

 

I'll see if I can figure out the best way to setup a single server that can host multiple modded engines using Alloc's fixes...and then post back here with my documentation on how to do the same for yourself.

 

I look into setting up the following:

 

- vanilla engine (no mods), Navezgane map on port 25000, RandomGen map on port 25010

- modded engine, ValMod Overhaul + Compopack, Navezgane map on port 25020, RandomGen map onport 25030

 

EDIT #1: Looking good so far. I have 2 engines installed in different folders. Still need to create instances and test but I have to go for now. Will publish dox after testing.

 

EDIT #2: Went to install the serverfixes and it only worked for the 1st server. So either it won't work or I missed editing a file somewhere or need to manually install the fixes rather than using the management script.

 

EDIT #3: Here is a copy of my notes so far. They are no way to be considered a "tutorial" at the moment. Once I get all the steps figured out, I'll create an actual tutorial people can follow.

 

EDIT #4: Success! I now have 2 separate engines running on the same server. One vanilla, one modded. Each has two instances running Navezgane and RandomGen and all of them have their own web server map running.

 

LHammonds

 

Are you making an install script for this? I would be interested in knowning/being able to set up a 2nd 7d dedi isntance on my linux vm.

Link to comment
Share on other sites

Are you making an install script for this?

No sir. If I wrote an install script, it would likely only work for this one specific version and only in the exact way I would set it up. Since this is something VERY few people would do, I'd kinda be wasting my time doing it. This was more of an exercise in seeing if I could do it. But in a real-world scenario, I'd rather not maintain manual installs like this. I'd much rather just have a 2nd instance of the server running so that my "vanilla" server could be mostly hands-free when it comes to running and updating it. The modded server will still need to be manually updated with the mods but at least the upgrade process of the game engine would still be handled by alloc's scripts making it less complicated.

 

The notes I made should help you with a 2nd, 3rd, etc. instance though.

 

Keep in mind that there is no RAM/CPU performance gains having multiple engines on the same server...it will still consume every bit as much RAM/CPU for each version of the engine you are running as if it were running individually. Meaning, if each server engine needs 6 GB to run smoothly, you will need at least 12 GB for two running, or at least 18 GB for three, etc.

 

LHammonds

 

EDIT 1: Could have swore there was another script conversation going on. I must be going senile in my old age.

EDIT 2: Yep, senile. Was a different thread.

Edited by LHammonds (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
Interesting.. For a week I tried and was told I had a version mismatch, with no updates being reported available by the script. I did a force update and now it allows me to connect.

What version of the scripts are you running? What version was the server? What operating system is the scripts running on?

 

I did not have an issue running "7dtd.sh upgradeengine" when going from 16.2 to 16.3.

 

LHammonds

Link to comment
Share on other sites

What version of the scripts are you running? What version was the server? What operating system is the scripts running on?

 

I did not have an issue running "7dtd.sh upgradeengine" when going from 16.2 to 16.3.

 

LHammonds

 

Version: 110

Release: 2017-08-26

 

Not sure how to give you more version information than that. It is running on Ubuntu 16.04.2.

engine/fixes/scripts all reported I had the latest version. Running updateengine a 2nd time showed a different (lower) ID than I had installed, so at first I just let it be. Eventually I gave it the force option and whatever it did then allowed me to connect again from the game without the mismatched version error. It was working fine prior to A16-3. I installed it clean with A16-1.

Link to comment
Share on other sites

  • 1 month later...
@Alloc: Is it possible to fully render a rwg map with the 'rendermap' command? I mean not just the parts the player already visited but the whole map.

 

This wasn't doable in the past, not sure if anything changed, but, it wasn't doable because the regions don't load until a player has entered them for the first time. Given the way we can do a map preview, it seems possible.

Link to comment
Share on other sites

Well, if the world was started with the mod already in you can simply use the game's visitmap command. If the world was started before adding the mod than the world might have areas explored that aren't yet on the map and those would most likely not be added with visitmap alone (not sure right now though), in that case you'd have to run rendermap afterwards but that would take a loooot of time then.

Link to comment
Share on other sites

  • 3 weeks later...

Restart scripts that work with Linux management scripts?

 

Aloha, im having alittle trouble restarting my server i have to do it manually, one of my server managers restarts the server but serverside nothing starts it back up in the management scripts automatically, are there any scripts made to restart a certain instance anywhere?

Link to comment
Share on other sites

You could set a cron job that runs periodically to start them back up again.

 

I think the crontab text would be like...

5  *  *  *  * sdtd  7dtd.sh start "!"

 

That should have cron start all instances every 5 minutes. If they are already up, nothing happens.

You could set up a task to see if they are up, and do nothing if they are. Then run the startup command if they are not. Then set that task to be run by cron. That's beyond my current ability though.

Link to comment
Share on other sites

You could set a cron job that runs periodically to start them back up again.

 

I think the crontab text would be like...

5  *  *  *  * sdtd  7dtd.sh start "!"

 

That should have cron start all instances every 5 minutes. If they are already up, nothing happens.

You could set up a task to see if they are up, and do nothing if they are. Then run the startup command if they are not. Then set that task to be run by cron. That's beyond my current ability though.

 

i should be able to use root's crontab -e and paste that in there and should work right? having alittle issue with crontab not starting it

Link to comment
Share on other sites

i should be able to use root's crontab -e and paste that in there and should work right? having alittle issue with crontab not starting it

If you do "sudo su" to switch into the root, doing "crontab -e" should show you the root crontab schedule.

 

If you are having problems with scripts not running in the schedule, it might be due to the reduced environment (not having a search path to find programs when the full path is not explicit). Try adding the following in root's crontab schedule:

 

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#
# Crontab SYNTAX:
# minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-6) command-to-execute
#
5  *  *  *  * /usr/local/bin/7dtd.sh start "!"

 

NOTE: You didn't include a full path to where 7dtd.sh was located which means the root crontab simply could not execute it because the default schedule does not have a search path environment variable defined. You could specify the full path like I did but if there are any programs in the script that do not explicitly specify the full path, they would also fail. Having the environment path variable defined helps prevent failure like this but also increases the security risk for hijacked commands but it is a low risk.

 

Reference Post

 

LHammonds

Edited by LHammonds (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

Alloc, if I want to "nice" the server so it runs at higher priority, what would be the best way to do that using your scripts?

 

UPDATE: I ended up slapping this together and having cron run it every 15 minutes...seems to work, but my bash scripting is pretty bad. :smile-new:

 

#!/bin/bash

############################################################################
# 7DTD Renice Script by The Hated Crew                                     #
# Call with cron on an interval you choose.                                #
# Script must be run as root user.                                         #
############################################################################

SDTDPIDFILE=/opt/sdtd/instances/THC/7dtd.pid
SDTDNICEVALUE=-15

#Check to see if the PID file exists, if so, read PID into $sdtdpid variable.
if [ -f $SDTDPIDFILE ]; then
       sdtdpid=$(cat $SDTDPIDFILE)
#Check to make sure the PID is actually running, if so, capture nice value of PID.
       if [ -e /proc/$sdtdpid ]; then
               sdtdniceval=$(ps --no-heading -p $sdtdpid -o "ni")
#If nice value isn't set then run the renice command.
               if [ $sdtdniceval -ne $SDTDNICEVALUE ]; then
                       renice -n $SDTDNICEVALUE -p $sdtdpid
               fi
       else
               echo "7DTD server PID file exists but server isn't running."
       fi
else
       echo "7DTD PID file doesn't exist, so server is probably not running."
fi

Edited by The Hated Crew (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...