From 1c87838d19e2d062c33ccff9786d2069833db9be Mon Sep 17 00:00:00 2001 From: Harduino Date: Sat, 1 Aug 2020 21:15:40 +0300 Subject: [PATCH 1/9] siemonster :: use Alpine image for backend/orborus as Scratch doesn't work correctly on Minikube --- backend/Dockerfile | 2 +- functions/onprem/orborus/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 14d9137c..d203ed78 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -24,7 +24,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o webapp . FROM alpine:latest as certs RUN apk --update add ca-certificates -from scratch +FROM alpine:3.12 COPY --from=builder /app/ /app COPY --from=builder /app_sdk/ /app_sdk diff --git a/functions/onprem/orborus/Dockerfile b/functions/onprem/orborus/Dockerfile index 1a15a2e6..8e54c8a0 100644 --- a/functions/onprem/orborus/Dockerfile +++ b/functions/onprem/orborus/Dockerfile @@ -8,7 +8,7 @@ RUN go get github.com/docker/docker/api/types github.com/docker/docker/api/types RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus . -from scratch +FROM alpine:3.12 COPY --from=builder /app/ / CMD ["./orborus"] From f7dacd57924b9f22089a05214aa2eac6b4013bc4 Mon Sep 17 00:00:00 2001 From: Harduino Date: Sat, 1 Aug 2020 21:18:29 +0300 Subject: [PATCH 2/9] siemonster :: orborus - optimize rebuilding speed as step of installing GO-packages will be cached --- functions/onprem/orborus/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/Dockerfile b/functions/onprem/orborus/Dockerfile index 8e54c8a0..30859959 100644 --- a/functions/onprem/orborus/Dockerfile +++ b/functions/onprem/orborus/Dockerfile @@ -2,10 +2,10 @@ from golang as builder RUN mkdir /app WORKDIR /app -COPY orborus.go /app/orborus.go - RUN go get github.com/docker/docker/api/types github.com/docker/docker/api/types/container github.com/docker/docker/client +COPY orborus.go /app/orborus.go + RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus . FROM alpine:3.12 From 2b773f3c24863deeee0e1ccdd461e00c22ca5e07 Mon Sep 17 00:00:00 2001 From: Harduino Date: Sat, 1 Aug 2020 21:31:30 +0300 Subject: [PATCH 3/9] siemonster :: we don't have to comment build every time in compose file as we can declare build/image simultaneously --- docker-compose.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8faba6f3..df00d6d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: frontend: - #build: ./frontend + build: ./frontend image: frikky/shuffle:frontend container_name: shuffle-frontend hostname: shuffle-frontend @@ -16,19 +16,19 @@ services: depends_on: - backend backend: - #build: ./backend + build: ./backend image: frikky/shuffle:backend container_name: shuffle-backend hostname: ${BACKEND_HOSTNAME} # Here for debugging: - ports: + ports: - "${BACKEND_PORT}:5001" networks: - shuffle - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ${APP_HOTLOAD_LOCATION}:/shuffle-apps - environment: + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ${APP_HOTLOAD_LOCATION}:/shuffle-apps + environment: - DATASTORE_EMULATOR_HOST=shuffle-database:8000 - APP_HOTLOAD_FOLDER=/shuffle-apps - ORG_ID=${ORG_ID} @@ -42,14 +42,14 @@ services: depends_on: - database orborus: - #build: ./functions/onprem/orborus + build: ./functions/onprem/orborus image: frikky/shuffle:orborus container_name: shuffle-orborus hostname: shuffle-orborus networks: - shuffle - volumes: - - /var/run/docker.sock:/var/run/docker.sock + volumes: + - /var/run/docker.sock:/var/run/docker.sock environment: - ORG_ID=${ORG_ID} - ENVIRONMENT_NAME=${ENVIRONMENT_NAME} @@ -60,7 +60,7 @@ services: - SHUFFLE_PASS_WORKER_PROXY=${SHUFFLE_PASS_WORKER_PROXY} restart: unless-stopped database: - #build: ./backend/database + build: ./backend/database image: frikky/shuffle:database container_name: shuffle-database hostname: shuffle-database From d4a82713dbf0f273d84f423d708bad89000fe5c5 Mon Sep 17 00:00:00 2001 From: Harduino Date: Sat, 1 Aug 2020 21:42:40 +0300 Subject: [PATCH 4/9] siemonster :: implementation of parent's network --- functions/onprem/orborus/Dockerfile | 1 + functions/onprem/orborus/orborus.go | 91 +++++++++++------------------ functions/onprem/worker/Dockerfile | 34 +++++------ functions/onprem/worker/worker.go | 40 ++++++------- 4 files changed, 69 insertions(+), 97 deletions(-) diff --git a/functions/onprem/orborus/Dockerfile b/functions/onprem/orborus/Dockerfile index 30859959..e5bc379e 100644 --- a/functions/onprem/orborus/Dockerfile +++ b/functions/onprem/orborus/Dockerfile @@ -9,6 +9,7 @@ COPY orborus.go /app/orborus.go RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus . FROM alpine:3.12 +RUN apk add --no-cache bash COPY --from=builder /app/ / CMD ["./orborus"] diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index fbee4052..983b45bd 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -14,12 +14,12 @@ import ( "log" "net/http" "os" + "os/exec" "strings" "time" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - network "github.com/docker/docker/api/types/network" dockerclient "github.com/docker/docker/client" //network "github.com/docker/docker/api/types/network" //natting "github.com/docker/go-connections/nat" @@ -27,11 +27,11 @@ import ( var baseUrl = os.Getenv("BASE_URL") var baseimagename = "frikky/shuffle" -var shuffleNetwork = "" // Filled in init if found var dockerApiVersion = os.Getenv("DOCKER_API_VERSION") var environment = os.Getenv("ENVIRONMENT_NAME") var orgId = os.Getenv("ORG_ID") +var runningMode = os.Getenv("RUNNING_MODE") // Starts jobs in bulk, so this could be increased var sleepTime = 3 @@ -62,56 +62,50 @@ func init() { if err != nil { panic(fmt.Sprintf("Unable to create docker client: %s", err)) } +} - // FIXME: Move this to global variables? - containerIdentifier := "orborus" - networkIdentifier := "shuffle" +// form id of current running container +func getThisContainerId() string { + containerId := "" + fCol := "" - ctx := context.Background() - containers, err := dockercli.ContainerList(ctx, types.ContainerListOptions{ - All: true, - }) - if err != nil { - log.Printf("Failed getting containers during init - running without network check: %s", err) + // some adjusting based on current running mode + switch runningMode { + case "Kubernetes": + // cgroup will be like: + // 11:net_cls,net_prio:/kubepods/besteffort/podf132b44d-cfcf-43f7-9906-79f58e268333/851466f8b5ed5aa0f265b1c95c6d2bafbc51a38dd5c5a1621b6e586572150009 + fCol = "5" + + case "Docker": + // cgroup will be like: + // 12:perf_event:/docker/0f06810364f52a2cd6e80bfba27419cb8a29758a204cd676388f4913bb366f2b + fCol = "3" + + default: + fCol = "3" // for backward-compatibility with production + log.Printf("[WARNING] Running not containerized, so I can't figure out current container id!") } - // Skip random containers. Only handle things related to Shuffle. - for _, container := range containers { - found := false - - // Bad states - it might just be created sometimes, leading to now netowkr - //if container.State == "restarting" || container.State == "paused" || container.State == "exited" || container.State == "dead" { - // continue - //} - - for _, name := range container.Names { - if !strings.Contains(strings.ToLower(name), containerIdentifier) { - found = true - continue - } - } - - if found { - for key, _ := range container.NetworkSettings.Networks { - if strings.Contains(strings.ToLower(key), networkIdentifier) { - shuffleNetwork = key - break - } - } + if fCol != "" { + cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f%s", fCol) + out, err := exec.Command("bash","-c",cmd).Output() + if err == nil { + containerId = strings.TrimSpace(string(out)) } } - if len(shuffleNetwork) > 0 { - log.Printf("Found shuffle network \"%s\" for container %s", shuffleNetwork, containerIdentifier) - } else { - log.Printf("Running Shuffle without a docker network") - } + return containerId } // Deploys the internal worker whenever something happens func deployWorker(image string, identifier string, env []string) { + // figure out current container id + containerId := getThisContainerId() + // Binds is the actual "-v" volume. hostConfig := &container.HostConfig{ + NetworkMode: container.NetworkMode(fmt.Sprintf("container:%s", containerId)), + IpcMode: container.IpcMode(fmt.Sprintf("container:%s", containerId)), LogConfig: container.LogConfig{ Type: "json-file", Config: map[string]string{}, @@ -121,23 +115,6 @@ func deployWorker(image string, identifier string, env []string) { }, } - // Look for Shuffle network and set it - networkConfig := &network.NetworkingConfig{} - if len(shuffleNetwork) > 0 { - log.Printf("Starting worker with network %s", shuffleNetwork) - networkConfig = &network.NetworkingConfig{ - EndpointsConfig: map[string]*network.EndpointSettings{ - shuffleNetwork: { - NetworkID: shuffleNetwork, - }, - }, - } - - env = append(env, fmt.Sprintf("DOCKER_NETWORK=%s", shuffleNetwork)) - } else { - log.Printf("Starting worker WITHOUT any specified network: %s", shuffleNetwork) - } - // ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/ config := &container.Config{ Image: image, @@ -154,7 +131,7 @@ func deployWorker(image string, identifier string, env []string) { context.Background(), config, hostConfig, - networkConfig, + nil, nil, identifier, ) diff --git a/functions/onprem/worker/Dockerfile b/functions/onprem/worker/Dockerfile index 2f8971f8..7f253e1b 100644 --- a/functions/onprem/worker/Dockerfile +++ b/functions/onprem/worker/Dockerfile @@ -1,21 +1,17 @@ -#from golang as builder -# -#RUN mkdir /app -#WORKDIR /app -#COPY worker.go /app/worker.go -# -#RUN go get github.com/docker/docker/api/types -#RUN go get github.com/docker/docker/api/types/container -#RUN go get -u github.com/docker/docker/client -# -#RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker . -# +from golang as builder -# THis is a workaround until I get docker/docker to build in a dockerfile -# PS: This is tricky to google. -# Might not work on some machines. -from scratch -#COPY --from=builder /app/ / -COPY worker.bin /worker.bin +WORKDIR /app -CMD ["./worker.bin"] +RUN go get github.com/docker/docker/api/types && \ + go get github.com/docker/docker/api/types/container && \ + go get -u github.com/docker/docker/client + +COPY worker.go /app/worker.go +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker . + + +FROM alpine:3.12 +RUN apk add --no-cache bash +COPY --from=builder /app/ / + +CMD ["./worker"] diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 48b11ebc..dce95db1 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -11,12 +11,12 @@ import ( "log" "net/http" "os" + "os/exec" "strings" "time" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" - network "github.com/docker/docker/api/types/network" dockerclient "github.com/docker/docker/client" ) @@ -412,9 +412,26 @@ func shutdown(executionId, workflowId string) { os.Exit(3) } +// form container id of current running container +func getThisContainerId() string { + containerId := "" + cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f3") + out, err := exec.Command("bash","-c",cmd).Output() + if err == nil { + containerId = strings.TrimSpace(string(out)) + } + + return containerId +} + // Deploys the internal worker whenever something happens func deployApp(cli *dockerclient.Client, image string, identifier string, env []string) error { + // figure out current container id + containerId := getThisContainerId() + hostConfig := &container.HostConfig{ + NetworkMode: container.NetworkMode(fmt.Sprintf("container:%s", containerId)), + IpcMode: container.IpcMode(fmt.Sprintf("container:%s", containerId)), LogConfig: container.LogConfig{ Type: "json-file", Config: map[string]string{}, @@ -426,23 +443,11 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] Env: env, } - networkConfig := &network.NetworkingConfig{} - shuffleNetwork := os.Getenv("DOCKER_NETWORK") - if len(shuffleNetwork) > 0 { - networkConfig = &network.NetworkingConfig{ - EndpointsConfig: map[string]*network.EndpointSettings{ - shuffleNetwork: { - NetworkID: shuffleNetwork, - }, - }, - } - } - cont, err := cli.ContainerCreate( context.Background(), config, hostConfig, - networkConfig, + nil, nil, identifier, ) @@ -1107,13 +1112,6 @@ func main() { } } - shuffleNetwork := os.Getenv("DOCKER_NETWORK") - if len(shuffleNetwork) > 0 { - log.Printf("Running with Docker network %s", shuffleNetwork) - } else { - log.Printf("No docker network specified for Worker.") - } - // WORKER_TESTING_WORKFLOW should be a workflow ID authorization := "" executionId := "" From 4135f339820fca4a716399bc0d4ae8eee13fefee Mon Sep 17 00:00:00 2001 From: Harduino Date: Wed, 5 Aug 2020 12:01:37 +0300 Subject: [PATCH 5/9] siemonster :: improve determining self container id --- functions/onprem/orborus/orborus.go | 2 +- functions/onprem/worker/worker.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 983b45bd..daab7a71 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -87,7 +87,7 @@ func getThisContainerId() string { } if fCol != "" { - cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f%s", fCol) + cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f%s", fCol) out, err := exec.Command("bash","-c",cmd).Output() if err == nil { containerId = strings.TrimSpace(string(out)) diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index dce95db1..6824434a 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -415,7 +415,7 @@ func shutdown(executionId, workflowId string) { // form container id of current running container func getThisContainerId() string { containerId := "" - cmd := fmt.Sprintf("head -1 /proc/self/cgroup | cut -d/ -f3") + cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f3") out, err := exec.Command("bash","-c",cmd).Output() if err == nil { containerId = strings.TrimSpace(string(out)) From 03ab5ba0e179b85f0cb648c3376723ab573345ef Mon Sep 17 00:00:00 2001 From: Harduino Date: Wed, 5 Aug 2020 12:03:23 +0300 Subject: [PATCH 6/9] siemonster :: handle empty calculated self container id --- functions/onprem/orborus/orborus.go | 14 +++++++++----- functions/onprem/worker/worker.go | 15 ++++++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index daab7a71..d37544cd 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -99,13 +99,8 @@ func getThisContainerId() string { // Deploys the internal worker whenever something happens func deployWorker(image string, identifier string, env []string) { - // figure out current container id - containerId := getThisContainerId() - // Binds is the actual "-v" volume. hostConfig := &container.HostConfig{ - NetworkMode: container.NetworkMode(fmt.Sprintf("container:%s", containerId)), - IpcMode: container.IpcMode(fmt.Sprintf("container:%s", containerId)), LogConfig: container.LogConfig{ Type: "json-file", Config: map[string]string{}, @@ -115,6 +110,15 @@ func deployWorker(image string, identifier string, env []string) { }, } + // form container id and use it as network source if it's not empty + containerId := getThisContainerId() + if containerId != "" { + hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) + hostConfig.IpcMode = container.IpcMode(fmt.Sprintf("container:%s", containerId)) + } else { + log.Printf("[WARNING] Empty determined container id, continue without NetworkMode/IpcMode") + } + // ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/ config := &container.Config{ Image: image, diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 6824434a..96d1afdf 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -426,18 +426,23 @@ func getThisContainerId() string { // Deploys the internal worker whenever something happens func deployApp(cli *dockerclient.Client, image string, identifier string, env []string) error { - // figure out current container id - containerId := getThisContainerId() - + // form basic hostConfig hostConfig := &container.HostConfig{ - NetworkMode: container.NetworkMode(fmt.Sprintf("container:%s", containerId)), - IpcMode: container.IpcMode(fmt.Sprintf("container:%s", containerId)), LogConfig: container.LogConfig{ Type: "json-file", Config: map[string]string{}, }, } + // form container id and use it as network source if it's not empty + containerId := getThisContainerId() + if containerId != "" { + hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) + hostConfig.IpcMode = container.IpcMode(fmt.Sprintf("container:%s", containerId)) + } else { + log.Printf("[WARNING] Empty determined container id, continue without NetworkMode/IpcMode") + } + config := &container.Config{ Image: image, Env: env, From 6d6e7cdc7ed375d2ae03f8776c4851d65cc478a4 Mon Sep 17 00:00:00 2001 From: Harduino Date: Wed, 5 Aug 2020 12:03:53 +0300 Subject: [PATCH 7/9] siemonster :: remove IpcMode --- functions/onprem/orborus/orborus.go | 3 +-- functions/onprem/worker/worker.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index d37544cd..e72d7c7b 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -114,9 +114,8 @@ func deployWorker(image string, identifier string, env []string) { containerId := getThisContainerId() if containerId != "" { hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) - hostConfig.IpcMode = container.IpcMode(fmt.Sprintf("container:%s", containerId)) } else { - log.Printf("[WARNING] Empty determined container id, continue without NetworkMode/IpcMode") + log.Printf("[WARNING] Empty determined container id, continue without NetworkMode") } // ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/ diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 96d1afdf..61a84f86 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -438,9 +438,8 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] containerId := getThisContainerId() if containerId != "" { hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) - hostConfig.IpcMode = container.IpcMode(fmt.Sprintf("container:%s", containerId)) } else { - log.Printf("[WARNING] Empty determined container id, continue without NetworkMode/IpcMode") + log.Printf("[WARNING] Empty determined container id, continue without NetworkMode") } config := &container.Config{ From b4ed7f87fc4ad2ff89d2e2dbfc20cd4e5866a8b9 Mon Sep 17 00:00:00 2001 From: Harduino Date: Wed, 5 Aug 2020 14:21:39 +0300 Subject: [PATCH 8/9] siemonster :: verbose found container id --- functions/onprem/orborus/orborus.go | 3 ++- functions/onprem/worker/worker.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index e72d7c7b..8a07d8f9 100644 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -112,10 +112,11 @@ func deployWorker(image string, identifier string, env []string) { // form container id and use it as network source if it's not empty containerId := getThisContainerId() + log.Printf("Found self container id: %s", containerId) if containerId != "" { hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) } else { - log.Printf("[WARNING] Empty determined container id, continue without NetworkMode") + log.Printf("[WARNING] Empty self container id, continue without NetworkMode") } // ROFL: https://docker-py.readthedocs.io/en/1.4.0/volumes/ diff --git a/functions/onprem/worker/worker.go b/functions/onprem/worker/worker.go index 61a84f86..f773271f 100644 --- a/functions/onprem/worker/worker.go +++ b/functions/onprem/worker/worker.go @@ -436,10 +436,11 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env [] // form container id and use it as network source if it's not empty containerId := getThisContainerId() + log.Printf("Found self container id: %s", containerId) if containerId != "" { hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) } else { - log.Printf("[WARNING] Empty determined container id, continue without NetworkMode") + log.Printf("[WARNING] Empty self container id, continue without NetworkMode") } config := &container.Config{ From f05077274b63e698211bf8582f6272d67ec09e50 Mon Sep 17 00:00:00 2001 From: Harduino Date: Fri, 7 Aug 2020 10:17:23 +0300 Subject: [PATCH 9/9] siemonster :: force to use NetworkMode=host on building Apps --- backend/go-app/docker.go | 2 ++ functions/stitcher.go | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/go-app/docker.go b/backend/go-app/docker.go index 865d5867..2d89127b 100644 --- a/backend/go-app/docker.go +++ b/backend/go-app/docker.go @@ -183,6 +183,7 @@ func buildImageMemory(fs billy.Filesystem, tags []string, dockerfileFolder strin Remove: true, Tags: tags, BuildArgs: map[string]*string{}, + NetworkMode: "host", } httpProxy := os.Getenv("HTTP_PROXY") @@ -245,6 +246,7 @@ func buildImage(tags []string, dockerfileFolder string) error { Remove: true, Tags: tags, BuildArgs: map[string]*string{}, + NetworkMode: "host", } httpProxy := os.Getenv("HTTP_PROXY") diff --git a/functions/stitcher.go b/functions/stitcher.go index 1b752f77..aae060f3 100644 --- a/functions/stitcher.go +++ b/functions/stitcher.go @@ -101,15 +101,15 @@ func getRunner(classname string) string { return fmt.Sprintf(` # Run the actual thing after we've checked params def run(request): - action = request.get_json() + action = request.get_json() print(action) print(type(action)) authorization_key = action.get("authorization") current_execution_id = action.get("execution_id") - + if action and "name" in action and "app_name" in action: asyncio.run(%s.run(action), debug=True) - return f'Attempting to execute function {action["name"]} in app {action["app_name"]}' + return f'Attempting to execute function {action["name"]} in app {action["app_name"]}' else: return f'Invalid action' @@ -610,6 +610,7 @@ func buildImage(client *client.Client, tags []string, dockerBuildCtxDir string) PullParent: true, Remove: true, Tags: tags, + NetworkMode: "host", }, )