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

@@ -206,12 +206,18 @@ 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 if required ,update docker-compose-adapter.yaml to use the correct onix image
**Note:**
- **Schema Validation**: Extract schemas before running: `unzip schemas.zip` (required for `schemavalidator` plugin)
- **Alternative**: You can use `schemav2validator` plugin instead, which fetches schemas from a URL and doesn't require local schema extraction. See [CONFIG.md](CONFIG.md) for more configuration details.
- **Optional**: Before running the automated setup, build the adapter image and update `docker-compose-adapter.yaml` to use the correct image
```bash
# from the repository root
docker build -f Dockerfile.adapter-with-plugins -t beckn-onix:latest .
```
**For detailed setup instructions, see [SETUP.md](SETUP.md)**
**Services Started:**
- Redis: localhost:6379
- ONIX Adapter: http://localhost:8081

View File

@@ -88,14 +88,53 @@ This will automatically:
**Key Management:** Uses `simplekeymanager` with embedded keys - no Vault setup required!
**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-adapter.yaml to use the correct image (optional)
**Note:**
- **Schema Validation**: Extract schemas before running: `unzip schemas.zip` (required for `schemavalidator` plugin)
- **Alternative**: You can use `schemav2validator` plugin instead, which fetches schemas from a URL and doesn't require local schema extraction. See [CONFIG.md](CONFIG.md) for more configuration details.
- **Optional**: Before running the automated setup, build the adapter image and update `docker-compose-adapter.yaml` to use the correct image
```bash
# from the repository root
docker build -f Dockerfile.adapter-with-plugins -t beckn-onix:latest .
```
### Option 2: Complete Beckn Network
### Option 2: Beckn One Network Setup
For a local setup using Beckn One with DeDI-Registry and Catalog Discovery:
```bash
cd beckn-onix/install
chmod +x beckn-onix.sh
./beckn-onix.sh
# Choose option 3: "Set up a network on local machine with Beckn One (DeDI-Registry, Catalog Discovery)"
```
This will automatically:
- Install required packages (Docker, docker-compose, jq)
- Build ONIX adapter plugins
- Start Redis
- Start ONIX adapters for BAP and BPP with Beckn One configuration
- Start Sandbox containers for BAP and BPP
**Services Started:**
- Redis: localhost:6379
- ONIX Adapter (BAP): http://localhost:8081
- ONIX Adapter (BPP): http://localhost:8082
- Sandbox BAP: http://localhost:3001
- Sandbox BPP: http://localhost:3002
**Key Features:**
- Uses Beckn One (DeDI-Registry) for registry services
- Pre-configured keys in YAML configuration files
- No local registry or gateway deployment required
**Note:**
- **Schema Validation**: Extract schemas before running: `unzip schemas.zip` (required for `schemavalidator` plugin)
- **Alternative**: You can use `schemav2validator` plugin instead, which fetches schemas from a URL and doesn't require local schema extraction. See [CONFIG.md](CONFIG.md) for more configuration details.
### Option 3: Complete Beckn Network
For a full local Beckn network with all components:
@@ -104,7 +143,8 @@ cd beckn-onix/install
chmod +x beckn-onix.sh
./beckn-onix.sh
# Choose option 3: "Set up a network on your local machine"
# Choose option 4: "Set up a network on local machine with local registry and gateway (without Beckn One)"
```
This will automatically:
@@ -125,7 +165,10 @@ This will automatically:
- ONIX Adapter: http://localhost:8081
- Redis: localhost:6379
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated full-network setup, build the adapter image , update docker-compose-adapter.yaml to use the correct image(optional)
**Note:**
- **Schema Validation**: Extract schemas before running: `unzip schemas.zip` (required for `schemavalidator` plugin)
- **Alternative**: You can use `schemav2validator` plugin instead, which fetches schemas from a URL and doesn't require local schema extraction. See [CONFIG.md](CONFIG.md) for more configuration details.
- **Optional**: Before running the automated full-network setup, build the adapter image and update `docker-compose-adapter.yaml` to use the correct image
```bash
# from the repository root
@@ -193,6 +236,7 @@ This creates `.so` files in the `plugins/` directory:
- `signer.so` - Message signing
- `signvalidator.so` - Signature validation
- `schemavalidator.so` - JSON schema validation
- `schemav2validator.so` - OpenAPI 3.x schema validation
- `keymanager.so` - Vault integration
- `simplekeymanager.so` - Simple key management (no Vault)
- `publisher.so` - RabbitMQ publishing

