Skip to content

Deployment Overview of Counter-Strike 2 Server on Server

Prerequisites and Basic Requirements

The deployment of the Counter-Strike 2 server requires the following system specifications and configurations:

  • Operating System: Ubuntu (compatible with apt package manager).

  • Architecture: Support for both amd64 and i386 architectures is required.

  • Privileges: Root access or sudo privileges are necessary for installation and configuration.

  • Domain: The server utilizes the hostkey.in zone.

  • Ports: The server requires network access for game traffic and management; specific ports are detailed in the Available Ports section.

FQDN of the Final Panel

The fully qualified domain name (FQDN) for accessing the server panel follows the format: plane<Server ID>.hostkey.in:<port>

Where:

  • plane is the configured prefix.

  • <Server ID> is the unique identifier for the specific server instance.

  • <port> is the port number assigned for the service.

File and Directory Structure

The application and its components are organized within the following directory structure:

  • Installation Directory: /opt/cs2

  • Contains the steamcmd tools and the game files.

  • Game Files: /opt/cs2/game

  • Contains the Counter-Strike 2 binaries and game data.

  • Configuration Files: /opt/cs2/game/game/csgo/cfg/cs2server.cfg

  • Stores the server configuration settings.

  • Steam SDK: /root/.steam/sdk64

  • Contains the steamclient.so library required for the server.

  • Management Script: /root/cs2server.sh

  • The shell script used to control the server lifecycle.

  • Log File: /var/log/cs2server.log

  • Stores runtime logs for the server.

  • PID File: /tmp/cs2server.pid

  • Stores the process ID of the running server.

  • Nginx Configuration: /data/nginx/user_conf.d

  • Contains custom Nginx configuration files.

  • Nginx Environment: /data/nginx/nginx-certbot.env

  • Contains environment variables for the Nginx container.

Application Installation Process

The Counter-Strike 2 server is installed using the steamcmd utility. The process involves the following steps:

  1. Repository Configuration: The multiverse repository is added to the system, and the i386 architecture is enabled to support 32-bit libraries.

  2. Package Installation: The steamcmd package is installed via the apt package manager.

  3. SteamCMD Setup: The steamcmd binary is downloaded and extracted to /opt/cs2.

  4. Game Installation: The steamcmd tool is executed to download and validate the Counter-Strike 2 application (App ID 730) into the /opt/cs2/game directory.

  5. Library Configuration: The steamclient.so library is copied from the installation directory to /root/.steam/sdk64.

  6. Configuration Deployment: The server configuration file cs2server.cfg is placed in the game configuration directory.

  7. Management Script Deployment: The cs2server.sh script is installed in /root with executable permissions.

Docker Containers and Their Deployment

The deployment includes a Docker container for the Nginx web server and SSL management. The container is defined using a Docker Compose configuration.

Container Details:

  • Image: jonasal/nginx-certbot:latest

  • Restart Policy: unless-stopped

  • Network Mode: host

  • Environment:

  • CERTBOT_EMAIL: Set to [email protected]

  • Additional environment variables are loaded from /data/nginx/nginx-certbot.env.

  • Volumes:

  • nginx_secrets: Mounted to /etc/letsencrypt for SSL certificate storage.

  • /data/nginx/user_conf.d: Mounted to /etc/nginx/user_conf.d for custom Nginx configurations.

The Docker Compose file is located at the path specified in the deployment context, managing the lifecycle of the Nginx service.

Proxy Servers

The server utilizes Nginx as a reverse proxy and SSL termination point.

  • Software: Nginx with Certbot integration.

  • SSL Management: Automated via the jonasal/nginx-certbot container image.

  • Custom Domains: Configured through the nginx_secrets volume and user configuration directory.

  • Configuration Location: Custom Nginx configurations are stored in /data/nginx/user_conf.d.

Permission Settings

File and directory permissions are set as follows to ensure proper operation:

  • Installation Directory (/opt/cs2): 0755 (rwxr-xr-x).

  • Steam SDK Directory (/root/.steam/sdk64): 0755 with recursive permissions.

  • Configuration File (/opt/cs2/game/game/csgo/cfg/cs2server.cfg): Owned by root:root with mode 0755.

  • Management Script (/root/cs2server.sh): Owned by root:root with mode 0755.

Location of Configuration Files and Data

Key configuration and data files are located at the following paths:

  • Server Configuration: /opt/cs2/game/game/csgo/cfg/cs2server.cfg

  • Management Script: /root/cs2server.sh

  • Nginx Environment Variables: /data/nginx/nginx-certbot.env

  • Nginx Custom Configs: /data/nginx/user_conf.d

  • SSL Certificates: /etc/letsencrypt (mounted volume)

  • Server Logs: /var/log/cs2server.log

  • Process ID: /tmp/cs2server.pid

Available Ports for Connection

The specific ports for game connection and management are defined within the cs2server.cfg configuration file and the Nginx proxy settings. The Nginx container operates in host network mode, allowing direct access to configured ports.

Starting, Stopping, and Updating

The Counter-Strike 2 server is managed using the cs2server.sh script located at /root/cs2server.sh. The script supports the following commands:

  • Start:

    /root/cs2server.sh start
    
    Initiates the server process in the background, logs output to /var/log/cs2server.log, and saves the PID to /tmp/cs2server.pid.

  • Stop:

    /root/cs2server.sh stop
    
    Terminates the running server process and removes the PID file.

  • Restart:

    /root/cs2server.sh restart
    
    Stops the server, waits for 2 seconds, and then starts it again.

  • Status:

    /root/cs2server.sh status
    
    Checks if the server process is running based on the PID file and reports the current status.

The server binary is executed from /opt/cs2/game/game/bin/linuxsteamrt64/cs2 with the +exec cs2server.cfg argument.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×