diff --git a/server/config.md b/server/config.md new file mode 100644 index 00000000..3e96c595 --- /dev/null +++ b/server/config.md @@ -0,0 +1,50 @@ +# Edumeet Server Config + +| Property | Description | Format | Default value | +| :------- | :---------- | :----- | :------------ | +| turnAPIKey | TURN server key for requesting a geoip-based TURN server closest to the client. | `"string"` | ``""`` | +| turnAPIURI | TURN server URL for requesting a geoip-based TURN server closest to the client. | `"url"` | ``""`` | +| turnAPIparams.uri_schema | TURN server URL schema. | `"string"` | ``"turn"`` | +| turnAPIparams.transport | TURN server transport. | `[ "tcp", "udp"]` | ``"tcp"`` | +| turnAPIparams.ip_ver | TURN server IP version. | `[ "ipv4", "ipv6"]` | ``"ipv4"`` | +| turnAPIparams.servercount | TURN server count. | `"nat"` | ``2`` | +| turnAPITimeout | TURN server API timeout (seconds). | `"nat"` | ``2000`` | +| backupTurnServers | Backup TURN servers if REST fails or is not configured | `"*"` | ``[ { "urls": [ "turn:turn.example.com:443?transport=tcp" ], "username": "example", "credential": "example" }]`` | +| fileTracker | Bittorrent tracker. | `"string"` | ``"wss://tracker.lab.vvc.niif.hu:443"`` | +| redisOptions | Redis server options. | `"object"` | ``{}`` | +| cookieSecret | Session cookie secret. | `"string"` | ``"T0P-S3cR3t_cook!e"`` | +| cookieName | Session cookie name. | `"string"` | ``"edumeet.sid"`` | +| tls.cert | SSL certificate path. | `"string"` | ``"./certs/mediasoup-demo.localhost.cert.pem"`` | +| tls.key | SSL key path. | `"string"` | ``"./certs/mediasoup-demo.localhost.key.pem"`` | +| listeningHost | The listening Host or IP address. If omitted listens on every IP. ("0.0.0.0" and "::"). | `"string"` | ``null`` | +| listeningPort | The HTTPS listening port. | `"port"` | ``8443`` | +| listeningRedirectPort | The HTTP listening port. Any HTTP request is redirected to HTTPS. | `"port"` | ``8080`` | +| httpOnly | Listens only on HTTP on listeningPort; listeningRedirectPort disabled. Use case: load balancer backend. | `"boolean"` | ``false`` | +| trustProxy | WebServer/Express trust proxy config for httpOnly mode. More infos: https://expressjs.com/en/guide/behind-proxies.html, https://www.npmjs.com/package/proxy-addr | `"string"` | ``""`` | +| activateOnHostJoin | When true, the room will be open to all users since there are users in the room. | `"boolean"` | ``true`` | +| roomsUnlocked | An array of rooms users can enter without waiting in the lobby. | `"array"` | ``null`` | +| maxUsersPerRoom | It defines how many users can join a single room. If not set, no limit is applied. | `"nat"` | ``null`` | +| routerScaleSize | Room size before spreading to a new router. | `"nat"` | ``40`` | +| requestTimeout | Socket timeout value (ms). | `"nat"` | ``20000`` | +| requestRetries | Socket retries when a timeout occurs. | `"nat"` | ``3`` | +| mediasoup.numWorkers | The number of Mediasoup workers to spawn. | `"nat"` | ``8`` | +| mediasoup.worker.logLevel | The Mediasoup log level. | `"string"` | ``"warn"`` | +| mediasoup.worker.logTags | The Mediasoup log tags. | `"array"` | ``[ "info", "ice", "dtls", "rtp", "srtp", "rtcp"]`` | +| mediasoup.worker.rtcMinPort | The Mediasoup start listening port number. | `"port"` | ``40000`` | +| mediasoup.worker.rtcMaxPort | The Mediasoup end listening port number. | `"port"` | ``49999`` | +| mediasoup.router.mediaCodecs | The Mediasoup codecs settings. | `"object"` | ``[ { "kind": "audio", "mimeType": "audio/opus", "clockRate": 48000, "channels": 2 }, { "kind": "video", "mimeType": "video/VP8", "clockRate": 90000, "parameters": { "x-google-start-bitrate": 1000 } }, { "kind": "video", "mimeType": "video/VP9", "clockRate": 90000, "parameters": { "profile-id": 2, "x-google-start-bitrate": 1000 } }, { "kind": "video", "mimeType": "video/h264", "clockRate": 90000, "parameters": { "packetization-mode": 1, "profile-level-id": "4d0032", "level-asymmetry-allowed": 1, "x-google-start-bitrate": 1000 } }, { "kind": "video", "mimeType": "video/h264", "clockRate": 90000, "parameters": { "packetization-mode": 1, "profile-level-id": "42e01f", "level-asymmetry-allowed": 1, "x-google-start-bitrate": 1000 } }]`` | +| mediasoup.webRtcTransport.listenIps | The Mediasoup listen IPs. https://mediasoup.org/documentation/v3/mediasoup/api/#TransportListenIp | `"array"` | ``[ { "ip": "0.0.0.0", "announcedIp": null }]`` | +| mediasoup.webRtcTransport.initialAvailableOutgoingBitrate | The Mediasoup initial available outgoing bitrate (in bps). https://mediasoup.org/documentation/v3/mediasoup/api/#WebRtcTransportOptions | `"nat"` | ``1000000`` | +| mediasoup.webRtcTransport.maxIncomingBitrate | The Mediasoup maximum incoming bitrate for each transport. (in bps). https://mediasoup.org/documentation/v3/mediasoup/api/#transport-setMaxIncomingBitrate | `"nat"` | ``1500000`` | +| prometheus.deidentify | De-identify IP addresses in Prometheus logs. | `"boolean"` | ``false`` | +| prometheus.listen | Prometheus exporter listening address. | `"string"` | ``"localhost"`` | +| prometheus.numeric | Show numeric IP addresses in Prometheus logs. | `"boolean"` | ``false`` | +| prometheus.port | The Prometheus exporter listening port. | `"port"` | ``8889`` | +| prometheus.quiet | Include fewer labels in Prometheus logs. | `"boolean"` | ``false`` | +| prometheus.period | The Prometheus exporter update period (seconds). | `"nat"` | ``15`` | +| prometheus.secret | The Prometheus exporter authorization header: `Bearer ` required to allow scraping. | `"string"` | ``null`` | + + +--- + +*Document generated with:* `yarn gen-config-docs` diff --git a/server/gen-config-docs.ts b/server/gen-config-docs.ts new file mode 100644 index 00000000..515643cc --- /dev/null +++ b/server/gen-config-docs.ts @@ -0,0 +1,35 @@ +import { configDocs } from './lib/config'; +import { writeFile } from 'fs/promises'; + +function formatJson(data) +{ + return `\`${data.replace(/\n/g, '')}\``; +} + +let data = `# Edumeet Server Configuration + +| Property | Description | Format | Default value | +| :------- | :---------- | :----- | :------------ | +`; + +Object.entries(configDocs).forEach((entry: [string, any]) => +{ + const [ name, value ] = entry; + + data += `| ${name} | ${value.doc} | ${formatJson(value.format)} | \`${formatJson(value.default)}\` |\n`; +}); + +data += ` + +--- + +*Document generated with:* \`yarn gen-config-docs\` +`; + +writeFile('config.md', data).then(() => +{ + console.log('done'); // eslint-disable-line +}, (err) => +{ + console.error(`Error writing file: ${err.message}`); // eslint-disable-line +}); diff --git a/server/lib/config.ts b/server/lib/config.ts index d35c40ee..7dfb254e 100644 --- a/server/lib/config.ts +++ b/server/lib/config.ts @@ -112,12 +112,12 @@ const configSchema = convict({ cert : { doc : 'SSL certificate path.', format : String, - default : `${__dirname}/../certs/mediasoup-demo.localhost.cert.pem` + default : './certs/mediasoup-demo.localhost.cert.pem' }, key : { doc : 'SSL key path.', format : String, - default : `${__dirname}/../certs/mediasoup-demo.localhost.key.pem` + default : './certs/mediasoup-demo.localhost.key.pem' } }, listeningHost : { diff --git a/server/package.json b/server/package.json index 10a465f1..13ee8f07 100644 --- a/server/package.json +++ b/server/package.json @@ -19,7 +19,8 @@ "dev": "nodemon --exec ts-node --ignore dist/ -e js,ts server.js", "connect": "ts-node connect.js", "lint": "eslint -c .eslintrc.json --ext .js,.ts *.js *.ts lib/", - "format": "prettier --write '**/*.ts' && npm run lint --fix" + "format": "prettier --write '**/*.ts' && npm run lint --fix", + "gen-config-docs": "ts-node gen-config-docs.ts" }, "dependencies": { "awaitqueue": "^1.0.0",