Skip to content

sonikro/TF2-QuickServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ TF2-QuickServer

Read the Wiki โ€“ How to Use TF2-QuickServer

Discord Better Stack Badge

TF2-QuickServer Logo
Logo by kcaugolden

Instantly deploy Team Fortress 2 servers straight from Discord โ€” powered by Docker, multi-cloud architecture (Oracle Cloud & AWS), and SDR.


๐Ÿš€ Overview

TF2-QuickServer is a Discord bot that lets you spawn TF2 servers instantly in multiple regions using a multi-cloud architecture. Deploy servers on Oracle Container Instances for most regions, or AWS Local Zones for ultra-low latency in specific locations like Buenos Aires. Whether you're playing competitive or just want to chill with friends, it's never been easier to get a server up and running in a few minutes.


โœจ Features

  • โœ… Quick Server Deployment โ€“ Spin up a TF2 server from scratch in 3 minutes with a simple Discord commandโ€”no technical knowledge required
  • ๐ŸŒ Multi-Cloud Global Deployment โ€“ Deploy servers across Oracle Cloud regions worldwide, plus AWS Local Zones for ultra-low latency in select cities like Buenos Aires
  • ๐Ÿ›ก๏ธ Advanced DDoS Protection โ€“ Every server is protected by the custom-built TF2-QuickServer-Shield, an intelligent agent that actively monitors and blocks DDoS attacks in real time, with in-game notifications for your peace of mind
  • ๐Ÿ›† Isolated Containerized Architecture โ€“ Each server runs in its own secure Docker container, ensuring full isolation and reliability
  • โฑ๏ธ Automatic Cost Savings โ€“ Idle servers are automatically terminated after 10 minutes to save resources and keep costs low

๐Ÿง How It Works

  1. Join our Discord Channel or use the Bot in any of our Partnered Guilds
  2. Run a Command โ€“ Example: /create-server sa-saopaulo-1
  3. Select a Variant โ€“ Use the buttons shown in Discord to pick your server type (e.g., standard-competitive).
  4. Receive Server Info โ€“ Get detailed connection info for your server, including SDR, direct, and TV connect addresses.
  5. Play! โ€“ Join with friends and frag away!

โš™๏ธ Tech Stack

  • ๐Ÿ› ๏ธ Terraform โ€“ Provisions all necessary cloud infrastructure across Oracle Cloud and AWS
  • ๐Ÿงช Multi-Cloud SDKs โ€“ OCI-SDK (Node.js) for Oracle Cloud Container Instances, AWS SDK for ECS deployments in Local Zones
  • ๐Ÿ“‚ SQLite โ€“ Fast, local database to track server and user state
  • ๐Ÿณ Docker โ€“ All servers are built from containerized images
  • ๐Ÿฆซ GoLang โ€“ Powers the custom TF2-QuickServer-Shield for advanced DDoS protection and network monitoring

๐Ÿ“˜ Commands

