From e837a61ecf02ec1c59d0dec08888c5a2d82f6f7c Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Fri, 4 Jul 2025 13:49:16 -0400 Subject: [PATCH] first commit --- analytics/.env | 0 analytics/docker-compose.yml | 0 helpers/.env | 0 helpers/docker-compose.yml | 0 product/.env.core | 28 +++++++++++++++++++ product/.env.event | 21 +++++++++++++++ product/docker-compose.yml | 31 +++++++++++++++++++++ release.sh | 52 ++++++++++++++++++++++++++++++++++++ 8 files changed, 132 insertions(+) create mode 100644 analytics/.env create mode 100644 analytics/docker-compose.yml create mode 100644 helpers/.env create mode 100644 helpers/docker-compose.yml create mode 100644 product/.env.core create mode 100644 product/.env.event create mode 100644 product/docker-compose.yml create mode 100644 release.sh diff --git a/analytics/.env b/analytics/.env new file mode 100644 index 0000000..e69de29 diff --git a/analytics/docker-compose.yml b/analytics/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/helpers/.env b/helpers/.env new file mode 100644 index 0000000..e69de29 diff --git a/helpers/docker-compose.yml b/helpers/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/product/.env.core b/product/.env.core new file mode 100644 index 0000000..63f72ba --- /dev/null +++ b/product/.env.core @@ -0,0 +1,28 @@ + +# Environment Variables +BASIC_AUTH_USERNAME=user +BASIC_AUTH_PASSWORD=password +SWAGGER_URL="/documentation" +API_URL="/swagger.json" + + +SWAGGER_URL="/documentation" +API_URL="/swagger.json" + +DATABASE_USER=firstadvance +DATABASE_PASSWORD=FirstAdvance! +DATABASE_HOST=dev-data.simbrellang.net +DATABASE_PORT=10532 +DATABASE_NAME=firstadvancedev + +KAFKA_BROKER = 'WHAT_IS_IP_KAFKA:9085' + +# Flask Configuration +FLASK_APP=wsgi.py +FLASK_ENV=development +APP_PORT=4500 + + +SIMBRELLA_BASE_URL="https://bank-emulator.dev.simbrellang.net" +SIMBRELLA_APP_ID="app1" +SIMBRELLA_API_KEY="testtest-api-key-12345" diff --git a/product/.env.event b/product/.env.event new file mode 100644 index 0000000..751b7d1 --- /dev/null +++ b/product/.env.event @@ -0,0 +1,21 @@ + +APP_PORT=5000 + +KAFKA_TIMEOUT=1000.0 +KAFKA_BROKER="10.20.30.50:9092" +KAFKA_TOPICS="PROCESS_PAYMENT,LOAN_REPAYMENT" + + +DATABASE_USER=firstadvance +DATABASE_PASSWORD=FirstAdvance! +DATABASE_HOST=10.20.30.60 +DATABASE_PORT=5432 +DATABASE_NAME=firstadvancedev + +BANK_CALL_APP_ID="app1" +BANK_CALL_API_KEY="testtest-api-key-12345" + + +BANK_CALL_DISBURSE_LOAN_ENDPOINT="/api/DisburseLoan" +BANK_CALL_COLLECT_LOAN_ENDPOINT="/api/CollectLoan" +BANK_CALL_TRANSACTION_VERIFY="/api/TransactionVerify" diff --git a/product/docker-compose.yml b/product/docker-compose.yml new file mode 100644 index 0000000..de06d99 --- /dev/null +++ b/product/docker-compose.yml @@ -0,0 +1,31 @@ +services: + digifi-core: + image: "image: registry.simbrellang.net/digifi/banktoproductcore:latest" + build: . + env_file: + - .env.core + ports: + - "${APP_PORT:-4500}:5000" + environment: + - FLASK_APP=${FLASK_APP} + - FLASK_ENV=${FLASK_ENV} + - DATABASE_URL=postgresql+psycopg2://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME} + volumes: + - .:/app + restart: always + + digifi-event: + image: "image: registry.simbrellang.net/digifi/eventmanager:latest" + build: . + env_file: + - .env.event + ports: + - "${APP_PORT:-5000}:5000" + environment: + - FLASK_APP=${FLASK_APP} + - FLASK_ENV=${FLASK_ENV} + volumes: + - .:/app + restart: always + + \ No newline at end of file diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..721e143 --- /dev/null +++ b/release.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +log() { + local message="$1" + echo -e "\033[32mLog: $message\033[0m" +} + +handle_error() { + local error_message="$1" + echo -e "\033[31mError: $error_message\033[0m" + exit 1 +} + +retry() { + local max_attempts=5 + local attempt=1 + local delay=1 + + while true; do + "$@" && break || { + if [ $attempt -lt $max_attempts ]; then + log "Command failed (attempt $attempt/$max_attempts). Retrying in $delay seconds..." + sleep $delay + delay=$((delay * 2)) + ((attempt++)) + else + handle_error "Command failed after $attempt attempts: $*" + fi + } + done +} + + +################################################################################ +# MAIN +################################################################################ +if [ "$1" == "product" ]; then + start_services + cd ../product || handle_error "Failed to enter 'product' directory" + log "Start client in dev mode" + retry docker compose up -d --build + +elif [ "$1" == "helper" ]; then + start_services + cd ../client || handle_error "Failed to enter 'client' directory" + log "Start client in test mode" + npm run start:static + +else + handle_error "Invalid argument. Use 'dev' or 'test'." +fi +