Skip to main content

Self-Hosting the Server

info

You do not need this page to use vacs. The project runs a central server at vacs.network, and every vacs client connects to it by default. This page is for operators who want to run their own instance, for example for a closed test environment.

warning

Controllers connected to your server cannot call anyone on the official server, and vice versa. Every controller who should reach you must point their client at your server.

What you need​

  • The server image, ghcr.io/vacs-project/vacs-server. Images are tagged by version (3.0.0), minor version (3.0) and major version (3). There is no latest tag.
  • Valkey or Redis, reachable from the server. It stores sessions and tokens.
  • A VATSIM Connect OAuth client. Controllers log in with their VATSIM account, so the server needs its own client ID and secret from VATSIM.
  • A reverse proxy that terminates TLS, such as Caddy, nginx or Traefik. The server itself speaks plain HTTP, and its session cookie is marked secure by default, so it must be reached over HTTPS. The proxy must pass WebSocket upgrades through on /ws.
  • Outbound internet access to VATSIM (login, data feed) and, if you use it, GitHub (dataset and release information).

Running the container​

The image exposes two ports and two volumes:

Purpose
Port 3000The main HTTP and WebSocket listener. Put your reverse proxy in front of it.
Port 9200Prometheus metrics at /metrics. Do not expose it publicly.
/etc/vacs-serverConfiguration. The server reads config.toml and release_policy.toml from here.
/var/lib/vacs-server/dataState the server writes itself, currently the downloaded FIR dataset. Use a named volume.

The container runs as a non-root user (UID 65532) and has a built-in health check that requests /health.

A minimal docker-compose.yml:

services:
valkey:
image: valkey/valkey:9-alpine
restart: unless-stopped

vacs-server:
image: ghcr.io/vacs-project/vacs-server:3
restart: unless-stopped
depends_on:
- valkey
ports:
- "127.0.0.1:3000:3000"
volumes:
- ./config:/etc/vacs-server:ro
- vacs-data:/var/lib/vacs-server/data
env_file:
- secrets.env

volumes:
vacs-data:

Configuration​

Settings are read from these sources, each overriding the one before it:

  1. Built-in defaults.
  2. /etc/vacs-server/config.toml.
  3. config.toml in the working directory.
  4. Environment variables.

Every file is optional. Environment variables start with VACS-, use - between levels and keep the _ inside a key name. For example, session.signing_key is set by VACS-SESSION-SIGNING_KEY. Variable names are not case sensitive. Because the names contain hyphens, set them through an env file or your orchestrator, not through export in a shell.

The server refuses to start if auth.oauth.client_id, auth.oauth.client_secret or session.signing_key is empty.

Minimal configuration​

config/config.toml:

[redis]
addr = "redis://valkey:6379"

[auth.oauth]
auth_url = "https://auth.vatsim.net/oauth/authorize"
token_url = "https://auth.vatsim.net/oauth/token"
redirect_url = "https://vacs.example.org/auth/vatsim/redirect"

[vatsim.user_service]
user_details_endpoint_url = "https://auth.vatsim.net/api/user"

[server]
client_ip_source = "RightmostXForwardedFor"

[admin.dataset]
owner = "vacs-project"
repo = "vacs-data"
deployed_tag = "deployed/production"

secrets.env:

VACS-AUTH-OAUTH-CLIENT_ID=your-client-id
VACS-AUTH-OAUTH-CLIENT_SECRET=your-client-secret
VACS-SESSION-SIGNING_KEY=at-least-64-random-characters
warning

The VATSIM URLs default to the VATSIM Connect sandbox (auth-dev.vatsim.net). Set them to production as shown above unless you registered your OAuth client in the sandbox.

Settings​

Durations are written as a table of seconds and nanoseconds, for example { secs = 30, nanos = 0 }.

[server]​

KeyDefaultDescription
bind_addr"0.0.0.0:3000"Address and port of the main listener.
metrics_bind_addr"0.0.0.0:9200"Address and port of the metrics listener.
client_ip_source"ConnectInfo"Where the server reads a client's IP address from, used for rate limiting and logs. ConnectInfo uses the TCP peer and is only right without a proxy. Behind a proxy, use the header your proxy sets: RightmostXForwardedFor, XRealIp, RightmostForwarded, CfConnectingIp, TrueClientIp, FlyClientIp, CloudFrontViewerAddress or XEnvoyExternalAddress.
debug_endpointsfalseEnables endpoints under /debug that show the loaded coverage data. Leave off in production.

[redis]​

KeyDefaultDescription
addr"redis://127.0.0.1:6379"Connection URL of the Valkey or Redis instance.

[session]​

KeyDefaultDescription
signing_keynone, requiredSecret used to sign session cookies. Must be at least 64 bytes long, or the server fails at startup. Keep it stable: changing it logs out every controller.
securetrueMarks the session cookie as HTTPS-only.
http_onlytrueHides the session cookie from scripts.
expiry_secs604800 (7 days)How long a session stays valid without activity.

[auth] and [auth.oauth]​

KeyDefaultDescription
auth.oauth.client_idnone, requiredClient ID of your VATSIM Connect OAuth client.
auth.oauth.client_secretnone, requiredClient secret of your VATSIM Connect OAuth client.
auth.oauth.auth_urlVATSIM sandboxVATSIM Connect authorization endpoint.
auth.oauth.token_urlVATSIM sandboxVATSIM Connect token endpoint.
auth.oauth.redirect_url"http://localhost:3000/auth/vatsim/redirect"Your server's public address followed by /auth/vatsim/redirect. Register exactly this URL with VATSIM.
auth.oauth.deep_link_url"vacs://auth/vatsim/callback"Where the server hands the login back to the vacs client. Leave unchanged.
auth.login_flow_timeout_millis10000Time allowed for a login to complete.
auth.api_token.expiry_secs86400 (24 hours)Lifetime of API tokens.

[vatsim]​

KeyDefaultDescription
require_active_connectiontrueOnly lets controllers connect while they are logged in to VATSIM as ATC.
user_service.user_details_endpoint_urlVATSIM sandboxVATSIM Connect user details endpoint.
slurper_base_url"https://slurper.vatsim.net"VATSIM slurper, used to look up a controller's position.
data_feed_url"https://data.vatsim.net/v3/vatsim-data.json"VATSIM data feed.
data_feed_timeout2 secondsRequest timeout for the data feed.
data_feed_cache_ttl15 secondsHow long a data feed response is reused. Should not exceed controller_update_interval.
data_feed_position_grace_period90 secondsHow long after connecting a controller's position is held while the data feed catches up.
controller_update_interval30 secondsHow often online controllers are checked against the data feed.
coverage_dir"/var/lib/vacs-server/data/coverage"Where the FIR dataset is stored. Must be a subdirectory of the data volume, not the volume root.

[admin] and [admin.dataset]​

The server needs the FIR dataset from vacs-data to know which positions and stations exist. With [admin.dataset] set, it downloads the dataset from GitHub at startup whenever the deployed tag points to a newer commit, and falls back to the copy on disk if GitHub is unreachable. Without it, the server only loads whatever is already in coverage_dir. If that is empty, the server starts with no positions or stations, and no controller can be placed on a position.

KeyDefaultDescription
dataset.owner"vacs-project"GitHub owner of the dataset repository.
dataset.repo"vacs-data"Name of the dataset repository.
dataset.deployed_tag"deployed/production"Tag that marks the dataset version to use.
dataset.app_id, dataset.app_private_key, dataset.installation_idnoneGitHub App credentials. Optional for a public repository.
oidc_audience, oidc_allowed_sub, oidc_allowed_sub_releasesAuthorize the /admin reload endpoints for GitHub Actions. Leave unset unless you run your own deployment pipeline.

[updates]​

The server tells clients whether a newer vacs version is available. It needs a release catalog for that. Without one, clients connected to your server are never offered updates.

KeyDefaultDescription
policy_path"/etc/vacs-server/release_policy.toml"Optional file marking versions as required updates and limiting which client protocol versions may connect. Without it, every version is accepted and no update is required.
catalog.backend"File""File" reads releases from a local TOML file, "GitHub" reads them from a repository's GitHub releases.
catalog.path"releases.toml"With File: path to the release file.
catalog.owner, catalog.repoWith GitHub: repository to read releases from.
catalog.release_cache_ttl4 hoursWith GitHub: how long the release list is cached.
catalog.signature_cache_ttl24 hoursWith GitHub: how long the signatures of release files are cached.

To offer the official vacs releases:

[updates.catalog]
backend = "GitHub"
owner = "vacs-project"
repo = "vacs"

[ice]​

Calls are set up over WebRTC, which needs STUN and usually TURN servers. The server hands their addresses to clients.

KeyDefaultDescription
provider"StunOnly""StunOnly", "Cloudflare" or "Coturn". STUN alone fails for controllers behind strict NATs or firewalls.
stun_serversCloudflare STUNWith StunOnly: list of STUN URLs.
cloudflare_turn_key_id, cloudflare_turn_key_api_tokennoneWith Cloudflare: Cloudflare Realtime TURN credentials.
turn_credential_ttl6 hoursWith Cloudflare: lifetime of issued TURN credentials.
coturn.auth_secretWith Coturn: the shared secret configured as static-auth-secret in coturn.
coturn.stun_urls, coturn.turn_urls, coturn.turns_urlsWith Coturn: lists of URLs to hand out.
coturn.ttlWith Coturn: lifetime of issued TURN credentials, in seconds.

[call] and [rate_limiters]​

KeyDefaultDescription
call.max_conf_size8Maximum number of participants and invited targets in a conference call.
rate_limiters.enabledtrueTurns all rate limits on or off. The individual limits (call_invite, failed_auth, version_update, vatsim_token) rarely need changing.

Logging​

Logs go to standard output. Set RUST_LOG to change the log filter, for example RUST_LOG=info, and set RUST_LOG_JSON=1 for one JSON object per line.

Endpoints​

These are the paths your reverse proxy must forward. All are served on the main listener.

PathPurpose
/wsWebSocket connection of the vacs client, plus token and disconnect requests under /ws/....
/auth/...Login with VATSIM, including the OAuth redirect.
/version/updateUpdate check.
/webrtc/ice-configSTUN and TURN servers for calls.
/healthHealth check. Answers with a success status while the server is running.
/versionServer version.
/assets/...Static files used by the login pages.
/admin/...Dataset and release reload, only usable with GitHub OIDC configured.

The protocol between the client and the server is internal to vacs. It changes together with the client and is not meant for third-party clients.

Connecting clients​

Each controller sets both addresses in their client's config.toml, as described in Using a different server:

[backend]
base_url = "https://vacs.example.org"
ws_url = "wss://vacs.example.org/ws"