2023-12-01 16:20:52 +00:00
|
|
|
# Fluffy
|
2024-01-25 10:04:09 +00:00
|
|
|
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
2021-06-16 19:18:45 +00:00
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
2023-01-31 12:38:08 +00:00
|
|
|
{.push raises: [].}
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
import
|
2024-09-26 08:09:34 +00:00
|
|
|
std/[os, enumutils, exitprocs],
|
2024-02-28 17:31:45 +00:00
|
|
|
confutils,
|
|
|
|
confutils/std/net,
|
|
|
|
chronicles,
|
|
|
|
chronicles/topics_registry,
|
|
|
|
chronos,
|
|
|
|
metrics,
|
|
|
|
metrics/chronos_httpserver,
|
|
|
|
json_rpc/clients/httpclient,
|
2024-05-30 12:54:03 +00:00
|
|
|
results,
|
|
|
|
stew/[byteutils, io2],
|
2024-10-04 21:21:26 +00:00
|
|
|
eth/common/keys,
|
2024-02-28 17:31:45 +00:00
|
|
|
eth/net/nat,
|
2021-06-16 19:18:45 +00:00
|
|
|
eth/p2p/discoveryv5/protocol as discv5_protocol,
|
2024-02-28 17:31:45 +00:00
|
|
|
./conf,
|
|
|
|
./network_metadata,
|
|
|
|
./common/common_utils,
|
2024-10-07 14:33:02 +00:00
|
|
|
./rpc/[
|
|
|
|
rpc_eth_api, rpc_debug_api, rpc_discovery_api, rpc_portal_common_api,
|
|
|
|
rpc_portal_history_api, rpc_portal_beacon_api, rpc_portal_state_api,
|
2024-10-30 17:32:36 +00:00
|
|
|
rpc_portal_nimbus_beacon_api, rpc_portal_debug_history_api,
|
2024-10-07 14:33:02 +00:00
|
|
|
],
|
2023-12-01 16:20:52 +00:00
|
|
|
./database/content_db,
|
2024-07-09 17:22:25 +00:00
|
|
|
./portal_node,
|
2024-02-28 17:31:45 +00:00
|
|
|
./version,
|
|
|
|
./logging
|
2023-04-19 15:01:01 +00:00
|
|
|
|
2024-02-28 17:31:45 +00:00
|
|
|
chronicles.formatIt(IoErrorCode):
|
|
|
|
$it
|
2021-07-02 05:30:48 +00:00
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
func optionToOpt[T](o: Option[T]): Opt[T] =
|
|
|
|
if o.isSome():
|
|
|
|
Opt.some(o.unsafeGet())
|
2024-06-20 02:48:45 +00:00
|
|
|
else:
|
2024-07-09 17:22:25 +00:00
|
|
|
Opt.none(T)
|
2024-06-20 02:48:45 +00:00
|
|
|
|
2024-09-20 12:54:36 +00:00
|
|
|
proc run(
|
|
|
|
config: PortalConf
|
|
|
|
): (PortalNode, Opt[MetricsHttpServerRef], Opt[RpcHttpServer], Opt[RpcWebSocketServer]) {.
|
|
|
|
raises: [CatchableError]
|
|
|
|
.} =
|
2024-07-15 09:41:17 +00:00
|
|
|
setupLogging(config.logLevel, config.logStdout, none(OutFile))
|
2023-04-19 15:01:01 +00:00
|
|
|
|
2024-02-28 17:31:45 +00:00
|
|
|
notice "Launching Fluffy", version = fullVersionStr, cmdParams = commandLineParams()
|
2023-04-19 15:01:01 +00:00
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
let rng = newRng()
|
|
|
|
|
2022-03-18 12:06:57 +00:00
|
|
|
# Make sure dataDir exists
|
|
|
|
let pathExists = createPath(config.dataDir.string)
|
|
|
|
if pathExists.isErr():
|
2024-02-28 17:31:45 +00:00
|
|
|
fatal "Failed to create data directory",
|
|
|
|
dataDir = config.dataDir, error = pathExists.error
|
2024-09-26 08:09:34 +00:00
|
|
|
quit QuitFailure
|
|
|
|
|
|
|
|
# Make sure multiple instances to the same dataDir do not exist
|
|
|
|
let
|
|
|
|
lockFilePath = config.dataDir.string / "fluffy.lock"
|
|
|
|
lockFlags = {OpenFlags.Create, OpenFlags.Read, OpenFlags.Write}
|
|
|
|
lockFileHandleResult = openFile(lockFilePath, lockFlags)
|
|
|
|
|
|
|
|
if lockFileHandleResult.isErr():
|
|
|
|
fatal "Failed to open lock file", error = ioErrorMsg(lockFileHandleResult.error)
|
|
|
|
quit QuitFailure
|
|
|
|
|
|
|
|
let lockFileHandle = lockFile(lockFileHandleResult.value(), LockType.Exclusive)
|
|
|
|
if lockFileHandle.isErr():
|
|
|
|
fatal "Please ensure no other fluffy instances are running with the same data directory",
|
|
|
|
dataDir = config.dataDir
|
|
|
|
quit QuitFailure
|
|
|
|
|
|
|
|
let lockFileIoHandle = lockFileHandle.value()
|
|
|
|
addExitProc(
|
|
|
|
proc() =
|
|
|
|
discard unlockFile(lockFileIoHandle)
|
|
|
|
discard closeFile(lockFileIoHandle.handle)
|
|
|
|
)
|
2022-03-18 12:06:57 +00:00
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
## Network configuration
|
2021-06-16 19:18:45 +00:00
|
|
|
let
|
|
|
|
bindIp = config.listenAddress
|
|
|
|
udpPort = Port(config.udpPort)
|
|
|
|
# TODO: allow for no TCP port mapping!
|
|
|
|
(extIp, _, extUdpPort) =
|
2024-02-28 17:31:45 +00:00
|
|
|
try:
|
|
|
|
setupAddress(config.nat, config.listenAddress, udpPort, udpPort, "fluffy")
|
|
|
|
except CatchableError as exc:
|
|
|
|
raise exc # TODO: Ideally we don't have the Exception here
|
|
|
|
except Exception as exc:
|
|
|
|
raiseAssert exc.msg
|
2023-09-25 19:08:10 +00:00
|
|
|
(netkey, newNetKey) =
|
2022-02-17 13:13:39 +00:00
|
|
|
if config.networkKey.isSome():
|
2023-09-25 19:08:10 +00:00
|
|
|
(config.networkKey.get(), true)
|
2022-02-17 13:13:39 +00:00
|
|
|
else:
|
2023-09-25 19:08:10 +00:00
|
|
|
getPersistentNetKey(rng[], config.networkKeyFile)
|
|
|
|
|
|
|
|
enrFilePath = config.dataDir / "fluffy_node.enr"
|
|
|
|
previousEnr =
|
|
|
|
if not newNetKey:
|
|
|
|
getPersistentEnr(enrFilePath)
|
|
|
|
else:
|
|
|
|
Opt.none(enr.Record)
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2021-11-24 11:12:25 +00:00
|
|
|
var bootstrapRecords: seq[Record]
|
|
|
|
loadBootstrapFile(string config.bootstrapNodesFile, bootstrapRecords)
|
|
|
|
bootstrapRecords.add(config.bootstrapNodes)
|
|
|
|
|
2024-07-23 13:40:28 +00:00
|
|
|
case config.network
|
2024-06-18 07:32:57 +00:00
|
|
|
of PortalNetwork.none:
|
|
|
|
discard # don't connect to any network bootstrap nodes
|
|
|
|
of PortalNetwork.mainnet:
|
2024-05-22 15:10:31 +00:00
|
|
|
for enrURI in mainnetBootstrapNodes:
|
2024-06-27 15:59:08 +00:00
|
|
|
let res = enr.Record.fromURI(enrURI)
|
|
|
|
if res.isOk():
|
|
|
|
bootstrapRecords.add(res.value)
|
2024-06-18 07:32:57 +00:00
|
|
|
of PortalNetwork.angelfood:
|
|
|
|
for enrURI in angelfoodBootstrapNodes:
|
2024-06-27 15:59:08 +00:00
|
|
|
let res = enr.Record.fromURI(enrURI)
|
|
|
|
if res.isOk():
|
|
|
|
bootstrapRecords.add(res.value)
|
2022-03-17 17:39:24 +00:00
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
## Discovery v5 protocol setup
|
2022-02-02 21:48:33 +00:00
|
|
|
let
|
2024-02-28 17:31:45 +00:00
|
|
|
discoveryConfig =
|
|
|
|
DiscoveryConfig.init(config.tableIpLimit, config.bucketIpLimit, config.bitsPerHop)
|
2022-02-02 21:48:33 +00:00
|
|
|
d = newProtocol(
|
2022-02-17 13:13:39 +00:00
|
|
|
netkey,
|
2024-02-28 17:31:45 +00:00
|
|
|
extIp,
|
2024-06-19 01:57:45 +00:00
|
|
|
Opt.none(Port),
|
2024-02-28 17:31:45 +00:00
|
|
|
extUdpPort,
|
2023-09-20 10:19:40 +00:00
|
|
|
# Note: The addition of default clientInfo to the ENR is a temporary
|
|
|
|
# measure to easily identify & debug the clients used in the testnet.
|
|
|
|
# Might make this into a, default off, cli option.
|
|
|
|
localEnrFields = {"c": enrClientInfoShort},
|
2022-02-02 21:48:33 +00:00
|
|
|
bootstrapRecords = bootstrapRecords,
|
2024-07-09 17:22:25 +00:00
|
|
|
previousRecord = previousEnr,
|
2024-02-28 17:31:45 +00:00
|
|
|
bindIp = bindIp,
|
|
|
|
bindPort = udpPort,
|
2022-02-02 21:48:33 +00:00
|
|
|
enrAutoUpdate = config.enrAutoUpdate,
|
|
|
|
config = discoveryConfig,
|
2024-02-28 17:31:45 +00:00
|
|
|
rng = rng,
|
|
|
|
)
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
d.open()
|
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
## Force pruning - optional
|
2023-11-23 10:44:57 +00:00
|
|
|
if config.forcePrune:
|
2024-02-28 17:31:45 +00:00
|
|
|
let db = ContentDB.new(
|
2024-07-23 13:40:28 +00:00
|
|
|
config.dataDir / config.network.getDbDirectory() / "contentdb_" &
|
2024-02-28 17:31:45 +00:00
|
|
|
d.localNode.id.toBytesBE().toOpenArray(0, 8).toHex(),
|
2023-11-21 15:16:15 +00:00
|
|
|
storageCapacity = config.storageCapacityMB * 1_000_000,
|
2024-09-05 16:31:55 +00:00
|
|
|
radiusConfig = config.radiusConfig,
|
|
|
|
localId = d.localNode.id,
|
2024-02-28 17:31:45 +00:00
|
|
|
manualCheckpoint = true,
|
|
|
|
)
|
2023-11-23 10:44:57 +00:00
|
|
|
|
2024-09-05 16:31:55 +00:00
|
|
|
let radius = db.estimateNewRadius(config.radiusConfig)
|
2023-11-23 10:44:57 +00:00
|
|
|
# Note: In the case of dynamical radius this is all an approximation that
|
|
|
|
# heavily relies on uniformly distributed content and thus will always
|
|
|
|
# have an error margin, either down or up of the requested capacity.
|
|
|
|
# TODO I: Perhaps we want to add an offset to counter the latter.
|
|
|
|
# TODO II: Perhaps for dynamical radius, we want to also apply the vacuum
|
|
|
|
# without the forcePrune flag and purely by checking the amount of free
|
2024-04-02 18:50:05 +00:00
|
|
|
# space versus the pruning fraction. The problem with this is that the
|
|
|
|
# vacuum will temporarily double the space usage (WAL + DB) and thus to do
|
|
|
|
# this automatically without user requesting it could be dangerous.
|
2023-11-23 10:44:57 +00:00
|
|
|
# TODO III: Adding Radius metadata to the db could be yet another way to
|
|
|
|
# decide whether or not to force prune, instead of this flag.
|
|
|
|
db.forcePrune(d.localNode.id, radius)
|
2023-11-21 15:16:15 +00:00
|
|
|
db.close()
|
|
|
|
|
2024-07-09 17:22:25 +00:00
|
|
|
## Portal node setup
|
2022-01-14 15:07:14 +00:00
|
|
|
let
|
2024-07-09 17:22:25 +00:00
|
|
|
portalProtocolConfig = PortalProtocolConfig.init(
|
2024-11-25 12:16:27 +00:00
|
|
|
config.tableIpLimit, config.bucketIpLimit, config.bitsPerHop, config.alpha,
|
|
|
|
config.radiusConfig, config.disablePoke, config.maxGossipNodes,
|
|
|
|
config.contentCacheSize, config.disableContentCache, config.maxConcurrentOffers,
|
2022-05-12 16:04:37 +00:00
|
|
|
)
|
2024-07-09 17:22:25 +00:00
|
|
|
|
|
|
|
portalNodeConfig = PortalNodeConfig(
|
|
|
|
accumulatorFile: config.accumulatorFile.optionToOpt().map(
|
|
|
|
proc(v: InputFile): string =
|
|
|
|
$v
|
|
|
|
),
|
|
|
|
disableStateRootValidation: config.disableStateRootValidation,
|
|
|
|
trustedBlockRoot: config.trustedBlockRoot.optionToOpt(),
|
|
|
|
portalConfig: portalProtocolConfig,
|
|
|
|
dataDir: string config.dataDir,
|
|
|
|
storageCapacity: config.storageCapacityMB * 1_000_000,
|
2024-10-25 07:15:01 +00:00
|
|
|
contentRequestRetries: config.contentRequestRetries.int,
|
2024-07-09 17:22:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
node = PortalNode.new(
|
2024-07-23 13:40:28 +00:00
|
|
|
config.network,
|
2024-07-09 17:22:25 +00:00
|
|
|
portalNodeConfig,
|
|
|
|
d,
|
2024-07-23 13:40:28 +00:00
|
|
|
config.portalSubnetworks,
|
2024-07-09 17:22:25 +00:00
|
|
|
bootstrapRecords = bootstrapRecords,
|
|
|
|
rng = rng,
|
|
|
|
)
|
2022-02-11 13:43:10 +00:00
|
|
|
|
2021-11-24 11:12:25 +00:00
|
|
|
# TODO: If no new network key is generated then we should first check if an
|
|
|
|
# enr file exists, and in the case it does read out the seqNum from it and
|
|
|
|
# reuse that.
|
|
|
|
let enrFile = config.dataDir / "fluffy_node.enr"
|
|
|
|
if io2.writeFile(enrFile, d.localNode.record.toURI()).isErr:
|
|
|
|
fatal "Failed to write the enr file", file = enrFile
|
|
|
|
quit 1
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2023-03-17 09:19:17 +00:00
|
|
|
## Start metrics HTTP server
|
2024-09-20 12:54:36 +00:00
|
|
|
let metricsServer =
|
|
|
|
if config.metricsEnabled:
|
|
|
|
let
|
|
|
|
address = config.metricsAddress
|
|
|
|
port = config.metricsPort
|
|
|
|
url = "http://" & $address & ":" & $port & "/metrics"
|
|
|
|
|
|
|
|
server = MetricsHttpServerRef.new($address, port).valueOr:
|
|
|
|
error "Could not instantiate metrics HTTP server", url, error
|
|
|
|
quit QuitFailure
|
|
|
|
|
|
|
|
info "Starting metrics HTTP server", url
|
|
|
|
try:
|
|
|
|
waitFor server.start()
|
|
|
|
except MetricsError as exc:
|
|
|
|
fatal "Could not start metrics HTTP server",
|
|
|
|
url, error_msg = exc.msg, error_name = exc.name
|
2024-06-25 10:06:39 +00:00
|
|
|
quit QuitFailure
|
|
|
|
|
2024-09-20 12:54:36 +00:00
|
|
|
Opt.some(server)
|
|
|
|
else:
|
|
|
|
Opt.none(MetricsHttpServerRef)
|
|
|
|
|
|
|
|
## Start the Portal node.
|
2024-07-09 17:22:25 +00:00
|
|
|
node.start()
|
|
|
|
|
|
|
|
## Start the JSON-RPC APIs
|
2024-03-15 09:41:41 +00:00
|
|
|
|
2024-09-25 14:44:46 +00:00
|
|
|
let rpcFlags = getRpcFlags(config.rpcApi)
|
|
|
|
|
2024-09-18 13:27:24 +00:00
|
|
|
proc setupRpcServer(
|
|
|
|
rpcServer: RpcHttpServer | RpcWebSocketServer
|
|
|
|
) {.raises: [CatchableError].} =
|
2024-09-25 14:44:46 +00:00
|
|
|
for rpcFlag in rpcFlags:
|
|
|
|
case rpcFlag
|
|
|
|
of RpcFlag.eth:
|
|
|
|
rpcServer.installEthApiHandlers(
|
|
|
|
node.historyNetwork, node.beaconLightClient, node.stateNetwork
|
|
|
|
)
|
|
|
|
of RpcFlag.debug:
|
|
|
|
rpcServer.installDebugApiHandlers(node.stateNetwork)
|
|
|
|
of RpcFlag.portal:
|
|
|
|
if node.historyNetwork.isSome():
|
2024-10-07 14:33:02 +00:00
|
|
|
rpcServer.installPortalCommonApiHandlers(
|
|
|
|
node.historyNetwork.value.portalProtocol, PortalSubnetwork.history
|
|
|
|
)
|
|
|
|
rpcServer.installPortalHistoryApiHandlers(
|
|
|
|
node.historyNetwork.value.portalProtocol
|
2024-09-25 14:44:46 +00:00
|
|
|
)
|
|
|
|
if node.beaconNetwork.isSome():
|
2024-10-07 14:33:02 +00:00
|
|
|
rpcServer.installPortalCommonApiHandlers(
|
|
|
|
node.beaconNetwork.value.portalProtocol, PortalSubnetwork.beacon
|
|
|
|
)
|
|
|
|
rpcServer.installPortalBeaconApiHandlers(
|
|
|
|
node.beaconNetwork.value.portalProtocol
|
2024-09-25 14:44:46 +00:00
|
|
|
)
|
2024-10-30 17:32:36 +00:00
|
|
|
rpcServer.installPortalNimbusBeaconApiHandlers(node.beaconNetwork.value)
|
2024-09-25 14:44:46 +00:00
|
|
|
if node.stateNetwork.isSome():
|
2024-10-07 14:33:02 +00:00
|
|
|
rpcServer.installPortalCommonApiHandlers(
|
|
|
|
node.stateNetwork.value.portalProtocol, PortalSubnetwork.state
|
|
|
|
)
|
|
|
|
rpcServer.installPortalStateApiHandlers(
|
|
|
|
node.stateNetwork.value.portalProtocol
|
2024-09-25 14:44:46 +00:00
|
|
|
)
|
|
|
|
of RpcFlag.portal_debug:
|
|
|
|
if node.historyNetwork.isSome():
|
2024-10-07 14:33:02 +00:00
|
|
|
rpcServer.installPortalDebugHistoryApiHandlers(
|
|
|
|
node.historyNetwork.value.portalProtocol
|
2024-09-25 14:44:46 +00:00
|
|
|
)
|
|
|
|
of RpcFlag.discovery:
|
|
|
|
rpcServer.installDiscoveryApiHandlers(d)
|
2024-09-18 07:46:50 +00:00
|
|
|
|
2024-09-18 13:27:24 +00:00
|
|
|
rpcServer.start()
|
|
|
|
|
2024-09-20 12:54:36 +00:00
|
|
|
let rpcHttpServer =
|
|
|
|
if config.rpcEnabled:
|
|
|
|
let
|
|
|
|
ta = initTAddress(config.rpcAddress, config.rpcPort)
|
|
|
|
rpcHttpServer = RpcHttpServer.new()
|
2024-10-23 08:26:56 +00:00
|
|
|
# 16mb to comfortably fit 2-3mb blocks + blobs + json overhead
|
|
|
|
rpcHttpServer.addHttpServer(ta, maxRequestBodySize = 16 * 1024 * 1024)
|
2024-09-20 12:54:36 +00:00
|
|
|
setupRpcServer(rpcHttpServer)
|
|
|
|
|
|
|
|
Opt.some(rpcHttpServer)
|
|
|
|
else:
|
|
|
|
Opt.none(RpcHttpServer)
|
|
|
|
|
|
|
|
let rpcWsServer =
|
|
|
|
if config.wsEnabled:
|
|
|
|
let
|
|
|
|
ta = initTAddress(config.rpcAddress, config.wsPort)
|
|
|
|
rpcWsServer = newRpcWebSocketServer(ta, compression = config.wsCompression)
|
|
|
|
setupRpcServer(rpcWsServer)
|
|
|
|
|
|
|
|
Opt.some(rpcWsServer)
|
|
|
|
else:
|
|
|
|
Opt.none(RpcWebSocketServer)
|
|
|
|
|
|
|
|
return (node, metricsServer, rpcHttpServer, rpcWsServer)
|
2021-06-16 19:18:45 +00:00
|
|
|
|
|
|
|
when isMainModule:
|
|
|
|
{.pop.}
|
2023-09-07 14:27:13 +00:00
|
|
|
let config = PortalConf.load(
|
|
|
|
version = clientName & " " & fullVersionStr & "\p\p" & nimBanner,
|
2024-02-28 17:31:45 +00:00
|
|
|
copyrightBanner = copyrightBanner,
|
2023-09-07 14:27:13 +00:00
|
|
|
)
|
2023-01-31 12:38:08 +00:00
|
|
|
{.push raises: [].}
|
2021-06-16 19:18:45 +00:00
|
|
|
|
2024-09-20 12:54:36 +00:00
|
|
|
let (node, metricsServer, rpcHttpServer, rpcWsServer) =
|
|
|
|
case config.cmd
|
|
|
|
of PortalCmd.noCommand:
|
|
|
|
run(config)
|
|
|
|
|
|
|
|
# Ctrl+C handling
|
|
|
|
proc controlCHandler() {.noconv.} =
|
|
|
|
when defined(windows):
|
|
|
|
# workaround for https://github.com/nim-lang/Nim/issues/4057
|
|
|
|
try:
|
|
|
|
setupForeignThreadGc()
|
|
|
|
except Exception as exc:
|
|
|
|
raiseAssert exc.msg # shouldn't happen
|
|
|
|
|
|
|
|
notice "Shutting down after having received SIGINT"
|
|
|
|
node.state = PortalNodeState.Stopping
|
|
|
|
|
|
|
|
try:
|
|
|
|
setControlCHook(controlCHandler)
|
|
|
|
except Exception as exc: # TODO Exception
|
|
|
|
warn "Cannot set ctrl-c handler", msg = exc.msg
|
|
|
|
|
|
|
|
while node.state == PortalNodeState.Running:
|
|
|
|
try:
|
|
|
|
poll()
|
|
|
|
except CatchableError as e:
|
|
|
|
warn "Exception in poll()", exc = e.name, err = e.msg
|
|
|
|
|
|
|
|
if rpcWsServer.isSome():
|
|
|
|
let server = rpcWsServer.get()
|
|
|
|
try:
|
|
|
|
server.stop()
|
|
|
|
waitFor server.closeWait()
|
|
|
|
except CatchableError as e:
|
|
|
|
warn "Failed to stop rpc WS server", exc = e.name, err = e.msg
|
|
|
|
|
|
|
|
if rpcHttpServer.isSome():
|
|
|
|
let server = rpcHttpServer.get()
|
|
|
|
try:
|
|
|
|
waitFor server.stop()
|
|
|
|
waitFor server.closeWait()
|
|
|
|
except CatchableError as e:
|
|
|
|
warn "Failed to stop rpc HTTP server", exc = e.name, err = e.msg
|
|
|
|
|
|
|
|
if metricsServer.isSome():
|
|
|
|
let server = metricsServer.get()
|
|
|
|
try:
|
|
|
|
waitFor server.stop()
|
|
|
|
waitFor server.close()
|
|
|
|
except CatchableError as e:
|
|
|
|
warn "Failed to stop metrics HTTP server", exc = e.name, err = e.msg
|
|
|
|
|
|
|
|
waitFor node.stop()
|