MCPcopy
hub / github.com/scality/cloudserver / initiateStartup

Method initiateStartup

lib/server.js:365–440  ·  view source on GitHub ↗
(log)

Source from the content-addressed store, hash-verified

363 }
364
365 initiateStartup(log) {
366 series([
367 next => metadata.setup(next),
368 next => clientCheck(true, log, next),
369 ], (err, results) => {
370 if (err) {
371 log.warn('initial health check failed, delaying startup', {
372 error: err,
373 healthStatus: results,
374 });
375 setTimeout(() => this.initiateStartup(log), 2000);
376 return;
377 }
378 log.debug('initial health check succeeded');
379 if (this.started) {
380 return;
381 }
382
383 // Start rate limit background job
384 if (this.config.rateLimiting?.enabled) {
385 startCleanupJob(logger);
386 // Start token refill job for token reservation system
387 startRefillJob(logger);
388 }
389
390 // Start API server(s)
391 this.startServer(this.config.listenOn, this.config.port, this.routeRequest);
392
393 // Start internal API server(s)
394 this.startServer(this.config.internalListenOn, this.config.internalPort, this.internalRouteRequest);
395
396 // Start metrics server(s) only if not cluster mode worker
397 if (!this.cluster && !this.worker) {
398 this.startServer(this.config.metricsListenOn, this.config.metricsPort, this.routeAdminRequest);
399 }
400
401 // Start quota service health checks
402 if (QuotaService.enabled) {
403 QuotaService?.setup(log);
404 }
405
406 // TODO this should wait for metadata healthcheck to be ok
407 // TODO only do this in cluster master
408 if (enableRemoteManagement) {
409 if (!isManagementAgentUsed()) {
410 setTimeout(() => {
411 initManagement(logger.newRequestLogger());
412 }, 5000);
413 } else {
414 initManagementClient();
415 }
416 }
417
418 try {
419 logger.info('ServerAccessLogger config', { config: _config.serverAccessLogs });
420 if (_config.serverAccessLogs.mode === serverAccessLogsModes.LOG_ONLY
421 || _config.serverAccessLogs.mode === serverAccessLogsModes.ENABLED) {
422 var serverAccessLogger = new ServerAccessLogger(

Callers 2

mainFunction · 0.95
server.jsFile · 0.80

Calls 13

startServerMethod · 0.95
clientCheckFunction · 0.85
startCleanupJobFunction · 0.85
startRefillJobFunction · 0.85
isManagementAgentUsedFunction · 0.85
initManagementFunction · 0.85
initManagementClientFunction · 0.85
setServerAccessLoggerFunction · 0.85
setupMethod · 0.80
warnMethod · 0.80
debugMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected