Issue 559 - feat: add Beckn One setup option and update documentation

This commit is contained in:
ameersohel45
2025-11-25 12:16:55 +05:30
parent 56c6f13614
commit 88e6ec279e
12 changed files with 509 additions and 12 deletions

View File

@@ -928,6 +928,58 @@ install_bap_adapter() {
install_bpp_adapter() {
install_adapter "BPP"
}
# Function to install Beckn One Adapter (Option 3)
install_beckn_one_adapter() {
echo "${GREEN}................Setting up network with Beckn One................${NC}"
# Create schemas directory if not exists
if [ ! -d "schemas" ]; then
mkdir -p schemas
echo -e "${GREEN}✓ Created schemas directory${NC}"
fi
echo "${GREEN}................Building plugins for ONIX Adapter................${NC}"
# Build plugins
cd ..
if [ -f "./install/build-plugins.sh" ]; then
chmod +x ./install/build-plugins.sh
./install/build-plugins.sh
if [ $? -eq 0 ]; then
echo "${GREEN}✓ Plugins built successfully${NC}"
else
echo "${RED}Error: Plugin build failed${NC}"
exit 1
fi
else
echo "${RED}Error: install/build-plugins.sh not found${NC}"
exit 1
fi
cd install
echo "${GREEN}................Starting Redis and Beckn One Adapters................${NC}"
# Start Redis first
start_support_services
# Start Beckn One adapters (onix-bap, onix-bpp, sandbox-bap, sandbox-bpp)
start_container $adapter_beckn_one_docker_compose_file "onix-bap"
start_container $adapter_beckn_one_docker_compose_file "onix-bpp"
start_container $adapter_beckn_one_docker_compose_file "sandbox-bap"
start_container $adapter_beckn_one_docker_compose_file "sandbox-bpp"
sleep 10
echo "${GREEN}✓ Beckn One network setup complete${NC}"
echo ""
echo "${BLUE}Services running:${NC}"
echo " - ONIX BAP Adapter: http://localhost:8081"
echo " - ONIX BPP Adapter: http://localhost:8082"
echo " - Sandbox BAP: http://localhost:3001"
echo " - Sandbox BPP: http://localhost:3002"
echo " - Redis: localhost:6379"
}
# MAIN SCRIPT STARTS HERE
echo "Welcome to Beckn-ONIX!"
@@ -941,29 +993,35 @@ echo "Checking prerequisites of Beckn-ONIX deployment"
check_docker_permissions
echo "Beckn-ONIX is a platform that helps you quickly launch and configure beckn-enabled networks."
echo -e "\nWhat would you like to do?\n1. Join an existing network\n2. Create new production network\n3. Set up a network on your local machine\n4. Merge multiple networks\n5. Configure Existing Network\n6. Update/Upgrade Application\n(Press Ctrl+C to exit)"
echo -e "\nWhat would you like to do?\n1. Join an existing network\n2. Create new production network\n3. Set up a network on local machine with Beckn One (DeDI-Registry, Catalog Discovery)\n4. Set up a network on local machine with local registry and gateway (without Beckn One)\n5. Merge multiple networks\n6. Configure Existing Network\n7. Update/Upgrade Application\n(Press Ctrl+C to exit)"
read -p "Enter your choice: " choice
validate_input "$choice" 6
validate_input "$choice" 7
if [[ $? -ne 0 ]]; then
restart_script # Restart the script if input is invalid
fi
if [[ $choice -eq 3 ]]; then
echo "Installing all components on the local machine"
echo "${GREEN}Setting up network with Beckn One${NC}"
echo "${BLUE}This setup uses Beckn One (DeDI-Registry) for registry and catalog discovery${NC}"
echo ""
install_package
install_beckn_one_adapter
elif [[ $choice -eq 4 ]]; then
echo "Installing network with local registry and gateway (without Beckn One)"
install_package
install_registry
install_gateway
install_bap_protocol_server
install_bpp_protocol_server_with_sandbox
install_adapter "BOTH"
elif [[ $choice -eq 4 ]]; then
elif [[ $choice -eq 5 ]]; then
echo "Determining the platforms available based on the initial choice"
mergingNetworks
elif [[ $choice -eq 5 ]]; then
elif [[ $choice -eq 6 ]]; then
echo "${BoldGreen}Currently this feature is not available in this distribution of Beckn ONIX${NC}"
restart_script
elif [[ $choice -eq 6 ]]; then
elif [[ $choice -eq 7 ]]; then
update_network
else
# Determine the platforms available based on the initial choice

View File

@@ -0,0 +1,101 @@
services:
# ============================================
# Core Infrastructure Services
# ============================================
# Redis - Caching Service
redis:
image: redis:alpine
container_name: redis
ports:
- "6379:6379"
networks:
- beckn_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
onix-bap:
image: fidedocker/onix-adapter
container_name: onix-bap
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-beckn-one-bap.yaml"]
onix-bpp:
image: fidedocker/onix-adapter
container_name: onix-bpp
platform: linux/amd64
networks:
- beckn_network
ports:
- "8082:8082"
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-beckn-one-bpp.yaml"]
sandbox-bap:
container_name: sandbox-bap
image: fidedocker/sandbox-2.0:latest
platform: linux/amd64
environment:
- NODE_ENV=production
- PORT=3001
ports:
- "3001:3001"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
networks:
- beckn_network
sandbox-bpp:
container_name: sandbox-bpp
image: fidedocker/sandbox-2.0:latest
platform: linux/amd64
environment:
- NODE_ENV=production
- PORT=3002
ports:
- "3002:3002"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3002/api/health"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
networks:
- beckn_network
networks:
beckn_network:
name: beckn_network
driver: bridge

View File

@@ -74,4 +74,5 @@ 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-adapter.yml
adapter_docker_compose_file=docker-compose-adapter.yml
adapter_beckn_one_docker_compose_file=docker-compose-adapter-beckn-one.yml

View File

@@ -1,4 +1,5 @@
docker compose -f docker-compose-adapter.yml down -v
docker compose -f docker-compose-adapter-beckn-one.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