From e9e33d7785f30118bfd289c3c0d51ff252f1d04d Mon Sep 17 00:00:00 2001 From: prasad89 Date: Tue, 26 Mar 2024 13:59:05 +0530 Subject: [PATCH 01/14] Added web client and control center services to docker-compose.yml --- docker-compose.yml | 47 ++++++++++++++++++++++++++++++++++++------- docker/web.Dockerfile | 18 +++++++++++++++++ 2 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 docker/web.Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index e55008f1e34e..900e90d15882 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,6 +122,39 @@ services: labels: logs: "promtail" + ### Web Client + hyperswitch-web: + ports: + - "9050:9050" + - "9060:9060" + - "5252:5252" + build: + context: ./docker + dockerfile: web.Dockerfile + networks: + - router_net + environment: + - HYPERSWITCH_SERVER_URL=http://localhost:8080 + depends_on: + hyperswitch-server: + condition: service_started + + ### Control Center + hyperswitch-control-center: + image: juspaydotin/hyperswitch-control-center + ports: + - "9000:9000" + networks: + - router_net + environment: + - apiBaseUrl=http://localhost:8080 + - sdkBaseUrl=http://localhost:9050 + depends_on: + hyperswitch-server: + condition: service_started + hyperswitch-web: + condition: service_started + ### Clustered Redis setup redis-cluster: image: redis:7 @@ -290,19 +323,19 @@ services: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 - KAFKA_PROCESS_ROLES: 'broker,controller' + KAFKA_PROCESS_ROLES: "broker,controller" KAFKA_NODE_ID: 1 - KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka0:29093' - KAFKA_LISTENERS: 'PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092' - KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' - KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' + KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka0:29093" + KAFKA_LISTENERS: "PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092" + KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER" + KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs" JMX_PORT: 9997 KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka0 -Dcom.sun.management.jmxremote.rmi.port=9997 profiles: - analytics volumes: - ./monitoring/kafka-script.sh:/tmp/update_run.sh - command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'" + command: 'bash -c ''if [ ! -f /tmp/update_run.sh ]; then echo "ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi''' # Kafka UI for debugging kafka queues kafka-ui: @@ -332,4 +365,4 @@ services: ulimits: nofile: soft: 262144 - hard: 262144 \ No newline at end of file + hard: 262144 diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile new file mode 100644 index 000000000000..51abd1382a89 --- /dev/null +++ b/docker/web.Dockerfile @@ -0,0 +1,18 @@ +FROM node:lts-alpine + +RUN npm install concurrently -g + +WORKDIR /hyperswitch-web + +RUN git clone https://github.com/juspay/hyperswitch-web . + +RUN sed -i '/hot: true,/a \ host: "0.0.0.0",' webpack.dev.js +RUN sed -i '/hot: true,/a \ host: "0.0.0.0",' Hyperswitch-React-Demo-App/webpack.dev.js + +RUN npm install + +EXPOSE 9050 +EXPOSE 5252 +EXPOSE 9060 + +CMD concurrently "npm run start:dev" "npm run start:playground" \ No newline at end of file From f6066756b52a3140e3f7480a1810d3b5116baf60 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Tue, 26 Mar 2024 21:58:49 +0530 Subject: [PATCH 02/14] Update server and web URLs in docker-compose.yml --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 900e90d15882..75543730832c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,7 +134,7 @@ services: networks: - router_net environment: - - HYPERSWITCH_SERVER_URL=http://localhost:8080 + - HYPERSWITCH_SERVER_URL=http://hyperswitch-server:8080 depends_on: hyperswitch-server: condition: service_started @@ -147,8 +147,8 @@ services: networks: - router_net environment: - - apiBaseUrl=http://localhost:8080 - - sdkBaseUrl=http://localhost:9050 + - apiBaseUrl=http://hyperswitch-server:8080 + - sdkBaseUrl=http://hyperswitch-web:9050 depends_on: hyperswitch-server: condition: service_started From a84bb9e3171053559aa08e6c51222d6647bc9695 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Tue, 26 Mar 2024 23:41:00 +0530 Subject: [PATCH 03/14] Fix formatting in docker-compose.yml file --- docker-compose.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 75543730832c..8287a8419ebc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,7 +122,7 @@ services: labels: logs: "promtail" - ### Web Client +### Web Client hyperswitch-web: ports: - "9050:9050" @@ -323,19 +323,19 @@ services: KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 - KAFKA_PROCESS_ROLES: "broker,controller" + KAFKA_PROCESS_ROLES: 'broker,controller' KAFKA_NODE_ID: 1 - KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka0:29093" - KAFKA_LISTENERS: "PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092" - KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER" - KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs" + KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka0:29093' + KAFKA_LISTENERS: 'PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092' + KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' + KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' JMX_PORT: 9997 KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka0 -Dcom.sun.management.jmxremote.rmi.port=9997 profiles: - analytics volumes: - ./monitoring/kafka-script.sh:/tmp/update_run.sh - command: 'bash -c ''if [ ! -f /tmp/update_run.sh ]; then echo "ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi''' + command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'" # Kafka UI for debugging kafka queues kafka-ui: @@ -365,4 +365,4 @@ services: ulimits: nofile: soft: 262144 - hard: 262144 + hard: 262144 \ No newline at end of file From 115ba2ac2578293b540e3be7a07159933bbdf537 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 27 Mar 2024 00:28:04 +0530 Subject: [PATCH 04/14] Update Dockerfile to use latest LTS version of Node.js --- docker/web.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 51abd1382a89..b48468c68771 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts-alpine +FROM node:lts RUN npm install concurrently -g From 89fa634a4b9ef36a6f424d35fbbfa41a0f44bbe7 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 27 Mar 2024 03:16:26 +0530 Subject: [PATCH 05/14] Add environment variables for Hyperswitch configuration --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 8287a8419ebc..600bf4673282 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -134,7 +134,11 @@ services: networks: - router_net environment: + - HYPERSWITCH_PUBLISHABLE_KEY= + - HYPERSWITCH_SECRET_KEY= - HYPERSWITCH_SERVER_URL=http://hyperswitch-server:8080 + - HYPERSWITCH_CLIENT_URL= + - SELF_SERVER_URL= depends_on: hyperswitch-server: condition: service_started From 2c62e4158b6d26c96d7ed7c0f3fbe563a18b6861 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 27 Mar 2024 10:28:24 +0530 Subject: [PATCH 06/14] Update environment variables in docker-compose.yml --- docker-compose.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 600bf4673282..64304eca641c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -133,12 +133,14 @@ services: dockerfile: web.Dockerfile networks: - router_net + env_file: + - ./.env environment: - - HYPERSWITCH_PUBLISHABLE_KEY= - - HYPERSWITCH_SECRET_KEY= - - HYPERSWITCH_SERVER_URL=http://hyperswitch-server:8080 - - HYPERSWITCH_CLIENT_URL= - - SELF_SERVER_URL= + - HYPERSWITCH_PUBLISHABLE_KEY=$HYPERSWITCH_PUBLISHABLE_KEY + - HYPERSWITCH_SECRET_KEY=$HYPERSWITCH_SECRET_KEY + - HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080} + - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://hyperswitch-web:9050} + - SELF_SERVER_URL=${SELF_SERVER_URL:-http://hyperswitch-web:5252} depends_on: hyperswitch-server: condition: service_started From 270db2a9e56efffa3ad8996f98e59bd551cead5c Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 27 Mar 2024 23:00:00 +0530 Subject: [PATCH 07/14] Update URLs in control-center --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 64304eca641c..0020431dec97 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -153,8 +153,8 @@ services: networks: - router_net environment: - - apiBaseUrl=http://hyperswitch-server:8080 - - sdkBaseUrl=http://hyperswitch-web:9050 + - apiBaseUrl=http://localhost:8080 + - sdkBaseUrl=http://localhost:9050 depends_on: hyperswitch-server: condition: service_started From 13ed0180eea19fb3ab95aca464b3ae7628eea9c4 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Thu, 28 Mar 2024 00:15:43 +0530 Subject: [PATCH 08/14] Update URLs in docker-compose.yml and modify CMD in web.Dockerfile --- docker-compose.yml | 4 ++-- docker/web.Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0020431dec97..1bfe834dedeb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -139,8 +139,8 @@ services: - HYPERSWITCH_PUBLISHABLE_KEY=$HYPERSWITCH_PUBLISHABLE_KEY - HYPERSWITCH_SECRET_KEY=$HYPERSWITCH_SECRET_KEY - HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080} - - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://hyperswitch-web:9050} - - SELF_SERVER_URL=${SELF_SERVER_URL:-http://hyperswitch-web:5252} + - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050} + - SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252} depends_on: hyperswitch-server: condition: service_started diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index b48468c68771..2e1d88deb818 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -15,4 +15,4 @@ EXPOSE 9050 EXPOSE 5252 EXPOSE 9060 -CMD concurrently "npm run start:dev" "npm run start:playground" \ No newline at end of file +CMD concurrently "npm run re:start" "npm run start" "npm run start:playground" \ No newline at end of file From dd1d576eed0cadb3fa3edb69a95c860597c83b22 Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 24 Apr 2024 14:47:15 +0530 Subject: [PATCH 09/14] addressed review comments by @lsampras --- docker-compose.yml | 8 +++++--- docker/web.Dockerfile | 5 +---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1bfe834dedeb..a03e4bf413f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -144,14 +144,14 @@ services: depends_on: hyperswitch-server: condition: service_started + labels: + logs: "promtail" ### Control Center hyperswitch-control-center: - image: juspaydotin/hyperswitch-control-center + image: juspaydotin/hyperswitch-control-center:latest ports: - "9000:9000" - networks: - - router_net environment: - apiBaseUrl=http://localhost:8080 - sdkBaseUrl=http://localhost:9050 @@ -160,6 +160,8 @@ services: condition: service_started hyperswitch-web: condition: service_started + labels: + logs: "promtail" ### Clustered Redis setup redis-cluster: diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 2e1d88deb818..266b8718e239 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -6,13 +6,10 @@ WORKDIR /hyperswitch-web RUN git clone https://github.com/juspay/hyperswitch-web . -RUN sed -i '/hot: true,/a \ host: "0.0.0.0",' webpack.dev.js -RUN sed -i '/hot: true,/a \ host: "0.0.0.0",' Hyperswitch-React-Demo-App/webpack.dev.js - RUN npm install EXPOSE 9050 EXPOSE 5252 EXPOSE 9060 -CMD concurrently "npm run re:start" "npm run start" "npm run start:playground" \ No newline at end of file +CMD concurrently "npm run re:build" "npm run start" "npm run start:playground" \ No newline at end of file From 542b115656c13ac52e067c9bdf1e7b8024d13beb Mon Sep 17 00:00:00 2001 From: prasad89 Date: Wed, 24 Apr 2024 14:48:49 +0530 Subject: [PATCH 10/14] Remove unused network configuration in docker-compose.yml --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a03e4bf413f8..40e98d87e3e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,8 +131,6 @@ services: build: context: ./docker dockerfile: web.Dockerfile - networks: - - router_net env_file: - ./.env environment: From ce5ca8783b2daff14f0ac33996b8f77f72e67d2a Mon Sep 17 00:00:00 2001 From: prasad89 Date: Fri, 26 Apr 2024 20:06:44 +0530 Subject: [PATCH 11/14] Update SDK base URL in docker-compose.yml --- docker-compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 40e98d87e3e7..e526357305a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -131,8 +131,6 @@ services: build: context: ./docker dockerfile: web.Dockerfile - env_file: - - ./.env environment: - HYPERSWITCH_PUBLISHABLE_KEY=$HYPERSWITCH_PUBLISHABLE_KEY - HYPERSWITCH_SECRET_KEY=$HYPERSWITCH_SECRET_KEY @@ -152,7 +150,7 @@ services: - "9000:9000" environment: - apiBaseUrl=http://localhost:8080 - - sdkBaseUrl=http://localhost:9050 + - sdkBaseUrl=http://localhost:9050/HyperLoader.js depends_on: hyperswitch-server: condition: service_started From 61573ac1545c9ebccaaf49284e47696417d51f1e Mon Sep 17 00:00:00 2001 From: prasad89 Date: Mon, 29 Apr 2024 21:11:55 +0530 Subject: [PATCH 12/14] Update URLs and environment variables in docker-compose.yml and web.Dockerfile --- docker-compose.yml | 12 ++++-------- docker/web.Dockerfile | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e526357305a1..7d024acdec26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -137,9 +137,10 @@ services: - HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080} - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050} - SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252} - depends_on: - hyperswitch-server: - condition: service_started + - SDK_ENV=${SDK_ENV:-local} + - ENV_SDK_URL=${ENV_SDK_URL:-http://localhost:9050/HyperLoader.js} + - ENV_BACKEND_URL=${ENV_BACKEND_URL:-http://localhost:8080} + - ENV_LOGGING_URL=${ENV_LOGGING_URL:-http://localhost:3100} labels: logs: "promtail" @@ -151,11 +152,6 @@ services: environment: - apiBaseUrl=http://localhost:8080 - sdkBaseUrl=http://localhost:9050/HyperLoader.js - depends_on: - hyperswitch-server: - condition: service_started - hyperswitch-web: - condition: service_started labels: logs: "promtail" diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 266b8718e239..440c37fbdc29 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -4,7 +4,7 @@ RUN npm install concurrently -g WORKDIR /hyperswitch-web -RUN git clone https://github.com/juspay/hyperswitch-web . +RUN git clone https://github.com/juspay/hyperswitch-web . --depth 1 RUN npm install @@ -12,4 +12,4 @@ EXPOSE 9050 EXPOSE 5252 EXPOSE 9060 -CMD concurrently "npm run re:build" "npm run start" "npm run start:playground" \ No newline at end of file +CMD concurrently "npm run re:build && npm run start" "npm run start:playground" \ No newline at end of file From 42c834616e299ac1e70e29dc50819ca7ed8d67ff Mon Sep 17 00:00:00 2001 From: prasad89 Date: Mon, 29 Apr 2024 22:12:05 +0530 Subject: [PATCH 13/14] minor changes --- docker-compose.yml | 4 ---- docker/web.Dockerfile | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7d024acdec26..1ee796ac1edc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -137,10 +137,6 @@ services: - HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080} - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050} - SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252} - - SDK_ENV=${SDK_ENV:-local} - - ENV_SDK_URL=${ENV_SDK_URL:-http://localhost:9050/HyperLoader.js} - - ENV_BACKEND_URL=${ENV_BACKEND_URL:-http://localhost:8080} - - ENV_LOGGING_URL=${ENV_LOGGING_URL:-http://localhost:3100} labels: logs: "promtail" diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 440c37fbdc29..532ce28fb7c3 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -4,7 +4,7 @@ RUN npm install concurrently -g WORKDIR /hyperswitch-web -RUN git clone https://github.com/juspay/hyperswitch-web . --depth 1 +RUN git clone https://github.com/juspay/hyperswitch-web --depth 1 . RUN npm install From 7a552e59fd4900955072c9229d26d0063e73db2f Mon Sep 17 00:00:00 2001 From: prasad89 Date: Tue, 30 Apr 2024 23:14:07 +0530 Subject: [PATCH 14/14] Updatevenvironment variables in docker-compose.yml --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1ee796ac1edc..32a7a6ef2f83 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -137,6 +137,10 @@ services: - HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080} - HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050} - SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252} + - SDK_ENV=${SDK_ENV:-local} + - ENV_SDK_URL=${ENV_SDK_URL:-http://localhost:9050} + - ENV_BACKEND_URL=${ENV_BACKEND_URL:-http://localhost:8080} + - ENV_LOGGING_URL=${ENV_LOGGING_URL:-http://localhost:3100} labels: logs: "promtail"