arkmanager / ark-server-tools

Set of server tools used to manage ARK: Survival Evolved servers on Linux
MIT License
684 stars 144 forks source link

Setting up multiple instances #441

Closed joebywan closed 8 years ago

joebywan commented 8 years ago

I managed to get arkmanager working, and I'm trying to setup two instances, one running valhalla, the other the island.

I saw this post: https://github.com/FezVrasta/ark-server-tools/issues/201 which mostly makes sense, but the thing I'm curious about is why is there a /etc/arkmanager/instances/main.cfg if in that post you're setting up two arkmanager.cfg's?

Or is the instances folder a new thing since that post? Do I just configure the arkmanager.cfg with the generic server settings, then the main.cfg & another .cfg in the instance folder for the server specific settings?

Also how do port allocations go for additional instances on the same machine?

klightspeed commented 8 years ago

I saw this post: #201 which mostly makes sense, but the thing I'm curious about is why is there a /etc/arkmanager/instances/main.cfg if in that post you're setting up two arkmanager.cfg's?

Or is the instances folder a new thing since that post?

The instances directory is a new feature that was added some time after that issue was closed. Since then, the instance config has been completely split out to a separate config file, with only common settings being stored in arkmanager.cfg.

Do I just configure the arkmanager.cfg with the generic server settings, then the main.cfg & another .cfg in the instance folder for the server specific settings?

Yes. If you don't want a "main" instance, then its config file can be deleted, and the defaultinstance="main" line can be removed from arkmanager.cfg. It is there as a convenience for most users who only want one instance.

Also how do port allocations go for additional instances on the same machine?

You need to configure the ports in the instance configs, ensuring the different instances have different ports, and ensure each instance runs in its own arkserverroot.

joebywan commented 8 years ago

Thanks for that.

Removing the defaultinstance would just mean I'd have to specify an instance every time right? If I leave it there, then the main one I wouldn't specify, and the secondary I'd have to specify?

When specifying an alternate config at the bottom of arkmanager.cfg the name I list as configfile_ means when I use arkmanager I don't have to use the full file path, just the name right?

So configuring it like this is good/bad?

/etc/arkmanager/arkmanager.cfg

arkstChannel="master"                                               # change it to a different branch to get non-stable versions
install_bindir="/usr/local/bin"
install_libexecdir="/usr/local/libexec/arkmanager"
install_datadir="/usr/local/share/arkmanager"

# config SteamCMD
steamcmdroot="/home/steam/steamcmd"                                 # path of your steamcmd instance
steamcmdexec="steamcmd.sh"                                          # name of steamcmd executable
steamcmd_user="steam"                                               # name of the system user who own steamcmd folder
steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf"      # cache of the appinfo command
#steamlogin="anonymous"                                             # Uncomment this to specify steam login instead of using anonymous login

# config environment
arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer"        # name of ARK server executable
arkbackupdir="/home/steam/ARK-Backups"                              # path to backup directory
arkwarnminutes="5"                                                 # number of minutes to warn players when using update --warn
arkautorestartfile="ShooterGame/Saved/.autorestart"                 # path to autorestart file
arkAutoUpdateOnStart="false"                                        # set this to true if you want to always update before startup
arkBackupPreUpdate="true"                                          # set this to true if you want to perform a backup before updating
arkStagingDir="/home/steam/ARK-Staging"                            # Uncomment to enable updates to be fully downloaded before restarting the server (reduces downtime while updating)

# Options to automatically remove old backups to keep backup size in check
# Each compressed backup is generally about 1-2MB in size.
arkMaxBackupSizeMB="500"                                            # Set to automatically remove old backups when size exceeds this limit
#arkMaxBackupSizeGB="2"                                             # Uncomment this and comment the above to specify the limit in whole GB

# Update warning messages
# Modify as desired, putting the %d replacement operator where the number belongs
msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes"
msgWarnUpdateSeconds="This ARK server will shutdown for an update in %d seconds"
msgWarnRestartMinutes="This ARK server will shutdown for a restart in %d minutes"
msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds"
msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes"
msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds"