View File

@@ -0,0 +1,113 @@
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
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: dediregistry
config:
url: http://34.14.173.68:8080/dedi
registryName: subscribers.beckn.one
timeout: 10
keyManager:
id: simplekeymanager
config:
networkParticipant: ev-charging.sandbox1.com
keyId: 76EU7PktCXdPoNEZBjmg4Eb25A2egsd5MYJ67Qxza7bJQFvBHCYxgk
signingPrivateKey: 9NBh67Pk/6v3irrkYZHlQ5E1qw+GivHdDFtKeCylzIM=
signingPublicKey: Z3Hnc8FZDo/7dwWApeRVs6OV560gr7uxPsFUDGUMsBg=
encrPrivateKey: 9NBh67Pk/6v3irrkYZHlQ5E1qw+GivHdDFtKeCylzIM=
encrPublicKey: Z3Hnc8FZDo/7dwWApeRVs6OV560gr7uxPsFUDGUMsBg=
cache:
id: cache
config:
addr: redis:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: ./schemas
signValidator:
id: signvalidator
router:
id: router
config:
routingConfig: ./config/local-beckn-one-routing-BAPReceiver.yaml
middleware:
- id: reqpreprocessor
config:
uuidKeys: transaction_id,message_id
role: bap
steps:
- validateSign
- addRoute
- name: bapTxnCaller
path: /bap/caller/
handler:
type: std
role: bap
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: dediregistry
config:
url: http://34.14.173.68:8080/dedi
registryName: subscribers.beckn.one
timeout: 10
keyManager:
id: simplekeymanager
config:
networkParticipant: ev-charging.sandbox1.com
keyId: 76EU7PktCXdPoNEZBjmg4Eb25A2egsd5MYJ67Qxza7bJQFvBHCYxgk
signingPrivateKey: 9NBh67Pk/6v3irrkYZHlQ5E1qw+GivHdDFtKeCylzIM=
signingPublicKey: Z3Hnc8FZDo/7dwWApeRVs6OV560gr7uxPsFUDGUMsBg=
encrPrivateKey: 9NBh67Pk/6v3irrkYZHlQ5E1qw+GivHdDFtKeCylzIM=
encrPublicKey: Z3Hnc8FZDo/7dwWApeRVs6OV560gr7uxPsFUDGUMsBg=
cache:
id: cache
config:
addr: redis:6379
router:
id: router
config:
routingConfig: ./config/local-beckn-one-routing-BAPCaller.yaml
signer:
id: signer
middleware:
- id: reqpreprocessor
config:
uuidKeys: transaction_id,message_id
role: bap
steps:
- addRoute
- sign

View File

