Skip to content

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 apt package manager).
  • Privileges: Root access or sudo privileges are required to install system packages, create users, and manage systemd services.
  • Required System Package: libc6-i386 must 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 RustDedicated executable and the RustDedicated_Data folder.
  • Includes the startup script runds.sh.
  • SteamCMD Directory: {{ rust_steamcmd_dir }}
  • Contains the steamcmd.sh script and the steamcmd_linux.tar.gz archive.
  • User Home Directory: {{ rust_home }}
  • Contains the .rust subdirectory for sensitive configuration.
  • Secrets Directory: {{ rust_home }}/.rust
  • Stores the rcon_password file containing the Remote Console password.

Application Installation Process

The Rust Dedicated Server is installed using the SteamCMD tool. The process involves the following steps:

  1. The steamcmd_linux.tar.gz archive is downloaded from the official Steam URL into the SteamCMD directory.
  2. The archive is extracted to the {{ rust_steamcmd_dir }} directory.
  3. The steamcmd.sh script is made executable.
  4. The Rust server binaries are installed by running SteamCMD with the following parameters:
  5. +force_install_dir {{ rust_server_dir }}: Specifies the installation target.
  6. +login anonymous: Logs in without credentials.
  7. +app_update {{ rust_app_id }} validate: Downloads and validates the Rust Dedicated Server application.
  8. +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/bash as 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 }}/.rust directory is owned by {{ rust_user }} and {{ rust_group }} with restricted permissions (0700).
  • The rcon_password file is owned by {{ rust_user }} and {{ rust_group }} with permissions set to 0600 to 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 to 0755 (readable and executable by all, writable by owner).
  • SteamCMD Directory: {{ rust_steamcmd_dir }} is set to 0755.
  • Startup Script: {{ rust_server_dir }}/runds.sh is set to 0755 to allow execution.
  • Secrets Directory: {{ rust_home }}/.rust is set to 0700 (accessible only by the owner).
  • RCON Password File: {{ rust_home }}/.rust/rcon_password is set to 0600 (readable and writable only by the owner).
  • Systemd Service File: /etc/systemd/system/rust.service is set to 0644.

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 to 65535.
  • Restart policy is set to always with a 10-second delay (RestartSec=10).

Management Commands:

  • Start the service:
    sudo systemctl start rust
    
  • Stop the service:
    sudo systemctl stop rust
    
  • Restart the service:
    sudo systemctl restart rust
    
  • Check service status:
    sudo systemctl status rust
    
  • Enable auto-start on boot:
    sudo systemctl enable rust
    

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.

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