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 privileges:
-
Operating System: Ubuntu (specifically utilizing the
multiverserepository and support fori386architecture). -
Privileges: Root access or
sudoprivileges are required to install system packages, manage directories, and execute the server management script. -
Dependencies: The
steamcmdpackage must be installed via theaptpackage manager. -
Network: Access to the internet is required for downloading the SteamCMD client and updating the game binaries.
File and Directory Structure¶
The application and its associated components are organized within specific directories on the server:
-
Installation Directory:
/opt/cs2 -
Game Binaries and Data:
/opt/cs2/game -
Server Configuration:
/opt/cs2/game/game/csgo/cfg/cs2server.cfg -
Steam SDK Directory:
/root/.steam/sdk64 -
Server Management Script:
/root/cs2server.sh -
Process ID File:
/tmp/cs2server.pid -
Log File:
/var/log/cs2server.log
Application Installation Process¶
The installation process involves setting up the environment, installing SteamCMD, and downloading the Counter-Strike 2 server files.
-
Repository Configuration: The
multiverserepository is added to the APT sources, and thei386architecture is enabled to support legacy dependencies. -
Package Installation: System packages are updated, and the
steamcmdpackage is installed usingapt. -
Directory Creation: The installation directory
/opt/cs2and the Steam SDK directory/root/.steam/sdk64are created with0755permissions. -
SteamCMD Setup: The SteamCMD client is downloaded and extracted into
/opt/cs2. -
Game Download: The Counter-Strike 2 server (Application ID 730) is downloaded and validated via SteamCMD using the
force_install_dircommand. -
Library Linking: The
steamclient.sofile is copied from/opt/cs2/linux64/to/root/.steam/sdk64/to ensure library compatibility. -
Configuration and Scripting: The server configuration file
cs2server.cfgis deployed to/opt/cs2/game/game/csgo/cfg/, and the management scriptcs2server.shis placed in/root/.
Docker Containers and Their Deployment¶
The deployment includes an Nginx container configured for SSL certificate management and proxying.
-
Container Image:
jonasal/nginx-certbot:latest -
Network Mode: The container runs in host network mode.
-
Volume Mounts:
-
nginx_secrets: An external volume mounted to/etc/letsencrypt. -
/data/nginx/user_conf.d: Mounted to/etc/nginx/user_conf.dfor custom user configurations. -
Environment Variables:
-
CERTBOT_EMAIL: Set to[email protected]. -
Additional configuration is loaded from
/data/nginx/nginx-certbot.env.
Proxy Servers¶
The Nginx container functions as the primary proxy server handling SSL termination and traffic routing.
-
Functionality: The container utilizes Certbot for automated SSL certificate management.
-
Secrets Management: SSL secrets are stored in the external Docker volume
nginx_secrets. -
Configuration: Custom Nginx configurations are expected to be placed in
/data/nginx/user_conf.don the host, which maps directly to the container.
Starting, Stopping, and Updating¶
Server operations are managed through the custom shell script located at /root/cs2server.sh. The script accepts the following arguments:
-
Start: Executes the server binary located at
/opt/cs2/game/game/bin/linuxsteamrt64/cs2with the-dedicatedflag and loads thecs2server.cfgconfiguration. It runs in the background vianohupand writes the process ID to/tmp/cs2server.pid. -
Stop: Reads the PID from
/tmp/cs2server.pid, terminates the process, and removes the PID file. -
Restart: Executes the stop command, waits for 2 seconds, and then executes the start command.
-
Status: Checks if the PID file exists and verifies if the process is currently running.
Commands to manage the service:
/root/cs2server.sh start
/root/cs2server.sh stop
/root/cs2server.sh restart
/root/cs2server.sh status
Permission Settings¶
File and directory permissions are set during the deployment process to ensure security and functionality:
-
Directory Permissions:
-
/opt/cs2:0755 -
/root/.steam:0755 -
/root/.steam/sdk64:0755(recursive) -
File Permissions:
-
/opt/cs2/game/game/csgo/cfg/cs2server.cfg:0755(owner: root, group: root) -
/root/cs2server.sh:0755(owner: root, group: root)
Location of Configuration Files and Data¶
The following paths contain critical configuration files and runtime data:
-
Server Configuration:
/opt/cs2/game/game/csgo/cfg/cs2server.cfg -
Management Script:
/root/cs2server.sh -
Nginx Environment:
/data/nginx/nginx-certbot.env -
Nginx User Configs:
/data/nginx/user_conf.d -
SSL Certificates: Managed within the
nginx_secretsDocker volume. -
Runtime Logs:
/var/log/cs2server.log -
Process ID:
/tmp/cs2server.pid