Deploy CS2

CS2 Dedicated Server — 30GB+ volume, CSTV, playit.gg UDP tunnel

Deploy CS2

Just deployed

/home/steam/cs2-dedicated

Deploy and Host

Deploy on Railway

Counter-Strike 2 Dedicated Server — one-click deploy with persistent volume, CSTV support, and zero-downtime updates. Powered by joedwards32/CS2.

After deploying and completing the playit.gg setup, open CS2 → Play → Community Server Browser → Add Server: `` (the IP:port playit.gg assigns).

System Requirements

  • Disk: 30GB+ dedicated volume (CS2 base install ~20GB, grows with maps/workshop content)
  • Memory: 2 GB RAM minimum (4 GB+ recommended for >10 players)
  • Network: UDP port 27015 (game), TCP port 27020 (CSTV, optional)
  • Steam: Valid Game Server Login Token required

About Hosting

This template runs a CS2 dedicated server wrapped around the upstream Docker image. Game data persists on a Railway volume mounted at /home/steam/cs2-dedicated — configs, maps, and logs survive deploys and restarts.

The entrypoint runs as root on boot to chown the Railway volume (root-owned by default) to the steam user, then drops privileges before launching the server. Railway uses TCP port 27015 for healthchecks since the game port is UDP and Railway doesn't support UDP healthchecks.

Prerequisites:

Key environment variables:

VariableDefaultDescription
SRCDS_TOKENrequiredSteam Game Server Login Token
CS2_SERVERNAMEcs2 private serverServer hostname
CS2_MAXPLAYERS10Max simultaneous players
CS2_RCONPWchangemeRCON password
CS2_STARTMAPde_infernoStarting map
CS2_MAPGROUPmg_activeMap group
CS2_GAMETYPE0Game type (0=Classic, 1=Arms Race, 2=Demolition)
CS2_GAMEMODE1Game mode (0=Casual, 1=Competitive, 2=Wingman)
CS2_CHEATS0Enable cheats (0=off, 1=on)
TV_ENABLE0Enable CSTV/SourceTV (0=off, 1=on)
TV_PORT27020CSTV port

Connecting Players (UDP via playit.gg)

Railway's public network only exposes TCP/HTTP — CS2's game traffic is UDP, so players connect through the bundled playit tunnel agent instead of the Railway domain.

The template deploys two services:

  • cs2 — the game server (UDP :27015 game, UDP :27020 CSTV, TCP :27015 RCON, persistent volume)
  • playit — the playit.gg agent, which makes outbound connections to playit.gg's edge and tunnels player traffic over Railway's private network to cs2.railway.internal:27015

One-time setup (after deploy)

  1. Create a free account at playit.gg
  2. Account → Agents → Add Agent → copy the secret key
  3. In Railway, open the playit service → Variables → paste the key as SECRET_KEY
  4. In playit.gg → Tunnels → Add Tunnel:
    • Type: UDP
    • Local address: cs2.railway.internal
    • Local port: 27015
  5. If you enabled CSTV (TV_ENABLE=1), add a second tunnel the same way with local port 27020
  6. Give players the allocation address playit.gg assigns — they add it in CS2 → Play → Community Server Browser → Add Server

Ports

PortProtocolDescription
27015UDPGame port (via playit.gg tunnel)
27015TCPRCON (if enabled, via Railway TCP proxy)
27020UDPCSTV/SourceTV (via second playit.gg tunnel)

Why Deploy

  • Persistent game data: configs, maps, and logs survive deploys via Railway volume
  • Zero-downtime updates: redeploy without losing server state
  • SourceTV support: broadcast matches with built-in CSTV
  • Full config control: 32+ env vars for maps, gamemodes, logging, and more

Common Use Cases

  • Host a competitive CS2 server for ranked practice
  • Run a private community server with custom maps and mods
  • Set up a CSTV relay for tournament broadcasting
  • Test custom configs and gamemodes without local Docker setup

Dependencies for

Deployment Dependencies

  • A Railway account
  • A Steam Game Server Login Token (free from steamcommunity.com)
  • A free playit.gg account (for the UDP game tunnel — required for players to connect)

Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
47
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51