diff --git a/api/Dockerfile b/api/Dockerfile index 5ee6af463..a7321ec58 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -8,6 +8,7 @@ ARG envarg # Startup daemon ENV SOURCE_MAP_VERSION=0.7.4 \ APP_NAME=chalice \ + LISTEN_PORT=8000 \ ENTERPRISE_BUILD=${envarg} ADD https://unpkg.com/source-map@${SOURCE_MAP_VERSION}/lib/mappings.wasm /mappings.wasm diff --git a/api/Dockerfile.alerts b/api/Dockerfile.alerts index fdc3a9a36..4595035c2 100644 --- a/api/Dockerfile.alerts +++ b/api/Dockerfile.alerts @@ -7,6 +7,7 @@ ARG envarg ENV APP_NAME=alerts \ pg_minconn=1 \ pg_maxconn=10 \ + LISTEN_PORT=8000 \ ENTERPRISE_BUILD=${envarg} COPY requirements.txt /work_tmp/requirements.txt diff --git a/api/chalicelib/core/assist.py b/api/chalicelib/core/assist.py index 6fc8bcd90..39ae101c4 100644 --- a/api/chalicelib/core/assist.py +++ b/api/chalicelib/core/assist.py @@ -45,8 +45,8 @@ def get_live_sessions_ws(project_id, body: schemas.LiveSessionsSearchPayloadSche def __get_live_sessions_ws(project_id, data): project_key = projects.get_project_key(project_id) try: - connected_peers = requests.post(config("assist") % config("S3_KEY") + f"/{project_key}", json=data, - timeout=config("assistTimeout", cast=int, default=5)) + connected_peers = requests.post(config("ASSIST_URL") + config("assist") % config("S3_KEY") + f"/{project_key}", + json=data, timeout=config("assistTimeout", cast=int, default=5)) if connected_peers.status_code != 200: print("!! issue with the peer-server") print(connected_peers.text) @@ -76,8 +76,9 @@ def __get_live_sessions_ws(project_id, data): def get_live_session_by_id(project_id, session_id): project_key = projects.get_project_key(project_id) try: - connected_peers = requests.get(config("assist") % config("S3_KEY") + f"/{project_key}/{session_id}", - timeout=config("assistTimeout", cast=int, default=5)) + connected_peers = requests.get( + config("ASSIST_URL") + config("assist") % config("S3_KEY") + f"/{project_key}/{session_id}", + timeout=config("assistTimeout", cast=int, default=5)) if connected_peers.status_code != 200: print("!! issue with the peer-server") print(connected_peers.text) @@ -105,8 +106,9 @@ def is_live(project_id, session_id, project_key=None): if project_key is None: project_key = projects.get_project_key(project_id) try: - connected_peers = requests.get(config("assistList") % config("S3_KEY") + f"/{project_key}/{session_id}", - timeout=config("assistTimeout", cast=int, default=5)) + connected_peers = requests.get( + config("ASSIST_URL") + config("assistList") % config("S3_KEY") + f"/{project_key}/{session_id}", + timeout=config("assistTimeout", cast=int, default=5)) if connected_peers.status_code != 200: print("!! issue with the peer-server") print(connected_peers.text) @@ -133,8 +135,9 @@ def autocomplete(project_id, q: str, key: str = None): if key: params["key"] = key try: - results = requests.get(config("assistList") % config("S3_KEY") + f"/{project_key}/autocomplete", - params=params, timeout=config("assistTimeout", cast=int, default=5)) + results = requests.get( + config("ASSIST_URL") + config("assistList") % config("S3_KEY") + f"/{project_key}/autocomplete", + params=params, timeout=config("assistTimeout", cast=int, default=5)) if results.status_code != 200: print("!! issue with the peer-server") print(results.text) diff --git a/api/entrypoint.sh b/api/entrypoint.sh index 94b56121a..68f24cbd9 100755 --- a/api/entrypoint.sh +++ b/api/entrypoint.sh @@ -2,4 +2,4 @@ cd sourcemap-reader nohup npm start &> /tmp/sourcemap-reader.log & cd .. -uvicorn app:app --host 0.0.0.0 --reload --proxy-headers +uvicorn app:app --host 0.0.0.0 --port $LISTEN_PORT --reload --proxy-headers diff --git a/api/entrypoint_alerts.sh b/api/entrypoint_alerts.sh index 861206589..4c9a66672 100755 --- a/api/entrypoint_alerts.sh +++ b/api/entrypoint_alerts.sh @@ -1,3 +1,3 @@ #!/bin/sh -uvicorn app:app --host 0.0.0.0 --reload +uvicorn app:app --host 0.0.0.0 --port $LISTEN_PORT --reload diff --git a/api/env.default b/api/env.default index 01ad50606..7053e2b13 100644 --- a/api/env.default +++ b/api/env.default @@ -11,9 +11,7 @@ S3_HOST= S3_KEY= S3_SECRET= SITE_URL= -alert_ntf=http://127.0.0.1:8000/async/alerts/notifications/%s announcement_url= -assign_link=http://127.0.0.1:8000/async/email_assignment async_Token= captcha_key= captcha_server= @@ -28,8 +26,9 @@ jwt_algorithm=HS512 jwt_exp_delta_seconds=2592000 jwt_issuer=openreplay-default-foss jwt_secret="SET A RANDOM STRING HERE" -assist=http://assist-openreplay.app.svc.cluster.local:9001/assist/%s/sockets-live -assistList=http://assist-openreplay.app.svc.cluster.local:9001/assist/%s/sockets-list +ASSIST_URL=http://assist-openreplay.app.svc.cluster.local:9001 +assist=/assist/%s/sockets-live +assistList=/assist/%s/sockets-list pg_dbname=postgres pg_host=postgresql.db.svc.cluster.local pg_password=asayerPostgres diff --git a/ee/api/Dockerfile b/ee/api/Dockerfile index 73aa4a6a4..c073684c6 100644 --- a/ee/api/Dockerfile +++ b/ee/api/Dockerfile @@ -6,6 +6,7 @@ RUN apk add --no-cache build-base libressl libffi-dev libressl-dev libxslt-dev l ARG envarg ENV SOURCE_MAP_VERSION=0.7.4 \ APP_NAME=chalice \ + LISTEN_PORT=8000 \ ENTERPRISE_BUILD=${envarg} ADD https://unpkg.com/source-map@${SOURCE_MAP_VERSION}/lib/mappings.wasm /mappings.wasm diff --git a/ee/api/Dockerfile.alerts b/ee/api/Dockerfile.alerts index 86a5915cd..3b16c0d7d 100644 --- a/ee/api/Dockerfile.alerts +++ b/ee/api/Dockerfile.alerts @@ -7,6 +7,7 @@ ARG envarg ENV APP_NAME=alerts \ pg_minconn=1 \ pg_maxconn=10 \ + LISTEN_PORT=8000 \ ENTERPRISE_BUILD=${envarg} COPY requirements-alerts.txt /work_tmp/requirements.txt diff --git a/ee/api/entrypoint.sh b/ee/api/entrypoint.sh index 724c7d6f1..fcb58b528 100755 --- a/ee/api/entrypoint.sh +++ b/ee/api/entrypoint.sh @@ -4,4 +4,4 @@ source /tmp/.env.override cd sourcemap-reader nohup npm start &> /tmp/sourcemap-reader.log & cd .. -uvicorn app:app --host 0.0.0.0 --reload --proxy-headers +uvicorn app:app --host 0.0.0.0 --port $LISTEN_PORT --reload --proxy-headers diff --git a/ee/api/entrypoint_alerts.sh b/ee/api/entrypoint_alerts.sh index 04e60ce1b..fa492d5b7 100755 --- a/ee/api/entrypoint_alerts.sh +++ b/ee/api/entrypoint_alerts.sh @@ -1,4 +1,4 @@ #!/bin/sh sh env_vars.sh source /tmp/.env.override -uvicorn app:app --host 0.0.0.0 --reload +uvicorn app:app --host 0.0.0.0 --port $LISTEN_PORT --reload diff --git a/ee/api/env.default b/ee/api/env.default index 65f55a03c..ef04bbc3b 100644 --- a/ee/api/env.default +++ b/ee/api/env.default @@ -13,9 +13,7 @@ S3_KEY= S3_SECRET= SAML2_MD_URL= SITE_URL= -alert_ntf=http://127.0.0.1:8000/async/alerts/notifications/%s announcement_url= -assign_link=http://127.0.0.1:8000/async/email_assignment async_Token= captcha_key= captcha_server= @@ -37,8 +35,9 @@ jwt_algorithm=HS512 jwt_exp_delta_seconds=2592000 jwt_issuer=openreplay-default-ee jwt_secret="SET A RANDOM STRING HERE" -assist=http://assist-openreplay.app.svc.cluster.local:9001/assist/%s/sockets-live -assistList=http://assist-openreplay.app.svc.cluster.local:9001/assist/%s/sockets-list +ASSIST_URL=http://assist-openreplay.app.svc.cluster.local:9001 +assist=/assist/%s/sockets-live +assistList=/assist/%s/sockets-list pg_dbname=postgres pg_host=postgresql.db.svc.cluster.local pg_password=asayerPostgres diff --git a/ee/utilities/Dockerfile b/ee/utilities/Dockerfile index 2de6197a2..9b7b96388 100644 --- a/ee/utilities/Dockerfile +++ b/ee/utilities/Dockerfile @@ -5,7 +5,8 @@ RUN apk add --no-cache tini git libc6-compat && ln -s /lib/libc.musl-x86_64.so.1 ARG envarg ENV ENTERPRISE_BUILD=${envarg} \ - MAXMINDDB_FILE=/home/openreplay/geoip.mmdb + MAXMINDDB_FILE=/home/openreplay/geoip.mmdb \ + LISTEN_PORT=9001 WORKDIR /work COPY package.json . COPY package-lock.json . diff --git a/ee/utilities/server.js b/ee/utilities/server.js index 93d6d2a2e..13a89be79 100644 --- a/ee/utilities/server.js +++ b/ee/utilities/server.js @@ -9,7 +9,7 @@ if (process.env.redis === "true") { } const HOST = '0.0.0.0'; -const PORT = 9001; +const PORT = process.env.LISTEN_PORT || 9001; let debug = process.env.debug === "1" || false; const PREFIX = process.env.prefix || `/assist` diff --git a/utilities/Dockerfile b/utilities/Dockerfile index 2de6197a2..9b7b96388 100644 --- a/utilities/Dockerfile +++ b/utilities/Dockerfile @@ -5,7 +5,8 @@ RUN apk add --no-cache tini git libc6-compat && ln -s /lib/libc.musl-x86_64.so.1 ARG envarg ENV ENTERPRISE_BUILD=${envarg} \ - MAXMINDDB_FILE=/home/openreplay/geoip.mmdb + MAXMINDDB_FILE=/home/openreplay/geoip.mmdb \ + LISTEN_PORT=9001 WORKDIR /work COPY package.json . COPY package-lock.json . diff --git a/utilities/server.js b/utilities/server.js index ad03aafab..331d45a80 100644 --- a/utilities/server.js +++ b/utilities/server.js @@ -4,7 +4,7 @@ const socket = require("./servers/websocket"); const {request_logger} = require("./utils/helper"); const HOST = '0.0.0.0'; -const PORT = 9001; +const PORT = process.env.LISTEN_PORT || 9001; const wsapp = express(); wsapp.use(express.json());