Added SHUFFLE_APP_REPLICAS environment var

This commit is contained in:
Frikky
2023-11-08 20:32:28 +01:00
parent 96b570c859
commit 7fe01b0e0a
+12 -1
View File
@@ -406,6 +406,17 @@ func deployServiceWorkers(image string) {
cnt = 1
}
appReplicas := os.Getenv("SHUFFLE_APP_REPLICAS")
appReplicaCnt := 1
if len(appReplicas) > 0 {
newCnt, err := strconv.Atoi(appReplicas)
if err != nil {
log.Printf("[ERROR] %s is not a valid number for SHUFFLE_APP_REPLICAS", appReplicas)
} else {
appReplicaCnt = newCnt
}
}
log.Printf("[DEBUG] Found %d node(s) to replicate over. Defaulting to 1 IF we can't auto-discover them.", cnt)
replicatedJobs := uint64(replicas * nodeCount)
@@ -462,7 +473,7 @@ func deployServiceWorkers(image string) {
Env: []string{
fmt.Sprintf("SHUFFLE_SWARM_CONFIG=%s", os.Getenv("SHUFFLE_SWARM_CONFIG")),
fmt.Sprintf("SHUFFLE_SWARM_NETWORK_NAME=%s", networkName),
fmt.Sprintf("SHUFFLE_APP_REPLICAS=%d", cnt),
fmt.Sprintf("SHUFFLE_APP_REPLICAS=%d", appReplicaCnt),
fmt.Sprintf("SHUFFLE_LOGS_DISABLED=%s", os.Getenv("SHUFFLE_LOGS_DISABLED")),
fmt.Sprintf("SHUFFLE_DEBUG_MEMORY=%s", os.Getenv("SHUFFLE_DEBUG_MEMORY")),
fmt.Sprintf("TZ=%s", timezone),