Start the monitoring server before all servers
MODIFY
src/start.ts
src/start.ts
@@ -121,6 +121,26 @@ export default class Bootstrap {
await this.logDuration(startTimeMillis, 'Migration has been run successfully');
}
+ // -------------------------------------------------------------------------
+ // Start Monitoring Server
+ // -------------------------------------------------------------------------
+ if (Bootstrap.monitoringConfig) {
+ // Create server instance
+ Bootstrap.monitoringServer = MonitoringServerFactory.getMonitoringServerImpl(Bootstrap.monitoringConfig);
+ // Start server instance
+ if (Bootstrap.monitoringServer) {
+ Bootstrap.monitoringServer.start();
+ } else {
+ const message = `Monitoring Server implementation does not exist '${this.monitoringConfig.implementation}'`;
+ Logging.logConsoleError(message);
+ await Logging.logError({
+ tenantID: Constants.DEFAULT_TENANT,
+ action: ServerAction.STARTUP,
+ module: MODULE_NAME, method: 'startServers', message
+ });
+ }
+ }
+
// -------------------------------------------------------------------------
// Start all the Servers
// -------------------------------------------------------------------------
@@ -172,26 +192,6 @@ export default class Bootstrap {
global.serverType = ServerType.CENTRAL_SERVER;
}
- // -------------------------------------------------------------------------
- // Start Monitoring Server
- // -------------------------------------------------------------------------
- if (Bootstrap.monitoringConfig) {
- // Create server instance
- Bootstrap.monitoringServer = MonitoringServerFactory.getMonitoringServerImpl(Bootstrap.monitoringConfig);
- // Start server instance
- if (Bootstrap.monitoringServer) {
- Bootstrap.monitoringServer.start();
- } else {
- const message = `Monitoring Server implementation does not exist '${this.monitoringConfig.implementation}'`;
- Logging.logConsoleError(message);
- await Logging.logError({
- tenantID: Constants.DEFAULT_TENANT,
- action: ServerAction.STARTUP,
- module: MODULE_NAME, method: 'startServers', message
- });
- }
- }
-
await this.logDuration(startTimeGlobalMillis, `${serverStarted.join(', ')} server has been started successfuly`, ServerAction.BOOTSTRAP_STARTUP);
} catch (error) {
Logging.logConsoleError(error);

Start the monitoring server before all servers