From f82c4751d4846134339e105a7b5747ae8d3fadbb Mon Sep 17 00:00:00 2001 From: Frikky Date: Tue, 26 Aug 2025 23:54:11 +0200 Subject: [PATCH] Minor tweaks to opimise container deploments --- functions/onprem/orborus/orborus.go | 2 +- functions/onprem/worker/worker.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index eacbbba3..8bc23b0a 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -3870,7 +3870,7 @@ func zombiecheck(ctx context.Context, workerTimeout int) error { var options container.StopOptions for _, containername := range stopContainers { log.Printf("[INFO] Stopping and removing container %s", containerNames[containername]) - dockercli.ContainerStop(ctx, containername, options) + go dockercli.ContainerStop(ctx, containername, options) removeContainers = append(removeContainers, containername) } diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 0db20491..b06a2fc0 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -3220,7 +3220,11 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl networkName = swarmNetworkName } - replicas := uint64(2) + // Apps used a lot should have 2 replicas (default) + replicas := uint64(1) + if (strings.Contains(strings.ToLower(name), "shuffle") && strings.Contains(strings.ToLower(name), "tools")) || strings.Contains(strings.ToLower(name), "http") { + replicas = 2 + } // Sent from Orborus // Should be equal to @@ -4115,6 +4119,10 @@ func checkStandaloneRun() { // Check if the required argc/argv is set //log.Printf("ARGS: %#v", os.Args) if len(os.Args) < 4 { + if debug { + log.Printf("[DEBUG] You can run the worker in standalone mode with: go run worker.go standalone ") + } + return } @@ -4273,6 +4281,10 @@ func checkStandaloneRun() { // Initial loop etc func main() { + // Testing swarm auto-replacements. + //findAppInfo("frikky/shuffle:shuffle-ai_1.0.0", "shuffle-ai_1-0-0", true) + //findAppInfo("frikky/shuffle:shuffle-ai_1.0.0", "singul_1-0-0", true) + checkStandaloneRun() if os.Getenv("DEBUG") == "true" {