Fixes serialization issue for running containers for discord bot and metrics container
This commit is contained in:
parent
1412dd84fe
commit
655f4895d0
|
@ -28,19 +28,18 @@ namespace CodexDiscordBotPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public RunningContainer Deploy(DiscordBotStartupConfig config)
|
||||
public RunningContainers Deploy(DiscordBotStartupConfig config)
|
||||
{
|
||||
var workflow = tools.CreateWorkflow();
|
||||
return StartContainer(workflow, config);
|
||||
}
|
||||
|
||||
private RunningContainer StartContainer(IStartupWorkflow workflow, DiscordBotStartupConfig config)
|
||||
private RunningContainers StartContainer(IStartupWorkflow workflow, DiscordBotStartupConfig config)
|
||||
{
|
||||
var startupConfig = new StartupConfig();
|
||||
startupConfig.NameOverride = config.Name;
|
||||
startupConfig.Add(config);
|
||||
var rc = workflow.Start(1, new DiscordBotContainerRecipe(), startupConfig);
|
||||
return rc.Containers.Single();
|
||||
return workflow.Start(1, new DiscordBotContainerRecipe(), startupConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace CodexDiscordBotPlugin
|
|||
{
|
||||
public static class CoreInterfaceExtensions
|
||||
{
|
||||
public static RunningContainer DeployCodexDiscordBot(this CoreInterface ci, DiscordBotStartupConfig config)
|
||||
public static RunningContainers DeployCodexDiscordBot(this CoreInterface ci, DiscordBotStartupConfig config)
|
||||
{
|
||||
return Plugin(ci).Deploy(config);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace CodexPlugin
|
|||
{
|
||||
public class CodexDeployment
|
||||
{
|
||||
public CodexDeployment(CodexInstance[] codexInstances, GethDeployment gethDeployment, CodexContractsDeployment codexContractsDeployment, RunningContainer? prometheusContainer, RunningContainer? discordBotContainer, DeploymentMetadata metadata)
|
||||
public CodexDeployment(CodexInstance[] codexInstances, GethDeployment gethDeployment, CodexContractsDeployment codexContractsDeployment, RunningContainers? prometheusContainer, RunningContainers? discordBotContainer, DeploymentMetadata metadata)
|
||||
{
|
||||
CodexInstances = codexInstances;
|
||||
GethDeployment = gethDeployment;
|
||||
|
@ -19,8 +19,8 @@ namespace CodexPlugin
|
|||
public CodexInstance[] CodexInstances { get; }
|
||||
public GethDeployment GethDeployment { get; }
|
||||
public CodexContractsDeployment CodexContractsDeployment { get; }
|
||||
public RunningContainer? PrometheusContainer { get; }
|
||||
public RunningContainer? DiscordBotContainer { get; }
|
||||
public RunningContainers? PrometheusContainer { get; }
|
||||
public RunningContainers? DiscordBotContainer { get; }
|
||||
public DeploymentMetadata Metadata { get; }
|
||||
}
|
||||
|
||||
|
|
|
@ -6,22 +6,22 @@ namespace MetricsPlugin
|
|||
{
|
||||
public static class CoreInterfaceExtensions
|
||||
{
|
||||
public static RunningContainer DeployMetricsCollector(this CoreInterface ci, params IHasMetricsScrapeTarget[] scrapeTargets)
|
||||
public static RunningContainers DeployMetricsCollector(this CoreInterface ci, params IHasMetricsScrapeTarget[] scrapeTargets)
|
||||
{
|
||||
return Plugin(ci).DeployMetricsCollector(scrapeTargets.Select(t => t.MetricsScrapeTarget).ToArray());
|
||||
}
|
||||
|
||||
public static RunningContainer DeployMetricsCollector(this CoreInterface ci, params IMetricsScrapeTarget[] scrapeTargets)
|
||||
public static RunningContainers DeployMetricsCollector(this CoreInterface ci, params IMetricsScrapeTarget[] scrapeTargets)
|
||||
{
|
||||
return Plugin(ci).DeployMetricsCollector(scrapeTargets);
|
||||
}
|
||||
|
||||
public static IMetricsAccess WrapMetricsCollector(this CoreInterface ci, RunningContainer metricsContainer, IHasMetricsScrapeTarget scrapeTarget)
|
||||
public static IMetricsAccess WrapMetricsCollector(this CoreInterface ci, RunningContainers metricsContainer, IHasMetricsScrapeTarget scrapeTarget)
|
||||
{
|
||||
return ci.WrapMetricsCollector(metricsContainer, scrapeTarget.MetricsScrapeTarget);
|
||||
}
|
||||
|
||||
public static IMetricsAccess WrapMetricsCollector(this CoreInterface ci, RunningContainer metricsContainer, IMetricsScrapeTarget scrapeTarget)
|
||||
public static IMetricsAccess WrapMetricsCollector(this CoreInterface ci, RunningContainers metricsContainer, IMetricsScrapeTarget scrapeTarget)
|
||||
{
|
||||
return Plugin(ci).WrapMetricsCollectorDeployment(metricsContainer, scrapeTarget);
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ namespace MetricsPlugin
|
|||
{
|
||||
}
|
||||
|
||||
public RunningContainer DeployMetricsCollector(IMetricsScrapeTarget[] scrapeTargets)
|
||||
public RunningContainers DeployMetricsCollector(IMetricsScrapeTarget[] scrapeTargets)
|
||||
{
|
||||
return starter.CollectMetricsFor(scrapeTargets);
|
||||
}
|
||||
|
||||
public IMetricsAccess WrapMetricsCollectorDeployment(RunningContainer runningContainer, IMetricsScrapeTarget target)
|
||||
public IMetricsAccess WrapMetricsCollectorDeployment(RunningContainers runningContainer, IMetricsScrapeTarget target)
|
||||
{
|
||||
runningContainer = SerializeGate.Gate(runningContainer);
|
||||
return starter.CreateAccessForTarget(runningContainer, target);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace MetricsPlugin
|
|||
this.tools = tools;
|
||||
}
|
||||
|
||||
public RunningContainer CollectMetricsFor(IMetricsScrapeTarget[] targets)
|
||||
public RunningContainers CollectMetricsFor(IMetricsScrapeTarget[] targets)
|
||||
{
|
||||
Log($"Starting metrics server for {targets.Length} targets...");
|
||||
var startupConfig = new StartupConfig();
|
||||
|
@ -25,12 +25,12 @@ namespace MetricsPlugin
|
|||
if (runningContainers.Containers.Length != 1) throw new InvalidOperationException("Expected only 1 Prometheus container to be created.");
|
||||
|
||||
Log("Metrics server started.");
|
||||
return runningContainers.Containers.Single();
|
||||
return runningContainers;
|
||||
}
|
||||
|
||||
public MetricsAccess CreateAccessForTarget(RunningContainer metricsContainer, IMetricsScrapeTarget target)
|
||||
public MetricsAccess CreateAccessForTarget(RunningContainers metricsContainer, IMetricsScrapeTarget target)
|
||||
{
|
||||
var metricsQuery = new MetricsQuery(tools, metricsContainer);
|
||||
var metricsQuery = new MetricsQuery(tools, metricsContainer.Containers.Single());
|
||||
return new MetricsAccess(metricsQuery, target);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace CodexTests.BasicTests
|
|||
|
||||
private const string BytesStoredMetric = "codexRepostoreBytesUsed";
|
||||
|
||||
private void PerformTest(ICodexNode primary, ICodexNode secondary, RunningContainer rc)
|
||||
private void PerformTest(ICodexNode primary, ICodexNode secondary, RunningContainers rc)
|
||||
{
|
||||
ScopedTestFiles(() =>
|
||||
{
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace CodexNetDeployer
|
|||
});
|
||||
}
|
||||
|
||||
private RunningContainer? DeployDiscordBot(CoreInterface ci)
|
||||
private RunningContainers? DeployDiscordBot(CoreInterface ci)
|
||||
{
|
||||
if (!config.DeployDiscordBot) return null;
|
||||
Log("Deploying Discord bot...");
|
||||
|
@ -140,7 +140,7 @@ namespace CodexNetDeployer
|
|||
return rc;
|
||||
}
|
||||
|
||||
private RunningContainer? StartMetricsService(CoreInterface ci, List<CodexNodeStartResult> startResults)
|
||||
private RunningContainers? StartMetricsService(CoreInterface ci, List<CodexNodeStartResult> startResults)
|
||||
{
|
||||
if (!config.MetricsScraper) return null;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ dotnet run \
|
|||
--block-mn=10000 \
|
||||
--metrics-endpoints=1 \
|
||||
--metrics-scraper=0 \
|
||||
--check-connect=1 \
|
||||
--check-connect=0 \
|
||||
\
|
||||
--public-testnet=1 \
|
||||
--public-ip=1.2.3.4 \
|
||||
|
|
Loading…
Reference in New Issue