From 08203730d295a067222cf0833064084dbf12a2a0 Mon Sep 17 00:00:00 2001 From: frikky Date: Fri, 4 Jun 2021 07:16:23 +0200 Subject: [PATCH] Fixed HTTP proxy things for env --- .env | 4 +-- .github/install-guide.md | 4 +-- backend/app_sdk/app_base.py | 54 +++++++++++++++++++++++++++++++ backend/go-app/go.mod | 4 +-- backend/go-app/go.sum | 2 ++ backend/go-app/main.go | 2 +- docker-compose.yml | 10 +++--- frontend/src/views/AppCreator.jsx | 9 +++--- 8 files changed, 71 insertions(+), 18 deletions(-) diff --git a/.env b/.env index 4874bd40..27cf372b 100644 --- a/.env +++ b/.env @@ -36,8 +36,8 @@ DB_LOCATION=./shuffle-database # Proxy configurations. SHUFFLE_PASS_WORKER_PROXY must be FALSE to not pass the proxy information to sub-apps. # PS: It will skip proxy for -SHUFFLE_HTTP_PROXY= -SHUFFLE_HTTPS_PROXY= +HTTP_PROXY= +HTTPS_PROXY= SHUFFLE_PASS_WORKER_PROXY=TRUE SHUFFLE_PASS_APP_PROXY=FALSE diff --git a/.github/install-guide.md b/.github/install-guide.md index 236103b3..165490b7 100644 --- a/.github/install-guide.md +++ b/.github/install-guide.md @@ -1,8 +1,8 @@ # Installation guide Installation of Shuffle is currently only available in docker. Looking for how to update Shuffle? Check the [updating guide](https://shuffler.io/docs/configuration#updating_shuffle) -## Docker - *nix OS -The Docker setup is done with docker-compose and is a single command to get set up. +# Docker - *nix +The Docker setup is done with docker-compose **PS: if you're setting up Shuffle on Windows, go to the next step (Windows Docker setup)** diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index 937e2309..7c3b7ea2 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -682,6 +682,60 @@ class AppBase: else: return returns + def set_cache(self, key, value): + org_id = self.full_execution["workflow"]["execution_org"]["id"] + url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id) + data = { + "workflow_id": self.full_execution["workflow"]["id"], + "execution_id": self.current_execution_id, + "authorization": self.authorization, + "org_id": org_id, + "key": key, + "value": str(value), + } + + response = requests.post(url, json=data) + try: + allvalues = response.json() + allvalues["key"] = key + allvalues["value"] = str(value) + return allvalues + except: + print("Value couldn't be parsed") + #return response.json() + return {"success": False} + + def get_cache(self, key): + org_id = self.full_execution["workflow"]["execution_org"]["id"] + url = "%s/api/v1/orgs/%s/get_cache" % (self.url, org_id) + data = { + "workflow_id": self.full_execution["workflow"]["id"], + "execution_id": self.current_execution_id, + "authorization": self.authorization, + "org_id": org_id, + "key": key, + } + + value = requests.post(url, json=data) + try: + allvalues = value.json() + print("VAL1: ", allvalues) + allvalues["key"] = key + print("VAL2: ", allvalues) + + try: + parsedvalue = json.loads(allvalues["value"]) + allvalues["value"] = parsedvalue + except: + print("Parsing of value as JSON failed") + return {"success": False} + + return allvalues + except: + print("Value couldn't be parsed, or json dump of value failed") + #return value.json() + return {"success": False} + # Sets files in the backend def set_files(self, infiles): full_execution = self.full_execution diff --git a/backend/go-app/go.mod b/backend/go-app/go.mod index 569852b4..5f4de234 100644 --- a/backend/go-app/go.mod +++ b/backend/go-app/go.mod @@ -2,7 +2,7 @@ module shuffle go 1.13 -replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared +//replace github.com/frikky/shuffle-shared => ../../../../git/shuffle-shared //replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi @@ -24,7 +24,7 @@ require ( github.com/elastic/go-elasticsearch/v7 v7.12.0 // indirect github.com/elastic/go-elasticsearch/v8 v8.0.0-20210519083322-55daf7425ecb // indirect github.com/frikky/kin-openapi v0.39.0 - github.com/frikky/shuffle-shared v0.0.53 + github.com/frikky/shuffle-shared v0.0.54 github.com/fsouza/go-dockerclient v1.7.2 // indirect github.com/ghodss/yaml v1.0.0 github.com/go-git/go-billy/v5 v5.0.0 diff --git a/backend/go-app/go.sum b/backend/go-app/go.sum index f695f50a..04cc6d1b 100644 --- a/backend/go-app/go.sum +++ b/backend/go-app/go.sum @@ -165,6 +165,8 @@ github.com/frikky/shuffle-shared v0.0.52 h1:sCSJl6WakYit32UjaRn0wsy4YhTBE6QZbCof github.com/frikky/shuffle-shared v0.0.52/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= github.com/frikky/shuffle-shared v0.0.53 h1:TszF/PoJ3JrfEf7qCGdN0So3bDbofNxh4Fqqz1KlH7Q= github.com/frikky/shuffle-shared v0.0.53/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= +github.com/frikky/shuffle-shared v0.0.54 h1:rc8JcavY6uDxaIkXFwLVotfv3/epXUzuCWzRCozZNGg= +github.com/frikky/shuffle-shared v0.0.54/go.mod h1:BknTfpun3qte5bumR3OqQHf9XWPIsyj8woiXCjIlbBc= github.com/fsouza/go-dockerclient v1.7.2 h1:bBEAcqLTkpq205jooP5RVroUKiVEWgGecHyeZc4OFjo= github.com/fsouza/go-dockerclient v1.7.2/go.mod h1:+ugtMCVRwnPfY7d8/baCzZ3uwB0BrG5DB8OzbtxaRz8= github.com/getkin/kin-openapi v0.8.0 h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE= diff --git a/backend/go-app/main.go b/backend/go-app/main.go index c859412a..438ebc88 100644 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -5686,7 +5686,7 @@ func initHandlers() { log.Printf("[DEBUG] Setting Opensearch proxy to %s", httpProxy) transport.Proxy = http.ProxyURL(url_proxy) } else { - log.PrintF("[ERROR] Failed setting proxy for %s", httpProxy) + log.Printf("[ERROR] Failed setting proxy for %s", httpProxy) } } diff --git a/docker-compose.yml b/docker-compose.yml index d7fa3eb0..318a3627 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: frontend: - #build: ./frontend + build: ./frontend image: ghcr.io/frikky/shuffle-frontend:nightly container_name: shuffle-frontend hostname: shuffle-frontend @@ -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} @@ -34,8 +34,6 @@ services: environment: - SHUFFLE_APP_HOTLOAD_FOLDER=/shuffle-apps - SHUFFLE_FILE_LOCATION=/shuffle-files - - HTTP_PROXY=${SHUFFLE_HTTP_PROXY} - - HTTPS_PROXY=${SHUFFLE_HTTPS_PROXY} restart: unless-stopped depends_on: - opensearch @@ -59,8 +57,8 @@ services: - SHUFFLE_BASE_IMAGE_NAME=${SHUFFLE_BASE_IMAGE_NAME} - SHUFFLE_BASE_IMAGE_REGISTRY=${SHUFFLE_BASE_IMAGE_REGISTRY} - SHUFFLE_BASE_IMAGE_TAG_SUFFIX=${SHUFFLE_BASE_IMAGE_TAG_SUFFIX} - - HTTP_PROXY=${SHUFFLE_HTTP_PROXY} - - HTTPS_PROXY=${SHUFFLE_HTTPS_PROXY} + - HTTP_PROXY=${HTTP_PROXY} + - HTTPS_PROXY=${HTTPS_PROXY} - SHUFFLE_PASS_WORKER_PROXY=${SHUFFLE_PASS_WORKER_PROXY} - SHUFFLE_PASS_APP_PROXY=${SHUFFLE_PASS_APP_PROXY} - SHUFFLE_ORBORUS_EXECUTION_TIMEOUT=600 diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index 21e9859d..01dade27 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -200,8 +200,8 @@ const AppCreator = (props) => { const increaseAmount = 50 const actionNonBodyRequest = ["GET", "HEAD", "DELETE", "CONNECT"] const actionBodyRequest = ["POST", "PUT", "PATCH",] - //const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth", "Oauth2"] - const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth", "JWT"] + //const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth", "JWT", "Oauth2"] + const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth"] const apikeySelection = ["Header", "Query",] const [name, setName] = useState(""); @@ -2058,7 +2058,7 @@ const AppCreator = (props) => {
New action
- Learn more about actions + Learn more about actions
Name { : null}

Actions {actionAmount > 0 ? ({actionAmount} / {actions.length}) : null}

- Actions are the tasks performed by an app. Read more about actions and apps - here. + Actions are the tasks performed by an app - usually single URL paths for REST API's.
{loopActions}