Can start waku node
This commit is contained in:
parent
ab4f4695cb
commit
30ba382db7
|
@ -67,6 +67,13 @@ namespace KubernetesWorkflow
|
|||
return p;
|
||||
}
|
||||
|
||||
protected Port AddInternalPort(int number, string tag = "")
|
||||
{
|
||||
var p = factory.CreatePort(number, tag);
|
||||
internalPorts.Add(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
protected void AddExposedPortAndVar(string name, string tag = "")
|
||||
{
|
||||
AddEnvVar(name, AddExposedPort(tag));
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
using Core;
|
||||
using KubernetesWorkflow;
|
||||
|
||||
namespace WakuPlugin
|
||||
{
|
||||
public static class CoreInterfaceExtensions
|
||||
{
|
||||
public static RunningContainers[] DeployWakuNodes(this CoreInterface ci, int number)
|
||||
{
|
||||
return Plugin(ci).DeployWakuNodes(number);
|
||||
}
|
||||
|
||||
//public static ICodexNodeGroup WrapCodexContainers(this CoreInterface ci, RunningContainer[] containers)
|
||||
//{
|
||||
// // ew, clean this up.
|
||||
// var rcs = new RunningContainers(null!, containers.First().Pod, containers);
|
||||
// return WrapCodexContainers(ci, new[] { rcs });
|
||||
//}
|
||||
|
||||
//public static ICodexNodeGroup WrapCodexContainers(this CoreInterface ci, RunningContainers[] containers)
|
||||
//{
|
||||
// return Plugin(ci).WrapCodexContainers(ci, containers);
|
||||
//}
|
||||
|
||||
//public static ICodexNode StartCodexNode(this CoreInterface ci)
|
||||
//{
|
||||
// return ci.StartCodexNodes(1)[0];
|
||||
//}
|
||||
|
||||
//public static ICodexNode StartCodexNode(this CoreInterface ci, Action<ICodexSetup> setup)
|
||||
//{
|
||||
// return ci.StartCodexNodes(1, setup)[0];
|
||||
//}
|
||||
|
||||
//public static ICodexNodeGroup StartCodexNodes(this CoreInterface ci, int number, Action<ICodexSetup> setup)
|
||||
//{
|
||||
// var rc = ci.DeployCodexNodes(number, setup);
|
||||
// var result = ci.WrapCodexContainers(rc);
|
||||
// Plugin(ci).WireUpMarketplace(result, setup);
|
||||
// return result;
|
||||
//}
|
||||
|
||||
//public static ICodexNodeGroup StartCodexNodes(this CoreInterface ci, int number)
|
||||
//{
|
||||
// return ci.StartCodexNodes(number, s => { });
|
||||
//}
|
||||
|
||||
private static WakuPlugin Plugin(CoreInterface ci)
|
||||
{
|
||||
return ci.GetPlugin<WakuPlugin>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using KubernetesWorkflow;
|
||||
using Utils;
|
||||
|
||||
namespace WakuPlugin
|
||||
{
|
||||
public class WakuPluginContainerRecipe : ContainerRecipeFactory
|
||||
{
|
||||
public override string AppName => "waku";
|
||||
//public override string Image => "statusteam/nim-waku:deploy-wakuv2-test";
|
||||
public override string Image => "thatbenbierens/nim-waku:try";
|
||||
|
||||
protected override void Initialize(StartupConfig startupConfig)
|
||||
{
|
||||
SetResourcesRequest(milliCPUs: 100, memory: 100.MB());
|
||||
SetResourceLimits(milliCPUs: 4000, memory: 12.GB());
|
||||
|
||||
AddInternalPortAndVar("WAKUNODE2_TCP_PORT");
|
||||
|
||||
AddEnvVar("WAKUNODE2_RPC_ADDRESS", "0.0.0.0");
|
||||
|
||||
AddEnvVar("WAKUNODE2_REST", "1");
|
||||
AddEnvVar("WAKUNODE2_REST_ADDRESS", "0.0.0.0");
|
||||
AddExposedPortAndVar("WAKUNODE2_REST_PORT", "restport");
|
||||
|
||||
AddEnvVar("WAKUNODE2_DISCV5_DISCOVERY", "1");
|
||||
AddInternalPortAndVar("WAKUNODE2_DISCV5_UDP_PORT");
|
||||
//AddEnvVar("WAKUNODE2_DISCV5_BOOTSTRAP_NODE", "________<---- enr here");
|
||||
AddEnvVar("WAKUNODE2_DISCV5_ENR_AUTO_UPDATEY", "1");
|
||||
|
||||
AddEnvVar("WAKUNODE2_TOPICS", "test_topics_plz");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
using Core;
|
||||
using KubernetesWorkflow;
|
||||
|
||||
namespace WakuPlugin
|
||||
{
|
||||
public class WakuPlugin : IProjectPlugin, IHasLogPrefix, IHasMetadata
|
||||
{
|
||||
private readonly IPluginTools tools;
|
||||
private readonly WakuStarter starter;
|
||||
|
||||
public WakuPlugin(IPluginTools tools)
|
||||
{
|
||||
this.tools = tools;
|
||||
starter = new WakuStarter(tools);
|
||||
}
|
||||
|
||||
public string LogPrefix => "(Waku) ";
|
||||
|
||||
public void Announce()
|
||||
{
|
||||
tools.GetLog().Log($"Loaded with Waku plugin.");
|
||||
}
|
||||
|
||||
public void AddMetadata(IAddMetadata metadata)
|
||||
{
|
||||
//metadata.Add("codexid", codexStarter.GetCodexId());
|
||||
}
|
||||
|
||||
public void Decommission()
|
||||
{
|
||||
}
|
||||
|
||||
public RunningContainers[] DeployWakuNodes(int numberOfNodes)
|
||||
{
|
||||
return starter.Start(numberOfNodes);
|
||||
}
|
||||
|
||||
//public ICodexNodeGroup WrapCodexContainers(CoreInterface coreInterface, RunningContainers[] containers)
|
||||
//{
|
||||
// containers = containers.Select(c => SerializeGate.Gate(c)).ToArray();
|
||||
// return codexStarter.WrapCodexContainers(coreInterface, containers);
|
||||
//}
|
||||
|
||||
//public void WireUpMarketplace(ICodexNodeGroup result, Action<ICodexSetup> setup)
|
||||
//{
|
||||
// var codexSetup = GetSetup(1, setup);
|
||||
// if (codexSetup.MarketplaceConfig == null) return;
|
||||
|
||||
// var mconfig = codexSetup.MarketplaceConfig;
|
||||
// foreach (var node in result)
|
||||
// {
|
||||
// mconfig.GethNode.SendEth(node, mconfig.InitialEth);
|
||||
// mconfig.CodexContracts.MintTestTokens(mconfig.GethNode, node, mconfig.InitialTokens);
|
||||
// }
|
||||
//}
|
||||
|
||||
//private CodexSetup GetSetup(int numberOfNodes, Action<ICodexSetup> setup)
|
||||
//{
|
||||
// var codexSetup = new CodexSetup(numberOfNodes);
|
||||
// codexSetup.LogLevel = defaultLogLevel;
|
||||
// setup(codexSetup);
|
||||
// return codexSetup;
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -6,4 +6,8 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Framework\Core\Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
using Core;
|
||||
using KubernetesWorkflow;
|
||||
|
||||
namespace WakuPlugin
|
||||
{
|
||||
public class WakuStarter
|
||||
{
|
||||
private readonly IPluginTools tools;
|
||||
|
||||
public WakuStarter(IPluginTools tools)
|
||||
{
|
||||
this.tools = tools;
|
||||
}
|
||||
|
||||
public RunningContainers[] Start(int numberOfNodes)
|
||||
{
|
||||
var result = new List<RunningContainers>();
|
||||
var workflow = tools.CreateWorkflow();
|
||||
|
||||
for (var i = 0; i < numberOfNodes; i++)
|
||||
{
|
||||
result.Add(workflow.Start(1, new WakuPluginContainerRecipe(), new StartupConfig()));
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using NUnit.Framework;
|
||||
using WakuPlugin;
|
||||
|
||||
namespace WakuTests
|
||||
{
|
||||
|
@ -7,7 +8,9 @@ namespace WakuTests
|
|||
[Test]
|
||||
public void Hi()
|
||||
{
|
||||
Assert.Fail();
|
||||
var rc = Ci.DeployWakuNodes(1);
|
||||
|
||||
var i = 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,10 +7,7 @@ namespace WakuTests
|
|||
{
|
||||
public WakuDistTest()
|
||||
{
|
||||
//ProjectPlugin.Load<CodexPlugin.CodexPlugin>();
|
||||
//ProjectPlugin.Load<CodexContractsPlugin.CodexContractsPlugin>();
|
||||
//ProjectPlugin.Load<GethPlugin.GethPlugin>();
|
||||
//ProjectPlugin.Load<MetricsPlugin.MetricsPlugin>();
|
||||
ProjectPlugin.Load<WakuPlugin.WakuPlugin>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ProjectPlugins\WakuPlugin\WakuPlugin.csproj" />
|
||||
<ProjectReference Include="..\..\Tests\DistTestCore\DistTestCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
Loading…
Reference in New Issue