diff --git a/Framework/KubernetesWorkflow/K8sController.cs b/Framework/KubernetesWorkflow/K8sController.cs index e065c13..1698984 100644 --- a/Framework/KubernetesWorkflow/K8sController.cs +++ b/Framework/KubernetesWorkflow/K8sController.cs @@ -79,7 +79,7 @@ namespace KubernetesWorkflow public string ExecuteCommand(RunningContainer container, string command, params string[] args) { - var containerName = container.Name; + var containerName = container.Recipe.Name; var cmdAndArgs = $"{containerName}: {command} ({string.Join(",", args)})"; log.Debug(cmdAndArgs); diff --git a/Framework/KubernetesWorkflow/RunningContainers.cs b/Framework/KubernetesWorkflow/RunningContainers.cs index c95a96d..27653f8 100644 --- a/Framework/KubernetesWorkflow/RunningContainers.cs +++ b/Framework/KubernetesWorkflow/RunningContainers.cs @@ -56,6 +56,13 @@ namespace KubernetesWorkflow } return containerAddress.Address; } + + public Address GetInternalAddress(string portTag) + { + var containerAddress = Addresses.Single(a => a.PortTag == portTag); + if (!containerAddress.IsInteral) throw new Exception(portTag + " refers to an external port"); + return containerAddress.Address; + } } public class ContainerAddress diff --git a/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs b/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs index 8555cae..9ea59a0 100644 --- a/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs +++ b/ProjectPlugins/CodexPlugin/CodexContainerRecipe.cs @@ -95,10 +95,10 @@ namespace CodexPlugin { var mconfig = config.MarketplaceConfig; var gethStart = mconfig.GethNode.StartResult; - var wsAddress = gethStart.Container.GetAddress(GethContainerRecipe.WsPortTag); + var wsAddress = gethStart.Container.GetInternalAddress(GethContainerRecipe.WsPortTag); var marketplaceAddress = mconfig.CodexContracts.Deployment.MarketplaceAddress; - AddEnvVar("CODEX_ETH_PROVIDER", $"ws://{wsAddress.Host}:{wsAddress.Port}"); + AddEnvVar("CODEX_ETH_PROVIDER", $"{wsAddress.Host.Replace("http://", "ws://")}:{wsAddress.Port}"); AddEnvVar("CODEX_MARKETPLACE_ADDRESS", marketplaceAddress); AddEnvVar("CODEX_PERSISTENCE", "true"); diff --git a/ProjectPlugins/GethPlugin/GethDeployment.cs b/ProjectPlugins/GethPlugin/GethDeployment.cs index 36cc1ab..2461811 100644 --- a/ProjectPlugins/GethPlugin/GethDeployment.cs +++ b/ProjectPlugins/GethPlugin/GethDeployment.cs @@ -1,13 +1,14 @@ using Core; using KubernetesWorkflow; +using Newtonsoft.Json; namespace GethPlugin { public class GethDeployment : IHasContainer { - public GethDeployment(RunningContainer container, Port discoveryPort, Port httpPort, Port wsPort, GethAccount account, string pubKey) + public GethDeployment(RunningContainers containers, Port discoveryPort, Port httpPort, Port wsPort, GethAccount account, string pubKey) { - Container = container; + Containers = containers; DiscoveryPort = discoveryPort; HttpPort = httpPort; WsPort = wsPort; @@ -15,7 +16,9 @@ namespace GethPlugin PubKey = pubKey; } - public RunningContainer Container { get; } + public RunningContainers Containers { get; } + [JsonIgnore] + public RunningContainer Container { get { return Containers.Containers.Single(); } } public Port DiscoveryPort { get; } public Port HttpPort { get; } public Port WsPort { get; } diff --git a/ProjectPlugins/GethPlugin/GethStarter.cs b/ProjectPlugins/GethPlugin/GethStarter.cs index dc8287c..5287d9c 100644 --- a/ProjectPlugins/GethPlugin/GethStarter.cs +++ b/ProjectPlugins/GethPlugin/GethStarter.cs @@ -38,7 +38,7 @@ namespace GethPlugin Log($"Geth node started."); - return new GethDeployment(container, discoveryPort, httpPort, wsPort, account, pubKey); + return new GethDeployment(containers, discoveryPort, httpPort, wsPort, account, pubKey); } public IGethNode WrapGethContainer(GethDeployment startResult)