增加Docker部署模式 - #380
Merged
Merged
Conversation
服务通过docker集群模式部署时,因有bridge、ingress不同网络, kestrelserver通过NetUtils随机获取网络时,当只监听ingress网络,此时无法通过bridge访问swagger文档。 增加DockerDeployMode,配置为Swarm模式时,监听0.0.0.0地址。
Collaborator
|
surging 可以支持0.0.0.0 ,可以配置 surgingSettings.json的 IP,配置如下 {
"Surging": {
"Ip": "${Surging_Server_IP}|0.0.0.0",
}
} |
Contributor
Author
|
这个问题主要是发生在服务器为集群模式下,通过 public static string GetAnyHostAddress()
{
string result = "";
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics)
{
if (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
IPInterfaceProperties ipxx = adapter.GetIPProperties();
UnicastIPAddressInformationCollection ipCollection = ipxx.UnicastAddresses;
foreach (UnicastIPAddressInformation ipadd in ipCollection)
{
if (ipadd.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
result = ipadd.Address.ToString();
}
}
}
}
return result;
}中的NetworkInterfaceType.Ethernet类型IP是既有Bridge网络,也有Ingress网络。 |
Collaborator
|
OK, merge code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
服务通过docker集群模式部署时,因有bridge、ingress不同网络,
kestrelserver通过NetUtils随机获取网络时,当只监听ingress网络,此时无法通过bridge访问swagger文档。
增加DockerDeployMode,配置为Swarm模式时,监听0.0.0.0地址。