@@ -0,0 +1,107 @@
appName: "onix-local"
log:
level: debug
destinations:
- type: stdout
contextKeys:
- transaction_id
- message_id
- subscriber_id
- module_id
http:
port: 8082
timeout:
read: 30
write: 30
idle: 30
pluginManager:
root: ./plugins
modules:
- name: bppTxnReceiver
path: /bpp/receiver/
handler:
type: std
role: bpp
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: dediregistry
config:
url: http://34.14.173.68:8080/dedi
registryName: subscribers.beckn.one
timeout: 10
keyManager:
id: simplekeymanager
config:
networkParticipant: ev-charging.sandbox2.com
keyId: 76EU7ncBX74BMNTQJMcMYoTMSzU7k71owUF53fN4jdxmosxZrdjdDk
signingPrivateKey: hnMdzvcZBnLJ6W1f4Y2ZCLlJo4phKMvs48ZbXjbS7/k=
signingPublicKey: H1xM/ejGIJpH+DmAF1A9KjBBLJ74pZ8B0gnZ4z4DIkU=
encrPrivateKey: hnMdzvcZBnLJ6W1f4Y2ZCLlJo4phKMvs48ZbXjbS7/k=
encrPublicKey: H1xM/ejGIJpH+DmAF1A9KjBBLJ74pZ8B0gnZ4z4DIkU=
cache:
id: cache
config:
addr: redis:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: ./schemas
signValidator:
id: signvalidator
router:
id: router
config:
routingConfig: ./config/local-beckn-one-routing-BPPReceiver.yaml
steps:
- validateSign
- addRoute
- name: bppTxnCaller
path: /bpp/caller/
handler:
type: std
role: bpp
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: dediregistry
config:
url: http://34.14.173.68:8080/dedi
registryName: subscribers.beckn.one
timeout: 10
keyManager:
id: simplekeymanager
config:
networkParticipant: ev-charging.sandbox2.com
keyId: 76EU7ncBX74BMNTQJMcMYoTMSzU7k71owUF53fN4jdxmosxZrdjdDk
signingPrivateKey: hnMdzvcZBnLJ6W1f4Y2ZCLlJo4phKMvs48ZbXjbS7/k=
signingPublicKey: H1xM/ejGIJpH+DmAF1A9KjBBLJ74pZ8B0gnZ4z4DIkU=
encrPrivateKey: hnMdzvcZBnLJ6W1f4Y2ZCLlJo4phKMvs48ZbXjbS7/k=
encrPublicKey: H1xM/ejGIJpH+DmAF1A9KjBBLJ74pZ8B0gnZ4z4DIkU=
cache:
id: cache
config:
addr: redis:6379
router:
id: router
config:
routingConfig: ./config/local-beckn-one-routing-BPPCaller.yaml
signer:
id: signer
middleware:
- id: reqpreprocessor
config:
uuidKeys: transaction_id,message_id
role: bpp
steps:
- addRoute
- sign

View File

@@ -0,0 +1,22 @@
routingRules:
- domain: "beckn.one:deg:ev-charging:2.0.0" # Retail domain
version: "2.0.0"
targetType: "bpp"
endpoints:
- select
- init
- confirm
- status
- track
- cancel
- update
- rating
- support
- domain: "beckn.one:deg:ev-charging:2.0.0" # Retail domain
version: "2.0.0"
targetType: "url"
target:
url: "https://34.93.141.21.sslip.io/beckn"
endpoints:
- discover

View File

@@ -0,0 +1,14 @@
routingRules:
- domain: "beckn.one:deg:ev-charging:2.0.0"
version: "2.0.0"
targetType: "url"
target:
url: "http://sandbox-bap:3001/api/bap-webhook"
endpoints:
- on_discover
- on_select
- on_init
- on_confirm
- on_status
- on_update
- on_cancel

View File

@@ -0,0 +1,14 @@
routingRules:
- domain: "beckn.one:deg:ev-charging:2.0.0" # Retail domain
version: "2.0.0"
targetType: "bap"
endpoints:
- on_status
- on_cancel
- on_update
- on_select
- on_init
- on_confirm
- on_track
- on_rating
- on_support

View File

@@ -0,0 +1,16 @@
routingRules:
- domain: "beckn.one:deg:ev-charging:2.0.0" # Retail domain
version: "2.0.0"
targetType: "url"
target:
url: "http://sandbox-bpp:3002/api/webhook"
endpoints:
- select
- init
- confirm
- status
- track
- cancel
- update
- rating
- support

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