diff --git a/README.md b/README.md index 2c2a083..a24e40f 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ This automated script will: - Start ONIX adapter in Docker - Create environment configuration -**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image ,update docker-compose-adapter2.yaml to use the correct image +**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image if required ,update docker-compose-adapter.yaml to use the correct onix image ```bash # from the repository root diff --git a/SETUP.md b/SETUP.md index aa59ee1..b785333 100644 --- a/SETUP.md +++ b/SETUP.md @@ -113,7 +113,7 @@ This will automatically: - Create BAP Protocol Server registry entries - Create BPP Protocol Server registry entries - Build ONIX adapter plugins -- **Detect config file** from `docker-compose-adapter2.yml` +- **Detect config file** from `docker-compose-adapter.yml` - **Extract keys** from protocol server configs (`bap-client.yml`, `bpp-client.yml`) - **Auto-update simplekeymanager** in the detected config file with extracted keys - Start ONIX Adapter with Redis @@ -133,9 +133,9 @@ docker build -f Dockerfile.adapter-with-plugins -t beckn-onix:latest . ``` **Intelligent Key Management:** -The script reads `docker-compose-adapter2.yml` to detect which config file is being used (default: `local-simple.yaml`), extracts keys from protocol server configs, and automatically updates the `simplekeymanager` section in that config file - no manual configuration needed! +The script reads `docker-compose-adapter.yml` to detect which config file is being used (default: `local-simple.yaml`), extracts keys from protocol server configs, and automatically updates the `simplekeymanager` section in that config file - no manual configuration needed! -**Note:** Update `docker-compose-adapter2.yml` to use the correct config file and correct image: +**Note:** Update `docker-compose-adapter.yml` to use the correct config file and correct image (optional): - For combined setup (simplekeymanager): `CONFIG_FILE: "/app/config/local-simple.yaml"` - For combined setup (keymanager with Vault): `CONFIG_FILE: "/app/config/local-dev.yaml"` - For combined setup (production): `CONFIG_FILE: "/app/config/onix/adapter.yaml"` @@ -315,7 +315,7 @@ The `local-simple.yaml` config uses `simplekeymanager` plugin with embedded keys **With Docker:** ```bash cd install -docker compose -f docker-compose-adapter2.yml up -d +docker compose -f docker-compose-adapter.yml up -d onix-adapter ``` The server will start on `http://localhost:8081` diff --git a/install/beckn-onix.sh b/install/beckn-onix.sh index 04731ac..fd906dd 100755 --- a/install/beckn-onix.sh +++ b/install/beckn-onix.sh @@ -625,18 +625,18 @@ validate_config_modules() { if [[ "$key_type" == "BAP" && $has_bap_modules -eq 0 ]]; then echo "${RED}Error: BAP deployment selected but no BAP modules found in config file${NC}" echo "${BLUE}Config file: $config_file${NC}" - echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with BAP modules${NC}" + echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with BAP modules${NC}" return 1 elif [[ "$key_type" == "BPP" && $has_bpp_modules -eq 0 ]]; then echo "${RED}Error: BPP deployment selected but no BPP modules found in config file${NC}" echo "${BLUE}Config file: $config_file${NC}" - echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with BPP modules${NC}" + echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with BPP modules${NC}" return 1 elif [[ "$key_type" == "BOTH" && ($has_bap_modules -eq 0 || $has_bpp_modules -eq 0) ]]; then echo "${RED}Error: Combined deployment selected but missing modules in config file${NC}" echo "${BLUE}Config file: $config_file${NC}" echo "${BLUE}BAP modules found: $has_bap_modules, BPP modules found: $has_bpp_modules${NC}" - echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with both BAP and BPP modules${NC}" + echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with both BAP and BPP modules${NC}" return 1 fi @@ -656,9 +656,9 @@ configure_onix_registry_keys() { # Determine config file - only auto-detect if not provided if [ -z "$config_file" ]; then - local docker_config=$(grep -o '/app/config/[^"]*' docker-compose-adapter2.yml | head -1) + local docker_config=$(grep -o '/app/config/[^"]*' docker-compose-adapter.yml | head -1) if [ -z "$docker_config" ]; then - echo "${RED}Error: Could not find config file in docker-compose-adapter2.yml${NC}" + echo "${RED}Error: Could not find config file in docker-compose-adapter.yml${NC}" return 1 fi config_file="${docker_config/\/app\/config\//../config/}" @@ -878,6 +878,14 @@ install_adapter() { local key_type=${1:-"BOTH"} local config_file=$2 + # Create schemas directory for validation + if [ ! -d "schemas" ]; then + mkdir -p schemas + echo -e "${GREEN}✓ Created schemas directory${NC}" + else + echo -e "${YELLOW}schemas directory already exists${NC}" + fi + echo "${GREEN}................Building plugins for ONIX Adapter................${NC}" # Build plugins the same way as setup.sh diff --git a/install/docker-compose-adapter.yml b/install/docker-compose-adapter.yml index 3aaa065..b2839dd 100644 --- a/install/docker-compose-adapter.yml +++ b/install/docker-compose-adapter.yml @@ -16,6 +16,27 @@ services: interval: 5s timeout: 3s retries: 5 + + onix-adapter: + image: fidedocker/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"] # Vault - Key Management Service vault: diff --git a/install/docker-compose-adapter2.yml b/install/docker-compose-adapter2.yml deleted file mode 100644 index b93766d..0000000 --- a/install/docker-compose-adapter2.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '3.8' - -services: - onix-adapter: - image: fidedocker/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 3ea8850..e667e03 100755 --- a/install/scripts/variables.sh +++ b/install/scripts/variables.sh @@ -74,4 +74,4 @@ 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 -adapter_docker_compose_file=docker-compose-adapter2.yml \ No newline at end of file +adapter_docker_compose_file=docker-compose-adapter.yml \ No newline at end of file diff --git a/install/setup.sh b/install/setup.sh index e7532b1..fd5737e 100755 --- a/install/setup.sh +++ b/install/setup.sh @@ -148,7 +148,7 @@ fi # Step 5: Start ONIX Adapter echo -e "${YELLOW}Step 5: Starting ONIX Adapter...${NC}" cd install -docker compose -f ./docker-compose-adapter2.yml up -d +docker compose -f ./docker-compose-adapter.yml up -d onix-adapter echo "ONIX Adapter installation successful" cd .. @@ -204,8 +204,8 @@ echo -e "3. Test the endpoints:" echo -e " ${YELLOW}curl -X POST http://localhost:8081/bap/caller/search${NC}" echo "" echo -e "4. Stop all services:" -echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml down && docker compose -f docker-compose-adapter2.yml down${NC}" +echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml down ${NC}" echo "" echo -e "5. View logs:" -echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter2.yml logs -f onix-adapter${NC}" +echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml logs -f onix-adapter${NC}" echo -e "${GREEN}========================================${NC}" \ No newline at end of file