diff --git a/backend/app_sdk/build.sh b/backend/app_sdk/build.sh index 7ff6a07c..6023b389 100644 --- a/backend/app_sdk/build.sh +++ b/backend/app_sdk/build.sh @@ -3,7 +3,7 @@ ### DEFAULT NAME=shuffle-app_sdk -VERSION=0.9.32 +VERSION=0.9.34 docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 0912a65a..6e8698d7 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -2,7 +2,7 @@ module main go 1.15 -replace github.com/shuffle/shuffle-shared => ../../../../git/shuffle-shared +//replace github.com/shuffle/shuffle-shared => ../../../../git/shuffle-shared //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi //replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch @@ -22,7 +22,7 @@ require ( github.com/gorilla/mux v1.8.0 github.com/h2non/filetype v1.1.1 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.1.30 + github.com/shuffle/shuffle-shared v0.1.35 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect go4.org v0.0.0-20201209231011-d4a079459e60 // indirect golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 diff --git a/docker-compose.yml b/docker-compose.yml index 8a8ba025..b03ecd3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: depends_on: - backend backend: - #build: ./backend + build: ./backend image: ghcr.io/frikky/shuffle-backend:nightly container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 0e3c8180..4eeeceab 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1466,7 +1466,7 @@ const AngularWorkflow = (props) => { const triggercheck = workflow.triggers.find(trigger => trigger.id === event.target.data()["source"]) if (triggercheck === undefined) { */ - if (event.target.data().decorator) { + if (event.target.data("type") !== "COMMENT" && event.target.data().decorator) { alert.info("This edge can't be edited.") } else { //console.log("DATA: ", event.target.data()) @@ -7029,7 +7029,7 @@ const AngularWorkflow = (props) => { return null } - const cytoscapeViewWidths = 800 + const cytoscapeViewWidths = 850 const bottomBarStyle = { position: "fixed", right: 20, diff --git a/frontend/src/views/SettingsPage.jsx b/frontend/src/views/SettingsPage.jsx index c7a4fb54..a154ebb9 100644 --- a/frontend/src/views/SettingsPage.jsx +++ b/frontend/src/views/SettingsPage.jsx @@ -641,7 +641,7 @@ const Settings = (props) => {
- + ethereum-icon {/*window.ethereum.fromWei(userdata.eth_info.balance, "ether")*/} diff --git a/functions/onprem/orborus/build.sh b/functions/onprem/orborus/build.sh index 7910a143..a2f15df7 100644 --- a/functions/onprem/orborus/build.sh +++ b/functions/onprem/orborus/build.sh @@ -1,5 +1,5 @@ NAME=shuffle-orborus -VERSION=0.9.32 +VERSION=0.9.34 echo "Running docker build with $NAME:$VERSION" #docker rmi frikky/shuffle:$NAME --force diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index c10552a9..c2bc83c3 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -149,7 +149,7 @@ func cleanupExistingNodes(ctx context.Context) error { return err } - log.Printf("\n\nFound %d contaienrs", len(services)) + //log.Printf("\n\nFound %d contaienrs", len(services)) for _, service := range services { log.Printf("[INFO] Service: %#v", service.Spec.Annotations.Name) @@ -222,7 +222,7 @@ func deployServiceWorkers(image string) { //containerName := fmt.Sprintf("shuffle-worker-%s", parsedUuid) - replicas := uint64(2) + replicas := uint64(1) scaleReplicas := os.Getenv("SHUFFLE_SCALE_REPLICAS") if len(scaleReplicas) > 0 { tmpInt, err := strconv.Atoi(scaleReplicas) @@ -236,14 +236,38 @@ func deployServiceWorkers(image string) { } innerContainerName := fmt.Sprintf("shuffle-workers") + parsedConcurrent := uint64(50) + + cnt, _ := findActiveSwarmNodes() + nodeCount := uint64(1) + if cnt > 0 { + nodeCount = uint64(cnt) + } + + if cnt == 0 { + cnt = 1 + } + + 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) + log.Printf("[DEBUG] Deploying %d containers for worker with swarm to each node. Service name: %s. Image: %s", replicas, innerContainerName, image) // FIXME: May not need ingress ports. Could use internal services and DNS of swarm itself + // https://github.com/moby/moby/blob/e2f740de442bac52b280bc485a3ca5b31567d938/api/types/swarm/service.go#L46 serviceSpec := swarm.ServiceSpec{ Annotations: swarm.Annotations{ Name: innerContainerName, Labels: map[string]string{}, }, + Mode: swarm.ServiceMode{ + Replicated: &swarm.ReplicatedService{ + Replicas: &replicatedJobs, + }, + ReplicatedJob: &swarm.ReplicatedJob{ + MaxConcurrent: &parsedConcurrent, + }, + }, Networks: []swarm.NetworkAttachmentConfig{ swarm.NetworkAttachmentConfig{ Target: networkName, @@ -269,6 +293,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), }, Mounts: []mount.Mount{ mount.Mount{ @@ -306,7 +331,7 @@ func deployServiceWorkers(image string) { ) if err == nil { - log.Printf("[DEBUG] Successfully deployed workers with %d replicas", replicas) + log.Printf("[DEBUG] Successfully deployed workers with %d replica(s)", replicas) //time.Sleep(time.Duration(10) * time.Second) //log.Printf("[DEBUG] Servicecreate request: %#v %#v", service, err) } else { @@ -574,6 +599,30 @@ func getStats() { fmt.Printf("\n") } +func findActiveSwarmNodes() (int64, error) { + ctx := context.Background() + nodes, err := dockercli.NodeList(ctx, types.NodeListOptions{}) + if err != nil { + return 0, err + } + + nodeCount := int64(0) + for _, node := range nodes { + //log.Printf("ID: %s - %#v", node.ID, node.Status.State) + if node.Status.State == "ready" { + nodeCount += 1 + } + } + + return nodeCount, nil + + /* + containers, err := dockercli.ContainerList(ctx, types.ContainerListOptions{ + All: true, + }) + */ +} + // Initial loop etc func main() { log.Println("[INFO] Setting up execution environment") diff --git a/functions/onprem/worker/build.sh b/functions/onprem/worker/build.sh index dca4f189..58c9e819 100644 --- a/functions/onprem/worker/build.sh +++ b/functions/onprem/worker/build.sh @@ -1,5 +1,5 @@ NAME=shuffle-worker -VERSION=0.9.32 +VERSION=0.9.34 echo "Running docker build with $NAME:$VERSION" #CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin . diff --git a/functions/onprem/worker/go.mod b/functions/onprem/worker/go.mod index 3dfbb6ac..036d78da 100644 --- a/functions/onprem/worker/go.mod +++ b/functions/onprem/worker/go.mod @@ -10,6 +10,6 @@ require ( github.com/docker/go-connections v0.4.0 // indirect github.com/gorilla/mux v1.8.0 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/shuffle/shuffle-shared v0.1.33 + github.com/shuffle/shuffle-shared v0.1.35 go4.org v0.0.0-20201209231011-d4a079459e60 // indirect ) diff --git a/functions/onprem/worker/go.sum b/functions/onprem/worker/go.sum index 1ac1b966..9957793e 100644 --- a/functions/onprem/worker/go.sum +++ b/functions/onprem/worker/go.sum @@ -572,6 +572,8 @@ github.com/shuffle/shuffle-shared v0.1.32 h1:VzYecAkUbydIe5ufe5z6T+3PaaKWJASVznh github.com/shuffle/shuffle-shared v0.1.32/go.mod h1:0QrK51T12CpCj/be8hXduj/RtDnoeaZ3rfogELZE2IU= github.com/shuffle/shuffle-shared v0.1.33 h1:1U0yKWNfW7K7EKOj2aqSmd20UIA+nJeIurGEfx29ffU= github.com/shuffle/shuffle-shared v0.1.33/go.mod h1:0QrK51T12CpCj/be8hXduj/RtDnoeaZ3rfogELZE2IU= +github.com/shuffle/shuffle-shared v0.1.35 h1:CoCur/G+TaM2xiLgDCVdVxPhFffNK/4YRWTtzRBprvg= +github.com/shuffle/shuffle-shared v0.1.35/go.mod h1:2ndjLm4ZOvY6arGFwOgGnkQ457Ke7gka9HDF/EkdIxQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -582,6 +584,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 58ad67b7..a14d49ed 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "os" + "strconv" "strings" "time" @@ -2228,13 +2229,40 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl networkName = swarmNetworkName } + replicatedJobs := uint64(1) + + // Sent from Orborus + // Should be equal to + scaleReplicas := os.Getenv("SHUFFLE_APP_REPLICAS") + if len(scaleReplicas) > 0 { + tmpInt, err := strconv.Atoi(scaleReplicas) + if err != nil { + log.Printf("[ERROR] %s is not a valid number for replication", scaleReplicas) + } else { + replicatedJobs = uint64(tmpInt) + } + + log.Printf("[DEBUG] SHUFFLE_APP_REPLICAS set to value %#v. Trying to overwrite default (%d/node)", scaleReplicas, replicatedJobs) + } + log.Printf("[DEBUG] Deploying app with name %s with image %s", name, image) + parsedConcurrent := uint64(50) + containerName := fmt.Sprintf(strings.Replace(name, ".", "-", -1)) serviceSpec := swarm.ServiceSpec{ Annotations: swarm.Annotations{ Name: containerName, Labels: map[string]string{}, }, + Mode: swarm.ServiceMode{ + Replicated: &swarm.ReplicatedService{ + // Max total + Replicas: &replicatedJobs, + }, + ReplicatedJob: &swarm.ReplicatedJob{ + MaxConcurrent: &parsedConcurrent, + }, + }, Networks: []swarm.NetworkAttachmentConfig{ swarm.NetworkAttachmentConfig{ Target: networkName, @@ -2269,7 +2297,8 @@ func deploySwarmService(dockercli *dockerclient.Client, name, image string, depl Condition: swarm.RestartPolicyConditionNone, }, Placement: &swarm.Placement{ - MaxReplicas: 5, + // Max per node + MaxReplicas: 1, }, }, }