Setting up a well organized Enemy Territory: Legacy Server

Managing servers with a lot of files or addons, and functionality can get confusing, when you have a ton of files mixed together in one folder.

mixed-files

Various files in the server folder, ordered alphabetically, mixed functionality.
A well organized file structure on the server
A well organized file structure on the server

Setting up a server with a well-designed structure can be very helpful for maintenance. I previously wrote about how I set up Nginx with include files, which greatly improves maintainability of nginx configuration. This time, I will talk about setting up a Wolfenstein: Enemy Territory server; more specifically a ET: Legacy server (which is compatible to the first). For a well separated structure, I will make use of the fs_basepath and fs_homepath variabes and specifying paths for configuration files, lua scripts, mapconfigs and mapscripts. This will lead to clear separation and categorization of files.

etl-binaries

Binary etmain folder contents. Only the .pk3 files are required.

First step is to install the actual binary server. For ET:L, this means downloading the binaries and extracting them, and then copying the etmain/*.pk3 files from a W:ET distribution (4 files) into the etl etmain folder.

If GeoIP is desired (server announces which country players are from), a GeoIP.dat will also have to be placed in etmain.

uml-et-binary-conf

One binary, multiple configured servers

Now that we have the binaries ready, we can start configuring and preparing our server instance. Because we separate the server binaries from server instance configurations in order to upgrade all the servers, we just have to upgrade that single binary folder (or use a separate, upgraded one).

We create a new public server, which we name etpub2 (in my case, it is the second one, hence the name). For this, if we placed the binaries in /srv/et/etbin, we will now create /srv/et/etpub2; we create a folder right next to the etbin folder.

et-conf-folders

Etmain configuration folder with subfolders.

Within this configuration folder, we create an etmain folder, with further subfolders for further configuration:

  • cfg – for .cfg files
  • configs – for .config files
  • lua – for .lua scripts
  • mapconfigs – for map specific .cfg files
  • mapscripts – for .script files with map adjustment logic

I set up a Github Git repository for you to explore the folder structure in.

As we set up a legacy mod server, we copy the etl_server.cfg and legacy.cfg from etbin/etmain to etpub2/etmain. This way, we can adjust our configuration without influencing other server instances – we want to configure etpub2 specifically.

The etl_server.cfg will be used as the main server config, and legacy.cfg for more game specific settings and the mod specific settings. In the etl_server.cfg you will probably want to adjust the server name in sv_hostname for example.

Because we have all our configuration in etmain/cfg, we will also have to adjust config paths in etl_server.cfg. The line exec legacy.cfg will be changed to exec cfg/legacy.cfg and the line exec mapvotecycle.cfg will be changed to exec cfg/cycle/mapvotecycle.cfg (where we now copy this file into from the etbin folder as well). The watchdog command com_watchdog_cmd will have to be adjusted as well; can you do it? 🙂

If we use a lua script, we have to use the appropriate path in lua_modules as well (lua/<em>script</em>.lua).

As for mapconfigs and mapscripts, we set g_mapscriptdirectory to "mapscripts" and g_mapConfigs to "mapconfigs".

For the config folder (.config files) we don’t have to set up anything, as the config subfolder is the et default.

et-pk3-links

Symlinking files can save diskspace, and make sure you have them downloadable on the webspace.

If we want custom maps and skins, we will place them in etpub2/etmain. In my case, as I have full permissions on the server, I create symbolic links to the pk3 files on the webspace. This way, I have the file on the filesystem just once (taking up space), but et just reads them normally. (If you’re on a Windows server you will probably just want to duplicate the files.) Of course, if this is your first time setting up the server, you will add the custom content once the server starts and runs fine.

To test if the server works, let us run it.

./etbin/etl +set dedicated 2 +set net_port 27960 +set fs_basepath "/srv/et/etbin" +set fs_homepath "/srv/et/etpub2" +set fs_game legacy +set com_hunkMegs 128 +set com_zoneMegs 24 +set vm_game 0 +set ttycon 0 +exec cfg/etl_server.cfg

A log file will be placed in etpub2/legacy/etconsole.log. If it works, you should be able to see and connect to the server now, on port 27960.

The only thing left is creating a start-stop-script. For reference, see the Linux script etpub2.sh – which uses the user et to start the server. You can use this to place in /etc/init.d and use update-rc.d adequately to let it start and stop on system startup and shutdown (update-rc.d etpub2.sh defaults).

In my case, I am setting up a a legacy mod server. Depending on your mod, the mod may not support lua scripts. If you want to set up a different mod, the setup is essentially the same, but you will specify a different fs_game in the launch command and script, and your mod config won’t be legacy.cfg.

In case you don’t have a webspace for www-download set up yet, you probably should, as soon as you managed to prepare the other stuff, and the server works. Without www-downloads, connecting players that have to download custom maps or skins will take longer to download, and potentially disconnect. To enable www downloads in the etl_server.cfg enable sv_allowDownload and sv_wwwDownload, and set the sv_wwwBaseURL to the base HTTP address for the downloads (without “etmain” in the path; it must point to the address that contains the etmain folder).