Skip to content

Metastruct/serverportals

Repository files navigation

Server portals for Garry's Mod

image

Work in progress: AI Slop garbage for quick and dirty POC.

Source Dedicated Server portal API. A FastAPI daemon that polls SRCDS game servers via the a2s protocol and exposes their status (players, map, etc.) over a REST API.

Later will include a lua 3D2D portal system.

Nginx reverse proxy

Include serverportal.conf in your nginx config:

include /home/serverportal/serverportal/serverportal.conf;

The API uses root_path="/a2s" so change accordingly.

Systemd (user service)

Run as a systemd user service so it starts on boot and restarts on failure.

Usage

cp serverportal_api.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now serverportal_api
systemctl --user status serverportal_api

How it works

  • On startup, the daemon reads config.json (a list of server entries with address, appid, etc.) and resolves any domain names to IPs.
  • Every 61 seconds it polls all servers in parallel using the A2S_INFO query to collect current player counts, map name, game info, etc.
  • Results are served over HTTP via two endpoints:
    • GET /a2s/servers — list of all servers with live status.
    • GET /a2s/servers/{id} — single server by ID.
    • GET /a2s/health — health check.
  • Responses include short-lived Cache-Control headers (10s for server data, 60s for health).

About

Garry's Mod lua code and REST API for ingame "server portals"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors