Robin Server
Robin Server
Section titled “Robin Server”Backend server for Robin Web, built using Rust and the Salvo framework. Its primary function is to proxy API requests for the Running with Rifles game server list, provide static file serving, and serve game map configuration data.
Technical Stack
Section titled “Technical Stack”- Language: Rust
- Framework: Salvo
- Testing: Vitest, Playwright
Environment Variables
Section titled “Environment Variables”| Variable | Default | Description |
|---|---|---|
HOST | 127.0.0.1 | Server bind address |
PORT | 5800 | Server port |
MAPS_CONFIG | maps.json | Maps configuration file path |
CACHE_DURATION_SECS | 3 | Cache expiry time in seconds |
RATE_LIMIT_SECS | 3 | Rate limit interval in seconds |
ANDROID_REPO_URL | (empty) | GitHub repository URL for Android app releases |
WEB_REPO_URL | (empty) | GitHub repository URL for Web app releases |
API Endpoints
Section titled “API Endpoints”GET /api/ping
Section titled “GET /api/ping”Health check endpoint that returns “pong”.
GET /api/version
Section titled “GET /api/version”Returns the latest release information for Android and Web applications configured through environment variables.
{ "android": { "version": "v2.0.0", "url": "https://github.com/owner/android-repo/releases/tag/v2.0.0" }, "web": { "version": "v1.5.0", "url": "https://github.com/owner/web-repo/releases/tag/v1.5.0" }}GET /api/maps
Section titled “GET /api/maps”Returns game map configuration data.
GET /api/server_list
Section titled “GET /api/server_list”Proxies requests to the Running with Rifles game server list API. Supports query parameters for filtering.
GET /api/player_list
Section titled “GET /api/player_list”Proxies requests to the Running with Rifles player statistics API. Returns HTML content with player rankings and statistics.
# Get players sorted by kills in descending ordercurl "http://localhost:5800/api/player_list?sort=kills&order=desc"Maps Configuration
Section titled “Maps Configuration”Maps are configured through a JSON file specified by the MAPS_CONFIG environment variable.
{ "maps": [ { "name": "map9", "path": "media/packages/vanilla.desert/maps/map9", "image": "md5_1.png" } ]}name: Human-readable map namepath: Full game path for the map (unique identifier)image: Image filename or CDN URL for map preview
Development
Section titled “Development”# Install Rust first, then:git clone https://github.com/rwr-infra/robin-server.gitcd robin-server
# Run development servercargo run
# Custom configurationHOST=0.0.0.0 PORT=8080 cargo runBuilding
Section titled “Building”# Local buildcargo build --release
# Docker builddocker build -t robin-server .Deployment
Section titled “Deployment”Docker Deployment
Section titled “Docker Deployment”# Basic deploymentdocker pull zhaozisong0/rwrs-server:latestdocker run -d -p 80:80 --name robin-server \ -e HOST=0.0.0.0 \ -e PORT=80 \ zhaozisong0/rwrs-server:latestWith Frontend
Section titled “With Frontend”# Copy frontend build to static directorydocker cp ./dist/. robin-server:/static/Docker Compose
Section titled “Docker Compose”version: '3'services: robin-server: image: zhaozisong0/rwrs-server:latest ports: - "80:80" environment: - HOST=0.0.0.0 - PORT=80 - ANDROID_REPO_URL=https://github.com/rwr-infra/robin-android - WEB_REPO_URL=https://github.com/rwr-infra/robin-web volumes: - ./dist:/static - ./maps.json:/maps.jsonTesting
Section titled “Testing”# Run all testscargo test
# Run with outputcargo test -- --nocapture
# Run specific test modulecargo test api_cache_tests
# Generate coverage reportcargo install cargo-llvm-covcargo llvm-cov --all-features- Repository: github.com/rwr-infra/robin-server
Related Tools
Section titled “Related Tools”- Robin Web - Frontend web interface
- Robin Android - Android client