# ARK server common options - use ark_<optionname>=<value>
# comment out these values if you want to define them
# inside your GameUserSettings.ini file
#serverMap=""                                               # server map (default TheIsland)
#serverMapModId="504122600"                                         # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>)
#ark_TotalConversionMod="496735411"                                 # Uncomment this to specify a total-conversion mod
ark_RCONEnabled="True"                                              # Enable RCON Protocol
ark_ServerPassword="password"                                               # ARK server password, empty: no password required to login
ark_ServerAdminPassword="adminpassword"                               # ARK server admin password, KEEP IT SAFE!
ark_MaxPlayers="10"
#ark_GameModIds="487516323,487516324,487516325"                     # Uncomment to specify additional mods by Mod Id separated by commas
#ark_AltSaveDirectoryName="SotF"                                    # Uncomment to specify a different save directory name

# ARK server flags - use arkflag_<optionname>=true
#arkflag_OnlyAdminRejoinAsSpectator=true                            # Uncomment to only allow admins to rejoin as spectator
#arkflag_DisableDeathSpectator=true                                 # Uncomment to disable players from becoming spectators when they die

# ARK server options - i.e. for -optname=val, use arkopt_optname=val
#arkopt_StructureDestructionTag=DestroySwampSnowStructures

# config Service
logdir="/var/log/arktools"                                          # Logs path (default /var/log/arktools)

# steamdb specific
appid=376030                                                        # Linux server App ID
mod_appid=346110                                                    # App ID for mods

# Mod OS Selection
mod_branch=Windows
# Add mod-specific OS selection below:
#mod_branch_496735411=Windows

# alternate configs
# example for config name "ark1":
#configfile_ark1="/path/to/config/file"
configfile_TheIsland=/etc/arkmanager/instances/TheIsland.cfg
configfile_Valhalla=/etc/arkmanager/instances/Valhalla.cfg

#defaultinstance="main"

Now /etc/arkmanager/instances/Valhalla.cfg

# config environment
arkserverroot="/home/steam/Valhalla"                                     # path of your ARK server files (default ~/ARK)

# ARK server options - use ark_<optionname>=<value>
# comment out these values if you want to define them
# inside your GameUserSettings.ini file
serverMap="Valhalla"                                               # server map (default TheIsland)
serverMapModId="504122600"                                         # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>)
#ark_TotalConversionMod="496735411"                                 # Uncomment this to specify a total-conversion mod
ark_RCONEnabled="True"                                              # Enable RCON Protocol
ark_RCONPort="32330"                                                # RCON Port
ark_SessionName="Valhalla"                                  # if your session name needs special characters please use the .ini instead
ark_Port="7779"                                                     # ARK server port (default 7778)
ark_QueryPort="28015"                                               # ARK query port (default 27015)
#ark_ServerPassword=""                                               # ARK server password, empty: no password required to login
#ark_ServerAdminPassword=""                               # ARK server admin password, KEEP IT SAFE!
#ark_MaxPlayers="70"
#ark_GameModIds="487516323,487516324,487516325"                     # Uncomment to specify additional mods by Mod Id separated by commas
#ark_AltSaveDirectoryName="SotF"                                    # Uncomment to specify a different save directory name

# ARK server flags - use arkflag_<optionname>=true
#arkflag_OnlyAdminRejoinAsSpectator=true                            # Uncomment to only allow admins to rejoin as spectator
#arkflag_DisableDeathSpectator=true                                 # Uncomment to disable players from becoming spectators when they die

# ARK server options - i.e. for -optname=val, use arkopt_optname=val
#arkopt_StructureDestructionTag=DestroySwampSnowStructures

and lastly /etc/arkmanager/instances/TheIsland.cfg

# config environment
arkserverroot="/home/steam/TheIsland"                                     # path of your ARK server files (default ~/ARK)

# ARK server options - use ark_<optionname>=<value>
# comment out these values if you want to define them
# inside your GameUserSettings.ini file
serverMap="TheIsland"                                               # server map (default TheIsland)
#serverMapModId="504122600"                                         # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>)
#ark_TotalConversionMod="496735411"                                 # Uncomment this to specify a total-conversion mod
ark_RCONEnabled="True"                                              # Enable RCON Protocol
ark_RCONPort="32331"                                                # RCON Port
ark_SessionName="TheIsland"                                  # if your session name needs special characters please use the .ini instead
ark_Port="7780"                                                     # ARK server port (default 7778)
ark_QueryPort="28016"                                               # ARK query port (default 27015)
#ark_ServerPassword=""                                               # ARK server password, empty: no password required to login
#ark_ServerAdminPassword=""                               # ARK server admin password, KEEP IT SAFE!
#ark_MaxPlayers="70"
#ark_GameModIds="487516323,487516324,487516325"                     # Uncomment to specify additional mods by Mod Id separated by commas
#ark_AltSaveDirectoryName="SotF"                                    # Uncomment to specify a different save directory name

