Merge branch '1.2.0' of github.com:Shuffle/Shuffle into 1.2.0
This commit is contained in:
@@ -65,6 +65,12 @@ SHUFFLE_BASE_IMAGE_TAG_SUFFIX="-1.1.0"
|
|||||||
## shuffle_Scale_Replicas (workers/node)
|
## shuffle_Scale_Replicas (workers/node)
|
||||||
## shuffle_App_Replicas (apps/node)
|
## shuffle_App_Replicas (apps/node)
|
||||||
|
|
||||||
|
SHUFFLE_SWARM_BRIDGE_DEFAULT_MTU=1500 # 1500 by default
|
||||||
|
# The eth0 interface inside a container corresponds
|
||||||
|
# to the virtual Ethernet interface that connects
|
||||||
|
# the container to the docker0
|
||||||
|
SHUFFLE_SWARM_BRIDGE_DEFAULT_INTERFACE=eth0
|
||||||
|
|
||||||
# Used for auto-cleanup of containers. REALLY important at scale.
|
# Used for auto-cleanup of containers. REALLY important at scale.
|
||||||
SHUFFLE_CONTAINER_AUTO_CLEANUP=false
|
SHUFFLE_CONTAINER_AUTO_CLEANUP=false
|
||||||
SHUFFLE_ELASTIC=true
|
SHUFFLE_ELASTIC=true
|
||||||
|
|||||||
+7
-1
@@ -113,4 +113,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
shuffle:
|
shuffle:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
#driver: overlay
|
|
||||||
|
# uncomment to set MTU for swarm mode.
|
||||||
|
# MTU should be whatever is your host's preferred MTU is.
|
||||||
|
# Refer to this doc to figure out what your host's MTU is:
|
||||||
|
# https://shuffler.io/docs/troubleshooting#TLS_timeout_error/Timeout_Errors/EOF_Errors
|
||||||
|
# driver_opts:
|
||||||
|
# com.docker.network.driver.mtu: 1460
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ var concurrencyEnv = os.Getenv("SHUFFLE_ORBORUS_EXECUTION_CONCURRENCY")
|
|||||||
var appSdkVersion = os.Getenv("SHUFFLE_APP_SDK_VERSION")
|
var appSdkVersion = os.Getenv("SHUFFLE_APP_SDK_VERSION")
|
||||||
var workerVersion = os.Getenv("SHUFFLE_WORKER_VERSION")
|
var workerVersion = os.Getenv("SHUFFLE_WORKER_VERSION")
|
||||||
var newWorkerImage = os.Getenv("SHUFFLE_WORKER_IMAGE")
|
var newWorkerImage = os.Getenv("SHUFFLE_WORKER_IMAGE")
|
||||||
|
var dockerSwarmBridgeMTU = os.Getenv("SHUFFLE_SWARM_BRIDGE_DEFAULT_MTU")
|
||||||
|
var dockerSwarmBridgeInterface = os.Getenv("SHUFFLE_SWARM_BRIDGE_DEFAULT_INTERFACE")
|
||||||
|
|
||||||
// var baseimagename = "docker.pkg.github.com/shuffle/shuffle"
|
// var baseimagename = "docker.pkg.github.com/shuffle/shuffle"
|
||||||
// var baseimagename = "ghcr.io/frikky"
|
// var baseimagename = "ghcr.io/frikky"
|
||||||
@@ -211,20 +213,42 @@ func deployServiceWorkers(image string) {
|
|||||||
// Get a list of network interfaces
|
// Get a list of network interfaces
|
||||||
interfaces, err := net.Interfaces()
|
interfaces, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Printf("[ERROR] Failed to get network interfaces: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
mtu, err := strconv.Atoi(dockerSwarmBridgeMTU) // by default
|
||||||
|
bridgeName := dockerSwarmBridgeInterface
|
||||||
|
|
||||||
|
if bridgeName == "" {
|
||||||
|
bridgeName = "eth0"
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Failed to convert the default MTU to int: %s. Using 1500 instead", err)
|
||||||
|
mtu = 1500
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is at least one interface
|
// Check if there is at least one interface
|
||||||
if len(interfaces) < 2 {
|
if len(interfaces) < 2 {
|
||||||
panic("Insufficient network interfaces")
|
// this assumes that the machine should have at least 2 network
|
||||||
|
// interfaces. If not, we will use the default MTU.
|
||||||
|
// interface 1 is the loopback interface
|
||||||
|
// interface 2 is eth0, The eth0 interface inside a
|
||||||
|
// Docker container corresponds to the virtual Ethernet
|
||||||
|
// interface that connects the container to the docker0
|
||||||
|
log.Printf("[ERROR] Failed to get enough network interfaces")
|
||||||
|
} else {
|
||||||
|
// Get the preferred interface
|
||||||
|
for _, iface := range interfaces {
|
||||||
|
if strings.Contains(iface.Name, bridgeName) {
|
||||||
|
targetInterface := iface
|
||||||
|
mtu = targetInterface.MTU
|
||||||
|
log.Printf("[INFO] Using MTU %d from interface %s", mtu, targetInterface.Name)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the second interface
|
|
||||||
targetInterface := interfaces[1]
|
|
||||||
mtu := targetInterface.MTU
|
|
||||||
|
|
||||||
// Print the interface and MTU information
|
|
||||||
fmt.Printf("Target Interface: %s, MTU: %d\n", targetInterface.Name, mtu)
|
|
||||||
// Create the network options with the specified MTU
|
// Create the network options with the specified MTU
|
||||||
options := make(map[string]string)
|
options := make(map[string]string)
|
||||||
options["com.docker.network.driver.mtu"] = fmt.Sprintf("%d", mtu)
|
options["com.docker.network.driver.mtu"] = fmt.Sprintf("%d", mtu)
|
||||||
|
|||||||
Reference in New Issue
Block a user