Skip to content

Commit

Permalink
Beaconchain Mobile App as a Node Monitoring option to Stereum (#1459)
Browse files Browse the repository at this point in the history
* update the fetching

* fix the new api for the testers

* Revert "fix the new api for the testers"

This reverts commit ab01562.

* Revert "update the fetching"

This reverts commit b5a052c.

* add beaconcha row to notif modal

* validators added to the modal

* add the beaconcha link to go

* update the beaconchain modal

* add the inputs in the modal

* fix the beaconchain modal and frontend is done

* add internationalization to the modal

* fix the frontend

* Added Metrics Exporter

Added Metrics Exporter. Automatic configuration not yet implemented.

---------

Co-authored-by: PatrickRL <[email protected]>
  • Loading branch information
mabasian and PatrickRL authored Oct 20, 2023
1 parent e02337a commit 44b34f2
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 16 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions launcher/src/backend/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { StringUtils } from "./StringUtils";
import { ServiceVolume } from "./ethereum-services/ServiceVolume";
import { Web3SignerService } from "./ethereum-services/Web3SignerService";
import { NotificationService } from "./ethereum-services/NotificationService";
import { MetricsExporterService } from "./ethereum-services/MetricsExporterService";
import { ValidatorEjectorService } from "./ethereum-services/ValidatorEjectorService";
import { KeysAPIService } from "./ethereum-services/KeysAPIService";
import YAML from "yaml";
Expand Down Expand Up @@ -140,6 +141,8 @@ export class ServiceManager {
services.push(Web3SignerService.buildByConfiguration(config));
} else if (config.service == "NotificationService") {
services.push(NotificationService.buildByConfiguration(config));
} else if (config.service == "MetricsExporterService") {
services.push(MetricsExporterService.buildByConfiguration(config));
} else if (config.service == "ValidatorEjectorService") {
services.push(ValidatorEjectorService.buildByConfiguration(config));
} else if (config.service == "KeysAPIService") {
Expand Down Expand Up @@ -889,6 +892,9 @@ export class ServiceManager {
case "NotificationService":
return NotificationService.buildByUserInput(args.network, args.installDir + "/notification");

case "MetricsExporterService":
return MetricsExporterService.buildByUserInput(args.network);

case "ValidatorEjectorService":
return ValidatorEjectorService.buildByUserInput(args.network, args.installDir + "/validatorejector");

Expand Down Expand Up @@ -1454,4 +1460,9 @@ export class ServiceManager {
}
await this.nodeConnection.sshService.exec(`rm ${workingDir}/data/validator/key-manager/local/*.lock`)
}

async beaconchainMonitoringModification(data){
console.log(data.selectedVal +" "+ data.apiKey +" "+ data.machineName);
// NOT YET IMPLEMENTED
}
}
48 changes: 48 additions & 0 deletions launcher/src/backend/ethereum-services/MetricsExporterService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { NodeService } from "./NodeService";
import { ServiceVolume } from "./ServiceVolume";

export class MetricsExporterService extends NodeService {
static buildByUserInput(network) {
const image = "gobitfly/eth2-client-metrics-exporter";
const service = new MetricsExporterService();
const volumes = [
new ServiceVolume("/sys", "/host/sys", "ro"),
new ServiceVolume("/proc", "/host/proc", "ro"),
new ServiceVolume("/", "/host/rootfs", "ro"),
];

service.init(
"MetricsExporterService", //service
service.id, // id,
1, // configVersion
image, // image,
"latest", // imageVersion,
[
`--server.address=https://beaconcha.in/api/v1/client/metrics?apikey=<API_KEY>&machine=<MACHINE_NAME>`,
`--system.partition=/host/rootfs`,
`--beaconnode.type=prysm`,
`--beaconnode.address=http://stereum-<SERVICE_ID>:8080/metrics`,
`--validator.type=prysm`,
`--validator.address=http://stereum-<SERVICE_ID>:8081/metrics`,
], // command,
["/bin/eth2-client-metrics-exporter"], // entrypoint,
{
HOST_PROC: "/host/proc",
HOST_SYS: "/host/sys",
}, // env,
[], // ports,
volumes, // volumes,
null, // user,
network // network,
);
return service;
}

static buildByConfiguration(config) {
const service = new MetricsExporterService();

service.initByConfig(config);

return service;
}
}
4 changes: 4 additions & 0 deletions launcher/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ ipcMain.handle("IpScanLan", async () => {
return await nodeConnection.IpScanLan();
});

ipcMain.handle("beaconchainMonitoringModification", async (event, args) => {
return await serviceManager.beaconchainMonitoringModification(args)
});

// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([{ scheme: "app", privileges: { secure: true, standard: true } }]);

Expand Down
Loading

0 comments on commit 44b34f2

Please sign in to comment.