mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 23:11:55 +00:00
Dynamic tunnels (#579)
## Description: Update deployment: 1. automatically create and configure CF tunnels and point it to subdomain.domain 2. Send loki logs to remote endpoint 3. create metric-exporter.sh to push prom metrics to remote endpoint 4. update and refactor deployment & env variables ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: <DISCORD USERNAME> --------- Co-authored-by: Evan Pellegrini <evan@Evans-Air.attlocal.net> Co-authored-by: evan <openfrontio@gmail.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export abstract class DefaultServerConfig implements ServerConfig {
|
||||
return process.env.GIT_COMMIT;
|
||||
}
|
||||
r2Endpoint(): string {
|
||||
return `https://${process.env.R2_ACCOUNT_ID}.r2.cloudflarestorage.com`;
|
||||
return `https://${process.env.CF_ACCOUNT_ID}.r2.cloudflarestorage.com`;
|
||||
}
|
||||
r2AccessKey(): string {
|
||||
return process.env.R2_ACCESS_KEY;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import promClient from "prom-client";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { GameManager } from "./GameManager";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
const region = config.region();
|
||||
|
||||
// Initialize the Prometheus registry
|
||||
const register = new promClient.Registry();
|
||||
|
||||
@@ -15,21 +11,18 @@ promClient.collectDefaultMetrics({ register });
|
||||
const activeGamesGauge = new promClient.Gauge({
|
||||
name: "openfront_active_games_count",
|
||||
help: "Number of active games on this worker",
|
||||
labelNames: ["region"],
|
||||
registers: [register],
|
||||
});
|
||||
|
||||
const connectedClientsGauge = new promClient.Gauge({
|
||||
name: "openfront_connected_clients_count",
|
||||
help: "Number of connected clients on this worker",
|
||||
labelNames: ["region"],
|
||||
registers: [register],
|
||||
});
|
||||
|
||||
const memoryUsageGauge = new promClient.Gauge({
|
||||
name: "openfront_memory_usage_bytes",
|
||||
help: "Current memory usage of the worker process in bytes",
|
||||
labelNames: ["region"],
|
||||
registers: [register],
|
||||
});
|
||||
|
||||
@@ -42,11 +35,11 @@ export const metrics = {
|
||||
|
||||
// Function to update game-related metrics
|
||||
updateGameMetrics: (gameManager: GameManager) => {
|
||||
activeGamesGauge.set({ region: region }, gameManager.activeGames());
|
||||
connectedClientsGauge.set({ region: region }, gameManager.activeClients());
|
||||
activeGamesGauge.set(gameManager.activeGames());
|
||||
connectedClientsGauge.set(gameManager.activeClients());
|
||||
|
||||
// Update memory usage metrics
|
||||
const memoryUsage = process.memoryUsage();
|
||||
memoryUsageGauge.set({ region: region }, memoryUsage.heapUsed);
|
||||
memoryUsageGauge.set(memoryUsage.heapUsed);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user