From 020865f5c0191ba520d6617f6b6fcceef4872413 Mon Sep 17 00:00:00 2001 From: benbierens Date: Mon, 23 Oct 2023 13:08:49 +0200 Subject: [PATCH] Wires up deployer config --- Tools/CodexNetDeployer/CodexNodeStarter.cs | 18 ++++++++++++++++++ Tools/CodexNetDeployer/Deployer.cs | 12 +++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Tools/CodexNetDeployer/CodexNodeStarter.cs b/Tools/CodexNetDeployer/CodexNodeStarter.cs index 51e92b0..04cf2d0 100644 --- a/Tools/CodexNetDeployer/CodexNodeStarter.cs +++ b/Tools/CodexNetDeployer/CodexNodeStarter.cs @@ -49,6 +49,11 @@ namespace CodexNetDeployer if (config.BlockTTL != Configuration.SecondsIn1Day) s.WithBlockTTL(TimeSpan.FromSeconds(config.BlockTTL)); if (config.BlockMI != Configuration.TenMinutes) s.WithBlockMaintenanceInterval(TimeSpan.FromSeconds(config.BlockMI)); if (config.BlockMN != 1000) s.WithBlockMaintenanceNumber(config.BlockMN); + + if (config.IsPublicTestNet) + { + s.AsPublicTestNet(CreatePublicTestNetConfig(i)); + } }); var debugInfo = codexNode.GetDebugInfo(); @@ -93,6 +98,19 @@ namespace CodexNetDeployer return null; } + private CodexTestNetConfig CreatePublicTestNetConfig(int i) + { + var discPort = config.PublicDiscPorts.Split(",")[i]; + var listenPort = config.PublicListenPorts.Split(",")[i]; + + return new CodexTestNetConfig + { + PublicNatIP = config.PublicIP, + PublicDiscoveryPort = Convert.ToInt32(discPort), + PublicListenPort = Convert.ToInt32(listenPort) + }; + } + private string GetCodexContainerName(int i) { if (i == 0) return "BOOTSTRAP"; diff --git a/Tools/CodexNetDeployer/Deployer.cs b/Tools/CodexNetDeployer/Deployer.cs index 1f6288c..3273909 100644 --- a/Tools/CodexNetDeployer/Deployer.cs +++ b/Tools/CodexNetDeployer/Deployer.cs @@ -55,7 +55,7 @@ namespace CodexNetDeployer var ci = entryPoint.CreateInterface(); Log("Deploying Geth instance..."); - var gethDeployment = ci.DeployGeth(s => s.IsMiner().WithName("geth")); + var gethDeployment = DeployGeth(ci); var gethNode = ci.WrapGethDeployment(gethDeployment); Log("Geth started. Deploying Codex contracts..."); @@ -98,6 +98,16 @@ namespace CodexNetDeployer return result; } + private GethDeployment DeployGeth(CoreInterface ci) + { + return ci.DeployGeth(s => + { + s.IsMiner(); + s.WithName("geth"); + if (config.IsPublicTestNet) s.AsPublicTestNet(); + }); + } + private RunningContainer? StartMetricsService(CoreInterface ci, List startResults) { if (!config.MetricsScraper) return null;