# ARK server flags - use arkflag_<optionname>=true
#arkflag_OnlyAdminRejoinAsSpectator=true                            # Uncomment to only allow admins to rejoin as spectator
#arkflag_DisableDeathSpectator=true                                 # Uncomment to disable players from becoming spectators when they die

# ARK server options - i.e. for -optname=val, use arkopt_optname=val
#arkopt_StructureDestructionTag=DestroySwampSnowStructures

So if I'm interpreting it correctly, I've got two copies of the server at /home/steam/TheIsland & /home/steam/Valhalla.

The arkmanager.cfg is setting both servers to have a password of "password", admin password is "adminpassword", max players of 10 & setting taming speed, difficulty, gamma settings, third person & notifications of players joining and leaving.

Then the seperate instance cfg's are setting the ports for RCON, QueryPort & Port aswell as the names & for valhalla the map mod ID.

Then to administer each of the servers, I just type arkmanager TheIsland or Valhalla then the command?

One thing I've not been able to find documentation on is how to set the servers to auto start with the machine booting up? This is on ubuntu 14.04, so using upstart not systemd.

klightspeed commented 8 years ago

Removing the defaultinstance would just mean I'd have to specify an instance every time right? If I leave it there, then the main one I wouldn't specify, and the secondary I'd have to specify?

The defaultinstance setting just sets which instance to execute a command on if no instance is specified. Without the defaultinstance setting, yes you need to specify which instance to execute the command on, as otherwise it will ask if you want to execute the command on all instances.

When specifying an alternate config at the bottom of arkmanager.cfg the name I list as configfile_ means when I use arkmanager I don't have to use the full file path, just the name right?

If the instance configs are in /etc/arkmanager/instances, then you don't need the configfile_xxx=... settings. If you do specify the configfile_xxx=... settings, these must each specify the full path to the instance config file.

configs

Until #438 is merged, you probably want to change serverMapModId="504122600" to ark_MapModID="504122600".

So if I'm interpreting it correctly, I've got two copies of the server at /home/steam/TheIsland & /home/steam/Valhalla.

Yes. However, the files outside ShooterGame/Saved on one instance can be hard-linked to the files outside ShooterGame/Saved in the other instance in order to save disk space.

The arkmanager.cfg is setting both servers to have a password of "password", admin password is "adminpassword", max players of 10 & setting taming speed, difficulty, gamma settings, third person & notifications of players joining and leaving.

The first 3 are correct. The remainder can be specified as either options in arkmanager.cfg or the instance config (in which case they are passed on the ShooterGameServer comand-line) or in the server's GameUserSettings.ini or Game.ini files

Then the seperate instance cfg's are setting the ports for RCON, QueryPort & Port aswell as the names & for valhalla the map mod ID.

Correct.

Then to administer each of the servers, I just type arkmanager TheIsland or Valhalla then the command?

You type arkmanager <command> @<instance> <args> where <command> is the command you want to run, <instance> is the instance you want to run the command on, and <args> are the arguments to the command.

e.g. to broadcast "Hello everybody" to everyone on TheIsland, run arkmanager broadcast @TheIsland "Hello everybody"

To save the world on both instances at the same time, run arkmanager saveworld @TheIsland @Valhalla or arkmanager saveworld @all

One thing I've not been able to find documentation on is how to set the servers to auto start with the machine booting up? This is on ubuntu 14.04, so using upstart not systemd.

The arkmanager init script installed in /etc/init.d should work.

If Ubuntu 14.04 doesn't run the init scripts in /etc/init.d, or if you'd like to use the upstart init scripts, then you should be able to copy the tools/upstart/arkmanager.conf and tools/upstart/arkmanager-instance.conf files into /etc/init, and remove /etc/init.d/arkmanager.

joebywan commented 8 years ago

ok so now using those configs, I'm getting the valhalla server show up, but not the island on lan or unofficial servers (I'm showing ones with passwords set).

Arkmanager is giving me arkservers.net links that are picking up both servers, arkmanager says both are listening and netstat shows the 6 ports active (query, port, rcon).

Any ideas what I should look at to figure out why the island instance isn't showing on the server list ingame?

klightspeed commented 8 years ago

I myself have to refresh the server list in-game a few times before the server on my LAN will show up. I think it's a limitation of the ARK client's server list.

It also seems to take a short time between when the ARK server sets its max player count to non-zero and when it's actually ready to accept connections.

joebywan commented 8 years ago

I'm leaving it atleast 10 minutes before checking, and now after restarting the server the servers are loading, listening on the queryport, but not the other port. arkmanager status @all is reporting both instances to be running, not listening & reporting the server version 1003475.

Any ideas? I'm figuring there's no point refreshing the server list at this point if it's not opening both of the ports required now.

joebywan commented 8 years ago

Ok, so after tooling around some more (using the same configuration as above) the server seems to be loading two copies of valhalla, with the same server name.

I managed to test this by connecting directly without the server browser ingame using this method

Connecting to each port, it seems to be loading both instances, but for some reason the instance playing on TheIsland is loading with valhalla as the map and the same name as the valhalla server.

I've had a look at the gameusersettings.ini in /home/steam/TheIsland/Shootergame/Saved/Config/LinuxServer/ & it's showing the correct name.

Any ideas as to why or where I'd look? If I can't resolve it before tonight, I think I'll delete both instances of the server software & run arkmanager install @all tonight to start fresh.

Full disclosure, I initially downloaded one instance, installed the valhalla mod using arkmanager & then when I realised I could run two instances I made a copy of the server containing the valhalla mod (if this helps diagnose it).

klightspeed commented 8 years ago

arkmanager logs the command that it uses to start the server in /var/log/arktools/arkserver.log

Please compare the command logged for Valhalla with that logged for TheIsland.

With the second server (TheIsland), since you copied the server from one directory to another, and since you haven't had any success yet, it may be necessary to remove the contents of the ShooterGame/Saved directory.

joebywan commented 8 years ago

This is an excerpt of the arkserver.log when I ran them.

17:52:52: Running /home/steam/Valhalla/ShooterGame/Binaries/Linux/ShooterGameServer Valhalla\?AllowThirdPersonPlayer=True\?DifficultyOffset=1.0\?EnablePVEGamma=True\?MapModId=504122600\?MaxPlayers=10\?Port=7778\?QueryPort=28015\?RCONEnabled=True\?RCONPort=32330\?ServerAdminPassword=adminpassword\?ServerPassword=password\?SessionName=DamageInc\ Valhalla\?TamingSpeedMultiplier=4\?alwaysNotifyPlayerJoined=True\?alwaysNotifyPlayerLeft=True\?listen
17:52:52: Running /home/steam/TheIsland/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland\?AllowThirdPersonPlayer=True\?DifficultyOffset=1.0\?EnablePVEGamma=True\?MaxPlayers=10\?Port=7779\?QueryPort=28016\?RCONEnabled=True\?RCONPort=32331\?ServerAdminPassword=adminpassword\?ServerPassword=password\?SessionName=DamageInc\ TheIsland\?TamingSpeedMultiplier=4\?alwaysNotifyPlayerJoined=True\?alwaysNotifyPlayerLeft=True\?listen
17:52:52: Server PID: 7654
17:52:52: Server PID: 7655
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
Setting breakpad minidump AppID = 346110
Setting breakpad minidump AppID = 346110
17:53:50: server is up
17:54:21: server is up

Unless there's something I'm missing, it seems to be executing what it should be, same result after deleting the contents of /home/steam/TheIsland/ShooterGame/Saved/ directory.

Any other ideas other than delete the server files completely and reinstall?

Btw, just like to say, really appreciate the help :) I'm great with windows, not so much with linux, so this is a learning experience for me.

klightspeed commented 8 years ago

Only other suggestions I can give are to put more separation between ARK ports - e.g. when testing multiserver, I have been putting a 10 port gap between servers (i.e. server1.Port=7778, server2.Port=7788, etc, and doing the same for QueryPort).

joebywan commented 8 years ago

So... I figured out the issue, and it wasn't you guys.

My router ui has a bug in it that caused the range redirect I setup to funnel 28015-16 into 28015 instead of 28015-28016...

Really appreciate you sticking with me :) Thanks again for the help!

joebywan commented 8 years ago

Arg, more questions if you're willing. You mentioned "Yes. However, the files outside ShooterGame/Saved on one instance can be hard-linked to the files outside ShooterGame/Saved in the other instance in order to save disk space.", wouldn't this give file in use errors? I'm guessing this is making the system think it has two copies, but the 2nd is just links to the initial one? If not, how would I do this?

Also when running backups, it's just naming them date_time. Is there any plans to include some instance identifier for them? Otherwise if I need to restore a particular server, I am going to have to wade through backups, restoring them to find the one I'm after & testing by logging in to make sure it's the right map.