Deployment Overview of Rust Server on Server¶
Prerequisites and Basic Requirements¶
The deployment of the Rust Dedicated Server requires a Linux environment, specifically Ubuntu, with the following prerequisites:
- Operating System: Ubuntu (compatible with
aptpackage manager). - Privileges: Root access or
sudoprivileges are required to install system packages, create users, and manage systemd services. - Required System Package:
libc6-i386must be installed to support 32-bit library dependencies. - Network: The server must have network connectivity to download SteamCMD and the game binaries.
File and Directory Structure¶
The application files, configuration, and data are organized in the following directory structure:
- Main Server Directory:
{{ rust_server_dir }} - Contains the
RustDedicatedexecutable and theRustDedicated_Datafolder. - Includes the startup script
runds.sh. - SteamCMD Directory:
{{ rust_steamcmd_dir }} - Contains the
steamcmd.shscript and thesteamcmd_linux.tar.gzarchive. - User Home Directory:
{{ rust_home }} - Contains the
.rustsubdirectory for sensitive configuration. - Secrets Directory:
{{ rust_home }}/.rust - Stores the
rcon_passwordfile containing the Remote Console password.
Application Installation Process¶
The Rust Dedicated Server is installed using the SteamCMD tool. The process involves the following steps:
- The
steamcmd_linux.tar.gzarchive is downloaded from the official Steam URL into the SteamCMD directory. - The archive is extracted to the
{{ rust_steamcmd_dir }}directory. - The
steamcmd.shscript is made executable. - The Rust server binaries are installed by running SteamCMD with the following parameters:
+force_install_dir {{ rust_server_dir }}: Specifies the installation target.+login anonymous: Logs in without credentials.+app_update {{ rust_app_id }} validate: Downloads and validates the Rust Dedicated Server application.+quit: Exits SteamCMD after installation.
The installation is complete when the RustDedicated executable is present in the {{ rust_server_dir }} directory.
Access Rights and Security¶
User accounts and group permissions are configured to isolate the server process:
- User Account: A dedicated system user named
{{ rust_user }}is created with/bin/bashas the shell. - Group: A dedicated group named
{{ rust_group }}is created. - Ownership:
- The
{{ rust_server_dir }}and{{ rust_steamcmd_dir }}directories are owned by{{ rust_user }}and{{ rust_group }}. - The
{{ rust_home }}/.rustdirectory is owned by{{ rust_user }}and{{ rust_group }}with restricted permissions (0700). - The
rcon_passwordfile is owned by{{ rust_user }}and{{ rust_group }}with permissions set to0600to prevent unauthorized reading.
Databases¶
The provided configuration does not include external database connections. The server stores its world data and configuration locally within the {{ rust_server_dir }} directory structure.
Docker Containers and Their Deployment¶
The deployment described in the source files does not utilize Docker containers. The application runs as a native process managed by the operating system's service manager.
Proxy Servers¶
The configuration does not include proxy server setups such as Nginx, Traefik, or SSL termination via Certbot. The server exposes its ports directly.
Permission Settings¶
File and directory permissions are strictly enforced to ensure security and proper operation:
- Server Directory:
{{ rust_server_dir }}is set to0755(readable and executable by all, writable by owner). - SteamCMD Directory:
{{ rust_steamcmd_dir }}is set to0755. - Startup Script:
{{ rust_server_dir }}/runds.shis set to0755to allow execution. - Secrets Directory:
{{ rust_home }}/.rustis set to0700(accessible only by the owner). - RCON Password File:
{{ rust_home }}/.rust/rcon_passwordis set to0600(readable and writable only by the owner). - Systemd Service File:
/etc/systemd/system/rust.serviceis set to0644.
Starting, Stopping, and Updating¶
The Rust Dedicated Server is managed as a systemd service named rust. The service is configured to start automatically on boot and restart automatically if it fails.
- Service File Location:
/etc/systemd/system/rust.service - Service Configuration:
- Runs as user
{{ rust_user }}and group{{ rust_group }}. - Working directory is set to
{{ rust_server_dir }}. - Executable command is
{{ rust_server_dir }}/runds.sh. - File descriptor limit (
LimitNOFILE) is set to65535. - Restart policy is set to
alwayswith a 10-second delay (RestartSec=10).
Management Commands:
- Start the service:
- Stop the service:
- Restart the service:
- Check service status:
- Enable auto-start on boot:
The startup script runds.sh configures the server with the following parameters: - +server.identity: Server identity name. - +server.port: Game port. - +server.queryport: Query port. - +server.hostname: Server name visible in the browser. - +server.description: Server description. - +server.url: Server website URL. - +server.headerimage: Header image URL. - +server.level: Map name (default: "Procedural Map"). - +server.seed: Map seed. - +server.worldsize: World size. - +server.maxplayers: Maximum player count. - +rcon.ip: RCON IP address (0.0.0.0). - +rcon.port: RCON port. - +rcon.password: RCON password (read from {{ rust_home }}/.rust/rcon_password). - +rcon.web: Enables web RCON. - -logfile: Path to the log file.