Windows deployment of the defrag.racing servers - the windows sibling of defrag-server-bundle, built the same way: this repo holds only scripts and configs, every binary comes from dl.defrag.racing.
Repo root IS the server install root. Replaces the old world of hand-started .bat files (no autostart after a reboot, windows update killing servers for days, engine updates by hand) with:
- one windows service per server (WinSW: autostart at boot, restart on
crash, high priority) generated from
servers.psd1 - engine + mod from the automatic build:
dfsv-core-win.zipis rebuilt server-side whenever a new oDFe release or DeFRaG mod appears, so updating is one script - demo upload to defrag.racing storage every 30 min (WinSCP SFTP,
upload + delete local, live
tmp/slots skipped) - local map pool sync (bsp-only pk3s from dl.defrag.racing into
baseq3/, incremental, never deletes) - no NFS on windows
| Path | What |
|---|---|
servers.example.psd1 |
template for servers.psd1 (gitignored): every server (name, type, port, rs id, physics, start map) + the box's public identity |
config.psd1 |
the only secrets: rcon password and SFTP credential; copy from config.example.psd1, gitignored |
defrag/cfgs/global.cfg |
settings shared by every server |
defrag/cfgs/<gametype>.cfg |
per-gametype settings (mixed, cpm, vq3, fastcaps, teamruns, freestyle) |
defrag/cfgs/<name>.local.cfg |
optional per-server overrides, applied last (gitignored) |
scripts/download-defrag.ps1 |
installs/updates the core bundle + baseq3 paks |
scripts/update-engine.ps1 |
stop services, back up exe, pull fresh core bundle, start again |
scripts/run-server.ps1 |
starts one engine instance (services call this) |
scripts/generate-services.ps1 |
writes + installs the WinSW services dfsv-<name> |
scripts/upload-demos.ps1 |
SFTP demo upload (scheduled every 30 min) |
scripts/sync-maps.ps1 |
map pool sync (scheduled daily) |
scripts/register-tasks.ps1 |
registers those two scheduled tasks |
scripts/setup-firewall.ps1 |
inbound UDP rule for this install's engine + ports |
scripts/status.ps1 |
service state + live getstatus reply per server |
scripts/lib/servers.ps1 |
shared reader for servers.psd1: fills in Name, Map and Enabled so an entry can be one line |
scripts/console-gui.ps1 |
window to watch any server's log live and send rcon commands |
scripts/install-shortcut.ps1 |
one-time: puts a dfsv console shortcut on the desktop |
scripts/make-core-static.ps1 |
one-time: builds the static input for the server-side core build |
Never versioned: baseq3/, defrag/serverdemos/, all *.dll / *.pk3 /
oDFe.ded.exe / ip4db.dat (they come from the core bundle), logs,
config.psd1, defrag/mysqlconnection.info, defrag/recordsystem.cfg,
defrag/cfgs/<name>.local.cfg and the generated per-instance configs.
Four layers, each able to override the one before it:
defrag/cfgs/global.cfg shared by all servers
defrag/cfgs/<gametype>.cfg gametype rules (df_gametype, votes, rs_modules)
defrag/<name>/main.cfg GENERATED: hostname, rcon, log, physics
defrag/cfgs/<name>.local.cfg optional, your own tweaks for this one server
run-server.ps1 writes main.cfg from servers.psd1 + config.psd1 on every
start, plus an idle.cfg that execs the whole chain - that one is what
df_sv_script_idleCfg points at, so an idle server resets to exactly its boot
state instead of keeping whatever was voted in.
This is why no secret ever reaches the repo: the rcon password lives only in
config.psd1 and lands in the generated main.cfg on the box.
oDFe release (windows-msvc-x86/oDFe.ded.exe) ┐
DeFRaG mod zip from q3defrag.org (zz-*.pk3) ├─► bundle:build-server
dfsv-core-win-static.zip (modules, qagame, │ (web server, scheduled)
support DLLs, ip4db - uploaded once) ┘
└─► dl.defrag.racing/downloads/dfsv-core-win.zip
The static input is created once with scripts/make-core-static.ps1 and
uploaded to /www/downloads on the storage VPS. Everything after that is
automatic: a new engine or mod triggers a rebuild, and every windows box
picks it up with .\scripts\update-engine.ps1.
- Install git and WinSCP.
git clone https://github.com/Defrag-racing/defrag-server-bundle-windows.git C:\dfsv- Allow local scripts once (a fresh windows box blocks all of them):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force. The services and scheduled tasks pass-ExecutionPolicy Bypassthemselves, so this is only for running the scripts by hand. cd C:\dfsv; .\scripts\download-defrag.ps1(core bundle + ~485 MB baseq3)Copy-Item config.example.psd1 config.psd1and fill in the rcon password plus the SFTP credential from https://defrag.racing/server-hosting.- Drop in the two secrets that never leave the box:
defrag\mysqlconnection.infoanddefrag\recordsystem.cfg. Copy-Item servers.example.psd1 servers.psd1, then fill in your net_ip and one line per server - gametype, port and the rs id issued to you at https://defrag.racing. Name, start map, physics and hostname all have defaults, so a server is@{ Type = 'cpm'; Port = 27962; RsId = 1234 }. The file stays out of git: the rs ids are yours..\scripts\sync-maps.ps1for the map pool (~15 GB, takes a while).- Elevated:
.\scripts\setup-firewall.ps1, then.\scripts\generate-services.ps1 -Installand.\scripts\register-tasks.ps1. The firewall step is not optional - rules are bound to the engine's path, so a rule left over from an older install does not cover this one and the servers stay invisible from the internet while answering locally. - Verify:
Get-Service dfsv-*all Running, servers answer in-game, demos show up on defrag.racing (SFTP credential badge goes green).
- is everything up?
.\scripts\status.ps1- service state plus a live getstatus reply (hostname, players) for every server - start / stop / restart (elevated):
Get-Service dfsv-* | Restart-Service, or a single one withRestart-Service dfsv-mixed-1. They start themselves at boot (services are Automatic), so nothing has to be launched by hand. - a server's console:
.\scripts\console-gui.ps1- pick a server on the left, its log streams live on the right, and the box at the bottom sends rcon commands (Enter to send, Up/Down for history, the reply prints in the same pane). The engines run as services in session 0, so their own console window is on no desktop and cannot be attached to - this is the substitute. It opens in a process of its own, so a Ctrl+C in the shell that started it cannot reach it; the empty powershell window alongside is that process, and closing it closes the GUI. For a desktop shortcut instead of typing the path, run.\scripts\install-shortcut.ps1once. Same thing from a shell:defrag\<name>.logis that server's game log, and rcon works from any client. To get a real interactive engine window, stop the service and run.\scripts\run-server.ps1 -Name <name>yourself. - engine / mod update:
.\scripts\update-engine.ps1(elevated) - change a server (port, rs id, add/remove): edit
servers.psd1, then.\scripts\generate-services.ps1 -Installand restart that service - disable a server:
Enabled = $false, rerun generate, thentools\services\dfsv-<name>.exe uninstall - check demo upload: last run of the
dfsv-demouploadscheduled task, or the credential's badge in the defrag.racing admin