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
aptpackage manager). -
Architecture: Support for both
amd64andi386architectures is required. -
Privileges: Root access or
sudoprivileges are necessary for installation and configuration. -
Domain: The server utilizes the
hostkey.inzone. -
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:
-
planeis 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
steamcmdtools 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.solibrary 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:
-
Repository Configuration: The
multiverserepository is added to the system, and thei386architecture is enabled to support 32-bit libraries. -
Package Installation: The
steamcmdpackage is installed via theaptpackage manager. -
SteamCMD Setup: The
steamcmdbinary is downloaded and extracted to/opt/cs2. -
Game Installation: The
steamcmdtool is executed to download and validate the Counter-Strike 2 application (App ID730) into the/opt/cs2/gamedirectory. -
Library Configuration: The
steamclient.solibrary is copied from the installation directory to/root/.steam/sdk64. -
Configuration Deployment: The server configuration file
cs2server.cfgis placed in the game configuration directory. -
Management Script Deployment: The
cs2server.shscript is installed in/rootwith 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/letsencryptfor SSL certificate storage. -
/data/nginx/user_conf.d: Mounted to/etc/nginx/user_conf.dfor 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-certbotcontainer image. -
Custom Domains: Configured through the
nginx_secretsvolume 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):0755with recursive permissions. -
Configuration File (
/opt/cs2/game/game/csgo/cfg/cs2server.cfg): Owned byroot:rootwith mode0755. -
Management Script (
/root/cs2server.sh): Owned byroot:rootwith mode0755.
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:
Initiates the server process in the background, logs output to/var/log/cs2server.log, and saves the PID to/tmp/cs2server.pid. -
Stop:
Terminates the running server process and removes the PID file. -
Restart:
Stops the server, waits for 2 seconds, and then starts it again. -
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.