Command Description
/create-server <region> Launches a server in the selected region (you'll be prompted to select a variant)
/get-my-servers Retrieves all your active server details (IPs, passwords, etc.) in case you lost the original message
/status Shows the current status of all servers across all regions (running, pending, terminating counts)
/terminate-servers Terminates all servers created by the user
/set-user-data <steamId> Sets the SteamID of the user, assigning them as the Sourcemod admin for all servers the user creates

๐ŸŒŽ Supported Regions

The main TF2-QuickServer app currently supports the following regions for instant server deployment:

Oracle Cloud Infrastructure (OCI)

  • ๐Ÿ‡จ๐Ÿ‡ฑ Santiago
  • ๐Ÿ‡ง๐Ÿ‡ท Sรฃo Paulo
  • ๐Ÿ‡จ๐Ÿ‡ด Bogotรก
  • ๐Ÿ‡บ๐Ÿ‡ธ Chicago
  • ๐Ÿ‡ฉ๐Ÿ‡ช Frankfurt
  • ๐Ÿ‡ฆ๐Ÿ‡บ Sydney

AWS Local Zones

  • ๐Ÿ‡ฆ๐Ÿ‡ท Buenos Aires (Experimental) โ€“ Ultra-low latency deployment using AWS Local Zone
  • ๐Ÿ‡ต๐Ÿ‡ช Lima (Experimental) โ€“ Ultra-low latency deployment using AWS Local Zone

If you are self-hosting, you can use any region that supports Oracle Container Instances or AWS ECS in Local Zones.
See the full lists: Oracle Cloud Regions | AWS Local Zones


๐Ÿ”ง Self-Hosting

Want to run your own version? Follow the steps below:

1๏ธโƒฃ Clone the Repo

git clone https://github.com/sonikro/TF2-QuickServer.git
cd TF2-QuickServer

2๏ธโƒฃ Configure Environment

Create a .env file:

# Discord Bot
DISCORD_TOKEN=
DISCORD_CLIENT_ID=

# Oracle Cloud Auth (required for OCI regions)
OCI_CONFIG_FILE=

# AWS Auth (required for AWS Local Zone regions)
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# Third-party Services
DEMOS_TF_APIKEY=
LOGS_TF_APIKEY=

3๏ธโƒฃ Install Dependencies

npm install

๐Ÿ—บ๏ธ Maps Setup (Fat Images)

Oracle Container Instances do not support NFS or shared file systems like FSS. Instead, this project uses Docker fat images that bake in all TF2 maps directly.

Download maps:

npm run download:maps

This will create the maps/ folder and download all maps listed in maps.json.

๐Ÿ“ Maps are gitignored and stored in a local maps folder.
The mapdownloader plugin is also included and will attempt to fetch missing maps dynamically if needed.


โ˜๏ธ Deploy Multi-Cloud Infrastructure

Make sure you're authenticated with both OCI and AWS (if using Local Zones). Then run:

npm run terraform:deploy

This command runs Terraform to create required infrastructure across Oracle Cloud and AWS, and generates a config/local.json file with all outputs.
TF2-QuickServer code reads this file at runtime to determine which cloud resources to use.

Authentication info:
๐Ÿ“– OCI SDK Authentication Docs
๐Ÿ“– AWS CLI Authentication Docs


๐Ÿงช Run the Bot

npm run dev

Running with Docker Compose

services:
  tf2-quickserver:
    image: sonikro/tf2-quickserver:latest
    restart: always
    ports:
      - 8000:3000
    env_file:
      - .env
    volumes:
      - ./db:/app/db
      - ./config:/app/config:ro
      - ./keys:/app/keys:ro

Make sure you have your config files in the ./config directory


๐Ÿ“ˆ Observability & OpenTelemetry

TF2-QuickServer is instrumented for full observability using OpenTelemetry. This enables you to collect traces, metrics, and logs from the bot and supporting services, making it easy to monitor performance, troubleshoot issues, and gain insights into server operations.

If the environment variable NEW_RELIC_LICENSE_KEY is set, a New Relic agent (newrelic-infra sidecar container) will automatically run on each Oracle server instance for enhanced infrastructure monitoring and reporting to New Relic.

To enable OpenTelemetry data export from the Discord App, set the following environment variables in your .env file or deployment configuration:

# OpenTelemetry Exporter Configuration
OTEL_SERVICE_NAME=tf2-quickserver
OTEL_RESOURCE_ATTRIBUTES=service.environment=localhost
OTEL_EXPORTER_OTLP_ENDPOINT=
OTEL_EXPORTER_OTLP_HEADERS=api-key=
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT=
OTEL_EXPORTER_OTLP_COMPRESSION=gzip
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta

๐Ÿค Contributing

Contributions are welcome! Open a PR, suggest improvements, or file an issue if something breaks.


๐Ÿ“œ License

MIT


๐Ÿ’ฌ Support

Need help? Want to chat with other players or devs?
Join the Discord or open a GitHub Issue.


About

Discord Bot that Spawn TF2 Servers on Demand

Topics

Resources

Stars

Watchers

Forks

Packages