Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 55 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,68 @@ connect self

The `connect self` command will connect to the same webserver hosting the game frontend.

Check the [dedicated server documentation](./docs/dedicated.md) for more details.
### Dedicated metrics to InfluxDB

However, there’s no need for a dedicated server as the game can also establish a peer-to-peer session.
For long-running debugging you can enable periodic dedicated-server metrics export to InfluxDB.
Both InfluxDB v1 and v2 are supported.

You can start a P2P game session by typing in the following console commands:
Enable via environment variables before launch (v2 example):

```sh
INFLUXDB_ENABLE=1 \
INFLUXDB_VERSION=2 \
INFLUXDB_URL="http://127.0.0.1:8086" \
INFLUXDB_ORG="my-org" \
INFLUXDB_BUCKET="quakeshack" \
INFLUXDB_TOKEN="your-token" \
./dedicated.mjs -ip ::1 -port 3000
```
maxplayers 4
listen 1
coop 1
map start

Or set at runtime via console/cfg (v2):

```cfg
seta influxdb_enable 1
seta influxdb_version 2
seta influxdb_url "http://127.0.0.1:8086"
seta influxdb_org "my-org"
seta influxdb_bucket "quakeshack"
set influxdb_token "your-token"
seta influxdb_interval 10
```

Using the `invite` command will allow you to invite friends.
v1 example:

```cfg
seta influxdb_enable 1
seta influxdb_version 1
seta influxdb_url "http://127.0.0.1:8086"
seta influxdb_database "quakeshack"
seta influxdb_username "admin"
set influxdb_password "secret"
seta influxdb_retention_policy "autogen"
seta influxdb_precision "ms"
```

Relevant cvars:

- `influxdb_enable`
- `influxdb_version` (`auto|1|2`)
- `influxdb_url`
- `influxdb_database` (v1)
- `influxdb_username` (v1)
- `influxdb_password` (v1)
- `influxdb_retention_policy` (v1)
- `influxdb_consistency` (v1)
- `influxdb_token`
- `influxdb_org`
- `influxdb_bucket`
- `influxdb_precision` (`ns|us|ms|s`, default `ms`)
- `influxdb_tags` (global tags, e.g. `env=dev,instance=local`)
- `influxdb_interval` (seconds)
- `influxdb_batch_size`
- `influxdb_max_queue`
- `influxdb_timeout_ms`
- `influxdb_measurement_prefix`

### Extending and hacking

Expand Down
2 changes: 1 addition & 1 deletion source/engine/common/Cvar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export default class Cvar {
return true;
}

if ((v.flags & Cvar.FLAG.CHEAT) && SV.server.active && CL?.cls.serverInfo?.sv_cheats !== '1') {
if ((v.flags & Cvar.FLAG.CHEAT) && SV.server.active && !registry.isDedicatedServer && CL.cls.serverInfo?.sv_cheats !== '1') {
Con.Print('Cheats are not enabled on this server.\n');
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions source/engine/main-dedicated.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import SV from './server/Server.mjs';
import PR from './server/Progs.mjs';
import Mod from './common/Mod.mjs';
import * as WebSocket from 'ws';
import InfluxMetrics from './server/telemetry/InfluxMetrics.mjs';

export default class EngineLauncher {
static async Launch() {
Expand All @@ -40,6 +41,9 @@ export default class EngineLauncher {
registry.PR = PR;
registry.Mod = Mod;

// Optional telemetry integration (configured via influxdb_* cvars/env).
InfluxMetrics.Install();

// registry is ready
registryFreeze();

Expand Down
Loading