wip: updating codex container recipe for public deployment
This commit is contained in:
parent
854325f10c
commit
840e794761
|
@ -29,20 +29,30 @@ namespace CodexPlugin
|
|||
|
||||
var config = startupConfig.Get<CodexStartupConfig>();
|
||||
|
||||
AddExposedPortAndVar("CODEX_API_PORT", ApiPortTag);
|
||||
var apiPort = CreateApiPort(config, ApiPortTag);
|
||||
AddEnvVar("CODEX_API_PORT", apiPort);
|
||||
AddEnvVar("CODEX_API_BINDADDR", "0.0.0.0");
|
||||
|
||||
var dataDir = $"datadir{ContainerNumber}";
|
||||
AddEnvVar("CODEX_DATA_DIR", dataDir);
|
||||
AddVolume($"codex/{dataDir}", GetVolumeCapacity(config));
|
||||
|
||||
AddExposedPortAndVar("CODEX_DISC_PORT", DiscoveryPortTag);
|
||||
var discPort = CreateP2pPort(config, DiscoveryPortTag);
|
||||
AddEnvVar("CODEX_DISC_PORT", discPort);
|
||||
AddEnvVar("CODEX_LOG_LEVEL", config.LogLevelWithTopics());
|
||||
|
||||
// This makes the node announce itself to its local (pod) IP address.
|
||||
AddEnvVar("NAT_IP_AUTO", "true");
|
||||
if (config.IsPublicTestNet)
|
||||
{
|
||||
todo
|
||||
AddEnvVar("CODEX_NAT", "required");
|
||||
}
|
||||
else
|
||||
{
|
||||
// This makes the node announce itself to its local (pod) IP address.
|
||||
AddEnvVar("NAT_IP_AUTO", "true");
|
||||
}
|
||||
|
||||
var listenPort = AddExposedPort(ListenPortTag);
|
||||
var listenPort = CreateP2pPort(config, ListenPortTag);
|
||||
AddEnvVar("CODEX_LISTEN_ADDRS", $"/ip4/0.0.0.0/tcp/{listenPort.Number}");
|
||||
|
||||
if (!string.IsNullOrEmpty(config.BootstrapSpr))
|
||||
|
@ -67,7 +77,7 @@ namespace CodexPlugin
|
|||
}
|
||||
if (config.MetricsEnabled)
|
||||
{
|
||||
var metricsPort = AddInternalPort(MetricsPortTag);
|
||||
var metricsPort = CreateApiPort(config, MetricsPortTag);
|
||||
AddEnvVar("CODEX_METRICS", "true");
|
||||
AddEnvVar("CODEX_METRICS_ADDRESS", "0.0.0.0");
|
||||
AddEnvVar("CODEX_METRICS_PORT", metricsPort);
|
||||
|
@ -124,5 +134,23 @@ namespace CodexPlugin
|
|||
if (!string.IsNullOrEmpty(DockerImageOverride)) return DockerImageOverride;
|
||||
return DefaultDockerImage;
|
||||
}
|
||||
|
||||
private Port CreateP2pPort(CodexStartupConfig config, string tag)
|
||||
{
|
||||
if (config.IsPublicTestNet)
|
||||
{
|
||||
return AddExposedPort(tag);
|
||||
}
|
||||
return AddInternalPort(tag);
|
||||
}
|
||||
|
||||
private Port CreateApiPort(CodexStartupConfig config, string tag)
|
||||
{
|
||||
if (config.IsPublicTestNet)
|
||||
{
|
||||
return AddInternalPort(tag);
|
||||
}
|
||||
return AddExposedPort(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace CodexPlugin
|
|||
/// Provides an invalid proof every N proofs
|
||||
/// </summary>
|
||||
ICodexSetup WithSimulateProofFailures(uint failEveryNProofs);
|
||||
ICodexSetup AsPublicTestNet();
|
||||
}
|
||||
|
||||
public class CodexLogCustomTopics
|
||||
|
@ -118,6 +119,12 @@ namespace CodexPlugin
|
|||
return this;
|
||||
}
|
||||
|
||||
public ICodexSetup AsPublicTestNet()
|
||||
{
|
||||
IsPublicTestNet = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public string Describe()
|
||||
{
|
||||
var args = string.Join(',', DescribeArgs());
|
||||
|
@ -126,6 +133,7 @@ namespace CodexPlugin
|
|||
|
||||
private IEnumerable<string> DescribeArgs()
|
||||
{
|
||||
if (IsPublicTestNet) yield return "<!>Public TestNet<!>";
|
||||
yield return $"LogLevel={LogLevelWithTopics()}";
|
||||
if (BootstrapSpr != null) yield return $"BootstrapNode={BootstrapSpr}";
|
||||
if (StorageQuota != null) yield return $"StorageQuota={StorageQuota}";
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace CodexPlugin
|
|||
public bool? EnableValidator { get; set; }
|
||||
public TimeSpan? BlockMaintenanceInterval { get; set; }
|
||||
public int? BlockMaintenanceNumber { get; set; }
|
||||
public bool IsPublicTestNet { get; set; } = false;
|
||||
|
||||
public string LogLevelWithTopics()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue