From d4d62323dd2ff255a0ae8b0a03e26d0457923757 Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Fri, 25 Jun 2021 12:39:42 +0200 Subject: [PATCH] Assist (#57) * feat(api): assist peerJS server * feat(api): install assist_server dependencies and start it with the API * feat(api): assist: list live sessions * feat(nginx): expose assist_server and block peers listing * feat(api): merged sourcemaps reader and assist-server feat(api): change image definition feat(api): changed service start command feat(utilities): created full server & image definition feat(nginx): reset chalice configuration * feat(utilities): utilities.yaml * feat(nginx): utilities URL * feat(utilities): utilities template * feat(ci): Adding utilities GH action. Signed-off-by: Rajesh Rajendran * feat(utilities): build script * feat(utilities): build script fix image name * feat(utilities): tag and push image as latest * feat(api): tag and push image as latest * feat(api): extract peers host Co-authored-by: Rajesh Rajendran --- api/.chalice/config.json | 1 + api/chalicelib/core/assist.py | 3 ++- scripts/helm/app/chalice.yaml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/.chalice/config.json b/api/.chalice/config.json index 060607b45..42382be52 100644 --- a/api/.chalice/config.json +++ b/api/.chalice/config.json @@ -33,6 +33,7 @@ "sourcemaps_reader": "http://utilities.app.svc.cluster.local:9000/sourcemaps", "sourcemaps_bucket": "sourcemaps", "js_cache_bucket": "sessions-assets", + "peers": "http://utilities.app.svc.cluster.local:9000/peers", "async_Token": "", "EMAIL_HOST": "", "EMAIL_PORT": "587", diff --git a/api/chalicelib/core/assist.py b/api/chalicelib/core/assist.py index 9f26ea07e..485d1d624 100644 --- a/api/chalicelib/core/assist.py +++ b/api/chalicelib/core/assist.py @@ -1,6 +1,7 @@ from chalicelib.utils import pg_client, helper from chalicelib.core import projects import requests +from chalicelib.utils.helper import environ SESSION_PROJECTION_COLS = """s.project_id, s.session_id::text AS session_id, @@ -20,7 +21,7 @@ SESSION_PROJECTION_COLS = """s.project_id, def get_live_sessions(project_id): project_key = projects.get_project_key(project_id) - connected_peers = requests.get(f"http://127.0.0.1:9000/peers/{project_key}") + connected_peers = requests.get(environ["peers"] + f"/{project_key}") if connected_peers.status_code != 200: print("!! issue with the peer-server") print(connected_peers.text) diff --git a/scripts/helm/app/chalice.yaml b/scripts/helm/app/chalice.yaml index e0c409669..328ad17e3 100644 --- a/scripts/helm/app/chalice.yaml +++ b/scripts/helm/app/chalice.yaml @@ -62,6 +62,7 @@ env: S3_KEY: minios3AccessKeyS3cr3t S3_SECRET: m1n10s3CretK3yPassw0rd sourcemaps_reader: 'http://utilities.app.svc.cluster.local:9000/sourcemaps' + peers: 'http://utilities.app.svc.cluster.local:9000/peers' # Enable logging for python app # Ref: https://stackoverflow.com/questions/43969743/logs-in-kubernetes-pod-not-showing-up PYTHONUNBUFFERED: '0'