From 81f969f4fab93f5f45097f2438eba4ba93b2ba18 Mon Sep 17 00:00:00 2001 From: ameersohel45 Date: Mon, 15 Sep 2025 11:29:56 +0530 Subject: [PATCH] Add beckn_onix.sh, docker-compose, and local config files for setup --- config/local-dev.yaml | 149 ++++++++++++++++++ config/local-routing.yaml | 34 +++++ config/local-simple-routing-BAPCaller.yaml | 22 +++ config/local-simple-routing-BPPReceiver.yaml | 24 +++ config/local-simple-routing.yaml | 22 +++ config/local-simple.yaml | 151 +++++++++++++++++++ install/beckn-onix.sh | 10 +- install/docker-compose-adapter2.yml | 29 ++++ install/scripts/variables.sh | 7 +- install/uninstall.sh | 1 + 10 files changed, 444 insertions(+), 5 deletions(-) create mode 100644 config/local-dev.yaml create mode 100644 config/local-routing.yaml create mode 100644 config/local-simple-routing-BAPCaller.yaml create mode 100644 config/local-simple-routing-BPPReceiver.yaml create mode 100644 config/local-simple-routing.yaml create mode 100644 config/local-simple.yaml create mode 100644 install/docker-compose-adapter2.yml diff --git a/config/local-dev.yaml b/config/local-dev.yaml new file mode 100644 index 0000000..0520f90 --- /dev/null +++ b/config/local-dev.yaml @@ -0,0 +1,149 @@ +appName: "onix-local" +log: + level: debug + destinations: + - type: stdout + contextKeys: + - transaction_id + - message_id + - subscriber_id + - module_id +http: + port: 8081 + timeout: + read: 30 + write: 30 + idle: 30 +pluginManager: + root: ./plugins +modules: + - name: bapTxnReceiver + path: /bap/receiver/ + handler: + type: std + role: bap + registryUrl: http://localhost:8080/reg + plugins: + keyManager: + id: keymanager + config: + projectID: beckn-onix-local + vaultAddr: http://localhost:8200 + kvVersion: v2 + mountPath: beckn + cache: + id: cache + config: + addr: localhost:6379 + schemaValidator: + id: schemavalidator + config: + schemaDir: ./schemas + signValidator: + id: signvalidator + router: + id: router + config: + routingConfig: ./config/local-routing.yaml + middleware: + - id: reqpreprocessor + config: + uuidKeys: transaction_id,message_id + role: bap + steps: + - addRoute + - validateSchema + + - name: bapTxnCaller + path: /bap/caller/ + handler: + type: std + role: bap + registryUrl: http://localhost:8080/reg + plugins: + keyManager: + id: keymanager + config: + projectID: beckn-onix-local + vaultAddr: http://localhost:8200 + kvVersion: v2 + mountPath: beckn + cache: + id: cache + config: + addr: localhost:6379 + router: + id: router + config: + routingConfig: ./config/local-routing.yaml + signer: + id: signer + middleware: + - id: reqpreprocessor + config: + uuidKeys: transaction_id,message_id + role: bap + steps: + - addRoute + - sign + + - name: bppTxnReceiver + path: /bpp/receiver/ + handler: + type: std + role: bpp + registryUrl: http://localhost:8080/reg + plugins: + keyManager: + id: keymanager + config: + projectID: beckn-onix-local + vaultAddr: http://localhost:8200 + kvVersion: v2 + mountPath: beckn + cache: + id: cache + config: + addr: localhost:6379 + schemaValidator: + id: schemavalidator + config: + schemaDir: ./schemas + signValidator: + id: signvalidator + router: + id: router + config: + routingConfig: ./config/local-routing.yaml + steps: + - validateSign + - addRoute + - validateSchema + + - name: bppTxnCaller + path: /bpp/caller/ + handler: + type: std + role: bpp + registryUrl: http://localhost:8080/reg + plugins: + keyManager: + id: keymanager + config: + projectID: beckn-onix-local + vaultAddr: http://localhost:8200 + kvVersion: v2 + mountPath: beckn + cache: + id: cache + config: + addr: localhost:6379 + router: + id: router + config: + routingConfig: ./config/local-routing.yaml + signer: + id: signer + steps: + - addRoute + - sign diff --git a/config/local-routing.yaml b/config/local-routing.yaml new file mode 100644 index 0000000..6755172 --- /dev/null +++ b/config/local-routing.yaml @@ -0,0 +1,34 @@ +routingRules: + - domain: "nic2004:60221" # Mobility domain + version: "0.9.4" + targetType: "url" + target: + url: "http://localhost:9001/beckn" + endpoints: + - search + - select + - init + - confirm + - status + - track + - cancel + - update + - rating + - support + + - domain: "nic2004:52110" # Retail domain + version: "1.0.0" + targetType: "url" + target: + url: "http://test.bap.com/beckn" + endpoints: + - search + - select + - init + - confirm + - status + - track + - cancel + - update + - rating + - support diff --git a/config/local-simple-routing-BAPCaller.yaml b/config/local-simple-routing-BAPCaller.yaml new file mode 100644 index 0000000..17387a0 --- /dev/null +++ b/config/local-simple-routing-BAPCaller.yaml @@ -0,0 +1,22 @@ +routingRules: + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "bpp" + endpoints: + - select + - init + - confirm + - status + - track + - cancel + - update + - rating + - support + + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "url" + target: + url: "http://gateway:4000" + endpoints: + - search diff --git a/config/local-simple-routing-BPPReceiver.yaml b/config/local-simple-routing-BPPReceiver.yaml new file mode 100644 index 0000000..b19dae2 --- /dev/null +++ b/config/local-simple-routing-BPPReceiver.yaml @@ -0,0 +1,24 @@ +routingRules: + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "url" + target: + url: "http://sandbox-api:3000/retail/1.1.0" + endpoints: + - select + - init + - confirm + - status + - track + - cancel + - update + - rating + - support + + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "url" + target: + url: "http://gateway:4000/" + endpoints: + - search diff --git a/config/local-simple-routing.yaml b/config/local-simple-routing.yaml new file mode 100644 index 0000000..91ee36e --- /dev/null +++ b/config/local-simple-routing.yaml @@ -0,0 +1,22 @@ +routingRules: + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "bpp" + endpoints: + - select + - init + - confirm + - status + - track + - cancel + - update + - rating + - support + + - domain: "retail:1.1.0" # Retail domain + version: "1.1.0" + targetType: "url" + target: + url: "https://172.27.0.3:4000/" + endpoints: + - search diff --git a/config/local-simple.yaml b/config/local-simple.yaml new file mode 100644 index 0000000..c2c3297 --- /dev/null +++ b/config/local-simple.yaml @@ -0,0 +1,151 @@ +appName: "onix-local" +log: + level: debug + destinations: + - type: stdout + contextKeys: + - transaction_id + - message_id + - subscriber_id + - module_id +http: + port: 8081 + timeout: + read: 30 + write: 30 + idle: 30 +pluginManager: + root: ./plugins +modules: + - name: bapTxnReceiver + path: /bap/receiver/ + handler: + type: std + role: bap + registryUrl: http://registry:3030/subscribers + plugins: + keyManager: + id: simplekeymanager + config: + keyId: bap-network + signingPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + signingPublicKey: UX1EDpL4YHOnfkuhrtS+Bz18qwidrX+oJxButD8xaCE= + encrPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + encrPublicKey: UX1EDpL4YHOnfkuhrtS+Bz18qwidrX+oJxButD8xaCE= + cache: + id: cache + config: + addr: localhost:6379 + schemaValidator: + id: schemavalidator + config: + schemaDir: ./schemas + signValidator: + id: signvalidator + router: + id: router + config: + routingConfig: ./config/local-simple-routing.yaml + middleware: + - id: reqpreprocessor + config: + uuidKeys: transaction_id,message_id + role: bap + steps: + - addRoute + - validateSchema + + - name: bapTxnCaller + path: /bap/caller/ + handler: + type: std + role: bap + registryUrl: http://registry:3030/subscribers + plugins: + keyManager: + id: simplekeymanager + config: + keyId: bap-network + signingPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + signingPublicKey: UX1EDpL4YHOnfkuhrtS+Bz18qwidrX+oJxButD8xaCE= + encrPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + encrPublicKey: UX1EDpL4YHOnfkuhrtS+Bz18qwidrX+oJxButD8xaCE= + cache: + id: cache + config: + addr: localhost:6379 + router: + id: router + config: + routingConfig: ./config/local-simple-routing-BAPCaller.yaml + signer: + id: signer + middleware: + - id: reqpreprocessor + config: + uuidKeys: transaction_id,message_id + role: bap + steps: + - addRoute + - sign + + - name: bppTxnReceiver + path: /bpp/receiver/ + handler: + type: std + role: bpp + registryUrl: http://registry:3030/subscribers + plugins: + keyManager: + id: simplekeymanager + config: + keyId: bpp-network + signingPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + signingPublicKey: 8CANv4rto7u6RZEB9b6z6mXIIfBLlExIRLBLd5YYl/Y= + encrPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + encrPublicKey: 8CANv4rto7u6RZEB9b6z6mXIIfBLlExIRLBLd5YYl/Y= + cache: + id: cache + config: + addr: localhost:6379 + schemaValidator: + id: schemavalidator + config: + schemaDir: ./schemas + signValidator: + id: signvalidator + router: + id: router + config: + routingConfig: ./config/local-simple-routing-BPPReceiver.yaml + steps: + - addRoute + + - name: bppTxnCaller + path: /bpp/caller/ + handler: + type: std + role: bpp + registryUrl: http://registry:3030/subscribers + plugins: + keyManager: + id: simplekeymanager + config: + keyId: bap-network + signingPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + signingPublicKey: 8CANv4rto7u6RZEB9b6z6mXIIfBLlExIRLBLd5YYl/Y= + encrPrivateKey: uc5WYG/eke0PVGyQ9JNVLpwQL0K9JIZfHfqUHdLBTaY= + encrPublicKey: 8CANv4rto7u6RZEB9b6z6mXIIfBLlExIRLBLd5YYl/Y= + cache: + id: cache + config: + addr: localhost:6379 + router: + id: router + config: + routingConfig: ./config/local-simple-routing.yaml + signer: + id: signer + steps: + - addRoute + - sign diff --git a/install/beckn-onix.sh b/install/beckn-onix.sh index 4544ded..d2455a1 100755 --- a/install/beckn-onix.sh +++ b/install/beckn-onix.sh @@ -701,6 +701,11 @@ update_network() { esac } +install_adapter() { + start_container $adapter_docker_compose_file "onix-adapter" + sleep 10 + echo "ONIX Adapter installation successful" +} # MAIN SCRIPT STARTS HERE echo "Welcome to Beckn-ONIX!" @@ -723,11 +728,12 @@ if [[ $? -ne 0 ]]; then fi if [[ $choice -eq 3 ]]; then - echo "Installing all components on the local machine" + echo "Installing all components on the local machine" install_registry install_gateway install_bap_protocol_server install_bpp_protocol_server_with_sandbox + install_adapter elif [[ $choice -eq 4 ]]; then echo "Determining the platforms available based on the initial choice" mergingNetworks @@ -762,4 +768,4 @@ else fi fi -echo "Process complete. Thank you for using Beckn-ONIX!" +echo "Process complete. Thank you for using Beckn-ONIX!" \ No newline at end of file diff --git a/install/docker-compose-adapter2.yml b/install/docker-compose-adapter2.yml new file mode 100644 index 0000000..41a9479 --- /dev/null +++ b/install/docker-compose-adapter2.yml @@ -0,0 +1,29 @@ +version: '3.8' + +services: + onix-adapter: + image: onix-adapter + container_name: onix-adapter + platform: linux/amd64 + networks: + - beckn_network + ports: + - "8081:8081" + environment: + CONFIG_FILE: "/app/config/local-simple.yaml" + VAULT_ADDR: http://vault:8200 + VAULT_TOKEN: root + REDIS_ADDR: redis:6379 + RABBITMQ_ADDR: rabbitmq:5672 + RABBITMQ_USER: admin + RABBITMQ_PASS: admin123 + volumes: + - ../config:/app/config + - ../schemas:/app/schemas + command: ["./server", "--config=/app/config/local-simple.yaml"] + #command: ["sh", "-c", "ls -la plugins schemas config"] + +networks: + beckn_network: + name: beckn_network + driver: bridge diff --git a/install/scripts/variables.sh b/install/scripts/variables.sh index 321cff4..3ea8850 100755 --- a/install/scripts/variables.sh +++ b/install/scripts/variables.sh @@ -52,7 +52,7 @@ bap_network_port=5002 bap_subscriber_id="bap-network" bap_subscriber_key_id="bap-network-key" -bap_subscriber_url="http://bap-network:5002" +bap_subscriber_url="http://onix-adapter:8081" bap_client_url="http://bap-client:5002" #BPP varibales. @@ -65,7 +65,7 @@ bpp_network_port=6002 bpp_subscriber_id="bpp-network" bpp_subscriber_key_id="bpp-network-key" -bpp_subscriber_url="http://bpp-network:6002" +bpp_subscriber_url="http://onix-adapter:8081" webhook_url="http://sandbox-api:3000" bpp_docker_compose_file=docker-compose-bpp.yml @@ -73,4 +73,5 @@ bpp_docker_compose_file_sandbox=docker-compose-bpp-with-sandbox.yml bap_docker_compose_file=docker-compose-bap.yml registry_docker_compose_file=docker-compose-registry.yml gateway_docker_compose_file=docker-compose-gateway.yml -gcl_docker_compose_file=docker-compose-gcl.yml \ No newline at end of file +gcl_docker_compose_file=docker-compose-gcl.yml +adapter_docker_compose_file=docker-compose-adapter2.yml \ No newline at end of file diff --git a/install/uninstall.sh b/install/uninstall.sh index a34d8d6..895c02c 100644 --- a/install/uninstall.sh +++ b/install/uninstall.sh @@ -1,3 +1,4 @@ +docker compose -f docker-compose-adapter2.yml down -v docker compose -f docker-compose-bap.yml down -v docker compose -f docker-compose-bpp.yml down -v docker compose -f docker-compose-bpp-with-sandbox.yml down -v