Skip to content

3. Enhancements

Jonathan Linat edited this page Mar 30, 2024 · 2 revisions

This section is focused on enhancing the capabilities and features of your Day of Defeat server. From integrating the game's legacy version to activating key server modifications, here you'll find step-by-step instructions to elevate your server's functionality.

Encountering hurdles in server configuration or during the implementation of updates? This comprehensive guide is your first port of call for troubleshooting and enhancing your server setup.

💬 Do You Need Support?

3.1 Enable Automatic Game Server Reboot on Boot

Efficient management of your server's operation, particularly for Day of Defeat, can significantly benefit from automation tools such as systemd and crontab. These tools ensure that your server remains operational with minimal manual intervention, enhancing reliability and convenience.

Establish a Secure Connection

To securely connect to your VPS, utilize SSH by substituting <ip-address> with your server's actual IP address:

ssh root@<ip-address> -p 22

Utilize systemd for Reliable Service Management

systemd is the modern standard for initializing system services in many Linux distributions. By creating a service file, you can control the start-up and shutdown of your Day of Defeat server directly through systemd commands, offering a robust method for managing your server's lifecycle.

Create a systemd Service File

For integrating your Day of Defeat server with systemd, a service file must be created in /etc/systemd/system/.

nano /etc/systemd/system/dodserver.service

This file will describe the service's properties and dependencies:

[Unit]
Description=LinuxGSM Day of Defeat Server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=dodserver
WorkingDirectory=/home/dodserver
RemainAfterExit=yes
ExecStart=/home/dodserver/dodserver start
ExecStop=/home/dodserver/dodserver stop
Restart=no

[Install]
WantedBy=multi-user.target

Manage the Service

After creating the service file, inform systemd of the new service by reloading its daemon:

systemctl daemon-reload

Schedule Tasks with Crontab for Server Monitoring

Crontab provides a straightforward way to schedule repetitive tasks like monitoring your server. Utilizing @reboot, you can automate server checks or restarts upon system boot, ensuring your server is always in its optimal state.

Configure Crontab for Automatic Reboots

To execute commands automatically at reboot, edit the crontab file:

crontab -e

Then, add the start command with the @reboot directive and save all the changes.

@reboot systemctl start dodserver > /dev/null 2>&1

This setup ensures that your server monitoring scripts or services commence without manual input after a system reboot.

By leveraging systemd and crontab, administrators can ensure their Day of Defeat servers are efficiently managed, reducing downtime and enhancing the gaming experience for users.


3.2 Enable FastDL Capability with nginx

Improving Day of Defeat server performance and player experience includes to set up FastDL.

FastDL allows players to download server content like maps, models, and sounds quickly. Achieve this by configuring nginx as a root server and adjusting it for efficient content delivery.

Establish a Secure Connection

To securely connect to your VPS, utilize SSH by substituting <ip-address> with your server's actual IP address:

ssh root@<ip-address> -p 22

Install Nginx

Start by installing Nginx on your server, which will require root access:

apt update && apt install nginx -y

Verify nginx's successful installation by accessing your server's IP address in a web browser. You should see the default nginx welcome page.

Configure nginx for FastDL

To serve your Day of Defeat server's content through nginx, edit the default site configuration:

nano /etc/nginx/sites-available/default

Replace the content of the file with the following configuration.

It sets the root directory for nginx and includes a location /fastdl/ block to directly serve your game server files to players. The alias directive points nginx to your game server's content directory. The nested location blocks ensure that only specific file types are accessible, enhancing security:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

        location /fastdl/ {
                alias   /home/dodserver/serverfiles/dod/;
                autoindex on;

                location ~* (\.wad$|(maps|sprites|models|gfx|sound|media|overviews)/.*(bsp|mdl|spr|wav|mp3|bmp|tga|txt|res)$) {
                        allow all;
                }

                deny all;
        }
}

Save and exit nano after applying the changes.

Restart nginx

To apply the changes, restart nginx:

systemctl restart nginx

Add sv_downloadurl in dodserver.cfg

To activate FastDL, add the sv_downloadurl cvar to the dodserver.cfg file. This directs the game server to the URL where Nginx serves the content, facilitating faster downloads for players:

nano /home/dodserver/serverfiles/dod/dodserver.cfg

Assign it the value http://<ip-address>/fastdl/ and save the changes.

Configuring FastDL with nginx and specifying sv_downloadurl in the game server's configuration file accelerates content downloads for players, enhancing their gameplay experience by reducing load times and gameplay interruptions.