Initialized empty repo with essential files and folders

This commit is contained in:
Ravi Prakash
2024-12-04 11:55:03 +05:30
parent b542e11071
commit 6691a8f582
255 changed files with 0 additions and 60196 deletions

14
install/.gitignore vendored
View File

@@ -1,14 +0,0 @@
docker_data
gateway_data/config/swf.properties
gateway_data/config/networks/onix.json
registry_data/config/swf.properties
.vscode
gateway_data/config/networks/onix.json
gateway_data/database/standalone.mv.db
protocol-server-data/bap-client.yml
protocol-server-data/bap-network.yml
protocol-server-data/bpp-client.yml
protocol-server-data/bpp-network.yml
ENV/.env-generic-client-layer
registry.*db
gateway.*db

View File

@@ -1,19 +0,0 @@
APP_NAME="Generic Client Layer"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_PORT=3000
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
PS_BASE_URI=BAP_CLIENT_URL
PS_BAP_ID=BAP_SUBSCRIBER_ID
PS_BAP_URI=BAP_SUBSCRIBER_URL
PS_CITY_NAME=Bangalore
PS_CITY_CODE=std:080
PS_COUNTRY_NAME=India
PS_COUNTRY_CODE=IND

View File

@@ -1,2 +0,0 @@
BPPCLIENTURL=http://bpp-client:6001
BASE_URL=http://sandbox-api:3000

View File

@@ -1,2 +0,0 @@
SANDBOXURL=http://sandbox-api:3000
BPPCLIENTURL=http://bpp-client:6001

View File

@@ -1,386 +0,0 @@
#!/bin/bash
source scripts/variables.sh
source scripts/get_container_details.sh
# Function to start a specific service inside docker-compose file
install_package(){
echo "${GREEN}................Installing required packages................${NC}"
bash scripts/package_manager.sh
echo "Package Installation is done"
}
start_container(){
#ignore orphaned containers warning
export COMPOSE_IGNORE_ORPHANS=1
docker compose -f $1 up -d $2
}
update_registry_details() {
if [[ $1 ]];then
if [[ $1 == https://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
registry_url=$(echo "$1" | sed -E 's/https:\/\///')
else
registry_url=$(echo "$1" | sed 's/https:\/\///')
fi
registry_port=443
protocol=https
elif [[ $1 == http://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
registry_url=$(echo "$1" | sed -E 's/http:\/\///')
else
registry_url=$(echo "$1" | sed 's/http:\/\///')
fi
registry_port=80
protocol=http
fi
else
registry_url=registry
registry_port=3030
protocol=http
fi
echo $registry_url
cp $SCRIPT_DIR/../registry_data/config/swf.properties-sample $SCRIPT_DIR/../registry_data/config/swf.properties
config_file="$SCRIPT_DIR/../registry_data/config/swf.properties"
tmp_file=$(mktemp "tempfile.XXXXXXXXXX")
sed "s|REGISTRY_URL|$registry_url|g; s|REGISTRY_PORT|$registry_port|g; s|PROTOCOL|$protocol|g" "$config_file" > "$tmp_file"
mv "$tmp_file" "$config_file"
docker volume create registry_data_volume
docker volume create registry_database_volume
docker run --rm -v $SCRIPT_DIR/../registry_data/config:/source -v registry_data_volume:/target busybox cp /source/{envvars,logger.properties,swf.properties} /target/
docker rmi busybox
}
# Function to start the MongoDB, Redis, and RabbitMQ Services
start_support_services(){
#ignore orphaned containers warning
export COMPOSE_IGNORE_ORPHANS=1
echo "${GREEN}................Installing MongoDB................${NC}"
docker compose -f docker-compose-app.yml up -d mongo_db
echo "MongoDB installation successful"
echo "${GREEN}................Installing RabbitMQ................${NC}"
docker compose -f docker-compose-app.yml up -d queue_service
echo "RabbitMQ installation successful"
echo "${GREEN}................Installing Redis................${NC}"
docker compose -f docker-compose-app.yml up -d redis_db
echo "Redis installation successful"
}
install_gateway() {
if [[ $1 && $2 ]]; then
bash scripts/update_gateway_details.sh $1 $2
else
bash scripts/update_gateway_details.sh http://registry:3030
fi
echo "${GREEN}................Installing Gateway service................${NC}"
start_container $gateway_docker_compose_file gateway
echo "Registering Gateway in the registry"
sleep 10
# if [[ $1 && $2 ]]; then
# bash scripts/register_gateway.sh $2
# else
# bash scripts/register_gateway.sh
# fi
echo " "
echo "Gateway installation successful"
}
# Function to install Beckn Gateway and Beckn Registry
install_registry(){
if [[ $1 ]]; then
update_registry_details $1
else
update_registry_details
fi
echo "${GREEN}................Installing Registry service................${NC}"
start_container $registry_docker_compose_file registry
sleep 10
echo "Registry installation successful"
}
# Function to install BAP Protocol Server
install_bap_protocol_server(){
start_support_services
if [[ $1 ]];then
registry_url=$1
bap_subscriber_id=$2
bap_subscriber_key_id=$3
bap_subscriber_url=$4
bash scripts/update_bap_config.sh $registry_url $bap_subscriber_id $bap_subscriber_key_id $bap_subscriber_url
else
bash scripts/update_bap_config.sh
fi
sleep 10
docker volume create bap_client_config_volume
docker volume create bap_network_config_volume
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bap_client_config_volume:/target busybox cp /source/bap-client.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bap_client_config_volume:/target busybox cp /source/bap-client.yaml-sample /target
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bap_network_config_volume:/target busybox cp /source/bap-network.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bap_network_config_volume:/target busybox cp /source/bap-network.yaml-sample /target
docker rmi busybox
start_container $bap_docker_compose_file "bap-client"
start_container $bap_docker_compose_file "bap-network"
sleep 10
echo "Protocol server BAP installation successful"
}
# Function to install BPP Protocol Server without Sandbox
install_bpp_protocol_server(){
start_support_services
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
if [[ $1 ]];then
registry_url=$1
bpp_subscriber_id=$2
bpp_subscriber_key_id=$3
bpp_subscriber_url=$4
webhook_url=$5
bash scripts/update_bpp_config.sh $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
else
bash scripts/update_bpp_config.sh
fi
sleep 10
docker volume create bpp_client_config_volume
docker volume create bpp_network_config_volume
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_client_config_volume:/target busybox cp /source/bpp-client.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_client_config_volume:/target busybox cp /source/bpp-client.yaml-sample /target
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_network_config_volume:/target busybox cp /source/bpp-network.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_network_config_volume:/target busybox cp /source/bpp-network.yaml-sample /target
docker rmi busybox
start_container $bpp_docker_compose_file "bpp-client"
start_container $bpp_docker_compose_file "bpp-network"
sleep 10
echo "Protocol server BPP installation successful"
}
mergingNetworks(){
echo -e "1. Merge Two Different Registries \n2. Merge Multiple Registries into a Super Registry"
read -p "Enter your choice: " merging_network
urls=()
if [ "$merging_network" = "2" ]; then
while true; do
read -p "Enter registry URL (or 'N' to stop): " url
if [[ $url == 'N' ]]; then
break
else
urls+=("$url")
fi
done
read -p "Enter the Super Registry URL: " registry_super_url
else
read -p "Enter A registry URL: " registry_a_url
read -p "Enter B registry URL: " registry_b_url
urls+=("$registry_a_url")
fi
if [[ ${#urls[@]} -gt 0 ]]; then
echo "Entered registry URLs:"
all_responses=""
for url in "${urls[@]}"; do
response=$(curl -s -H 'ACCEPT: application/json' -H 'CONTENT-TYPE: application/json' "$url"+/subscribers/lookup -d '{}')
all_responses+="$response"
done
for element in $(echo "$all_responses" | jq -c '.[]'); do
if [ "$merging_network" -eq 1 ]; then
curl --location "$registry_b_url"+/subscribers/register \
--header 'Content-Type: application/json' \
--data "$element"
echo
else
curl --location "$registry_super_url"+/subscribers/register \
--header 'Content-Type: application/json' \
--data "$element"
echo
fi
done
echo "Merging Multiple Registries into a Super Registry Done ..."
else
echo "No registry URLs entered."
fi
if [ "$merging_network" = "2" ]; then
echo "Merging Multiple Registries into a Super Registry"
else
echo "Invalid option. Please restart the script and select a valid option."
exit 1
fi
}
# Function to install BPP Protocol Server with Sandbox
install_bpp_protocol_server_with_sandbox(){
start_support_services
docker volume create bpp_client_config_volume
docker volume create bpp_network_config_volume
echo "${GREEN}................Installing Sandbox................${NC}"
start_container $bpp_docker_compose_file_sandbox "sandbox-api"
sleep 5
echo "Sandbox installation successful"
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
if [[ $1 ]];then
registry_url=$1
bpp_subscriber_id=$2
bpp_subscriber_key_id=$3
bpp_subscriber_url=$4
webhook_url=$5
bash scripts/update_bpp_config.sh $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
else
bash scripts/update_bpp_config.sh
fi
sleep 10
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_client_config_volume:/target busybox cp /source/bpp-client.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_client_config_volume:/target busybox cp /source/bpp-client.yaml-sample /target
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_network_config_volume:/target busybox cp /source/bpp-network.yml /target/default.yml
docker run --rm -v $SCRIPT_DIR/../protocol-server-data:/source -v bpp_network_config_volume:/target busybox cp /source/bpp-network.yaml-sample /target
docker rmi busybox
start_container $bpp_docker_compose_file "bpp-client"
start_container $bpp_docker_compose_file "bpp-network"
sleep 10
echo "Protocol server BPP installation successful"
}
# Function to handle the setup process for each platform
completeSetup() {
platform=$1
public_address="https://<your public IP address>"
echo "Proceeding with the setup for $platform..."
# Insert the specific commands for each platform, including requesting network config if necessary
case $platform in
"Registry")
read -p "Enter publicly accessible registry URL: " registry_url
if [[ $registry_url =~ /$ ]]; then
new_registry_url=${registry_url%/}
else
new_registry_url=$registry_url
fi
public_address=$registry_url
install_package
install_registry $new_registry_url
;;
"Gateway"|"Beckn Gateway")
read -p "Enter your registry URL: " registry_url
read -p "Enter publicly accessible gateway URL: " gateway_url
if [[ $registry_url =~ /$ ]]; then
new_registry_url=${registry_url%/}
else
new_registry_url=$registry_url
fi
if [[ $gateway_url =~ /$ ]]; then
gateway_url=${gateway_url%/}
fi
public_address=$gateway_url
install_package
install_gateway $new_registry_url $gateway_url
;;
"BAP")
echo "${GREEN}................Installing Protocol Server for BAP................${NC}"
read -p "Enter BAP Subscriber ID: " bap_subscriber_id
read -p "Enter BAP Subscriber URL: " bap_subscriber_url
read -p "Enter the registry_url(e.g. https://registry.becknprotocol.io/subscribers): " registry_url
bap_subscriber_key_id=$bap_subscriber_id-key
public_address=$bap_subscriber_url
install_package
install_bap_protocol_server $registry_url $bap_subscriber_id $bap_subscriber_key_id $bap_subscriber_url
;;
"BPP")
echo "${GREEN}................Installing Protocol Server for BAP................${NC}"
read -p "Enter BPP Subscriber ID: " bpp_subscriber_id
read -p "Enter BPP Subscriber URL: " bpp_subscriber_url
read -p "Enter the registry_url(e.g. https://registry.becknprotocol.io/subscribers): " registry_url
read -p "Enter Webhook URL: " webhook_url
bpp_subscriber_key_id=$bpp_subscriber_id-key
public_address=$bpp_subscriber_url
install_package
install_bpp_protocol_server $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
;;
*)
echo "Invalid platform selected."
exit 1
;;
esac
echo "[Installation Logs]"
echo -e "${boldGreen}Your $platform setup is complete.${reset}"
echo -e "${boldGreen}You can access your $platform at $public_address ${reset}"
# Key generation and subscription logic follows here
}
# MAIN SCRIPT STARTS HERE
echo "Welcome to Beckn-ONIX!"
if [ -f ./onix_ascii_art.txt ]; then
cat ./onix_ascii_art.txt
else
echo "[Display Beckn-ONIX ASCII Art]"
fi
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\n(Press Ctrl+C to exit)"
read -p "Enter your choice: " choice
boldGreen="\e[1m\e[92m"
reset="\e[0m"
if [[ $choice -eq 3 ]]; then
echo "Installing all components on the local machine"
install_package
install_registry
install_gateway
install_bap_protocol_server
install_bpp_protocol_server_with_sandbox
elif [[ $choice -eq 4 ]]; then
echo "Determining the platforms available based on the initial choice"
mergingNetworks
else
# Determine the platforms available based on the initial choice
platforms=("Gateway" "BAP" "BPP")
[ "$choice" -eq 2 ] && platforms=("Registry" "${platforms[@]}") # Add Registry for new network setups
echo "Great choice! Get ready."
echo -e "\nWhich platform would you like to set up?"
for i in "${!platforms[@]}"; do
echo "$((i+1)). ${platforms[$i]}"
done
read -p "Enter your choice: " platform_choice
selected_platform="${platforms[$((platform_choice-1))]}"
if [[ -n $selected_platform ]]; then
completeSetup "$selected_platform"
else
echo "Invalid option. Please restart the script and select a valid option."
exit 1
fi
fi
echo "Process complete. Thank you for using Beckn-ONIX!"
echo "Process complete. Thank you for using Beckn-ONIX!"

View File

@@ -1,58 +0,0 @@
services:
mongo_db:
image: mongo
restart: unless-stopped
container_name: mongoDB
volumes:
- beckn_mongo_db:/data/db
- beckn_mongo_config:/data/configdb
networks:
- beckn_network
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=beckn
- MONGO_INITDB_ROOT_PASSWORD=beckn123
- MONGO_INITDB_DATABASE=protocol_server
redis_db:
image: redis:6.2.5-alpine
restart: unless-stopped
container_name: redis
networks:
- beckn_network
ports:
- "6379:6379"
volumes:
- beckn_redis:/data
queue_service:
image: rabbitmq:3.9.11-management-alpine
restart: unless-stopped
container_name: rabbitmq
networks:
- beckn_network
ports:
- "5672:5672"
- "15672:15672"
volumes:
- beckn_rabbitmq:/var/lib/rabbitmq
environment:
AMQP_URL: "amqp://queue_service?connection_attempts=3&retry_delay=5"
RABBITMQ_DEFAULT_USER: beckn
RABBITMQ_DEFAULT_PASS: beckn123
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
beckn_mongo_db:
name: beckn_mongo_db
beckn_mongo_config:
name: beckn_mongo_config
beckn_redis:
name: beckn_redis
beckn_rabbitmq:
name: beckn_rabbitmq

View File

@@ -1,49 +0,0 @@
services:
bap-client:
image: fidedocker/protocol-server
container_name: bap-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 5001:5001
restart: unless-stopped
volumes:
- bap_client_config_volume:/usr/src/app/config
- bap_client_schemas_volume:/usr/src/app/schemas
- bap_client_logs_volume:/usr/src/app/logs
bap-network:
image: fidedocker/protocol-server
container_name: bap-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 5002:5002
restart: unless-stopped
volumes:
- bap_network_config_volume:/usr/src/app/config
- bap_network_schemas_volume:/usr/src/app/schemas
- bap_network_logs_volume:/usr/src/app/logs
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
bap_client_config_volume:
name: bap_client_config_volume
external: true
bap_client_schemas_volume:
name: bap_client_schemas_volume
bap_client_logs_volume:
name: bap_client_logs_volume
bap_network_config_volume:
name: bap_network_config_volume
external: true
bap_network_schemas_volume:
name: bap_network_schemas_volume
bap_network_logs_volume:
name: bap_network_logs_volume

View File

@@ -1,61 +0,0 @@
services:
bpp-client:
image: fidedocker/protocol-server
container_name: bpp-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 6001:6001
restart: unless-stopped
volumes:
- bpp_client_config_volume:/usr/src/app/config
- bpp_client_schemas_volume:/usr/src/app/schemas
- bpp_client_logs_volume:/usr/src/app/logs
bpp-network:
image: fidedocker/protocol-server
container_name: bpp-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 6002:6002
restart: unless-stopped
volumes:
- bpp_network_config_volume:/usr/src/app/config
- bpp_network_schemas_volume:/usr/src/app/schemas
- bpp_network_logs_volume:/usr/src/app/logs
sandbox-api:
image: fidedocker/sandbox-api
container_name: sandbox-api
platform: linux/amd64
networks:
- beckn_network
ports:
- 4010:4000
restart: unless-stopped
volumes:
- ./ENV/.env-sandbox:/usr/src/app/.env
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
bpp_client_config_volume:
name: bpp_client_config_volume
external: true
bpp_client_schemas_volume:
name: bpp_client_schemas_volume
bpp_client_logs_volume:
name: bpp_client_logs_volume
bpp_network_config_volume:
name: bpp_network_config_volume
external: true
bpp_network_schemas_volume:
name: bpp_network_schemas_volume
bpp_network_logs_volume:
name: bpp_network_logs_volume

View File

@@ -1,49 +0,0 @@
services:
bpp-client:
image: fidedocker/protocol-server
container_name: bpp-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 6001:6001
restart: unless-stopped
volumes:
- bpp_client_config_volume:/usr/src/app/config
- bpp_client_schemas_volume:/usr/src/app/schemas
- bpp_client_logs_volume:/usr/src/app/logs
bpp-network:
image: fidedocker/protocol-server
container_name: bpp-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 6002:6002
restart: unless-stopped
volumes:
- bpp_network_config_volume:/usr/src/app/config
- bpp_network_schemas_volume:/usr/src/app/schemas
- bpp_network_logs_volume:/usr/src/app/logs
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
bpp_client_config_volume:
name: bpp_client_config_volume
external: true
bpp_client_schemas_volume:
name: bpp_client_schemas_volume
bpp_client_logs_volume:
name: bpp_client_logs_volume
bpp_network_config_volume:
name: bpp_network_config_volume
external: true
bpp_network_schemas_volume:
name: bpp_network_schemas_volume
bpp_network_logs_volume:
name: bpp_network_logs_volume

View File

@@ -1,30 +0,0 @@
services:
gateway:
image: fidedocker/gateway
container_name: gateway
platform: linux/amd64
networks:
- beckn_network
ports:
- 4000:4000
- 4030:4030
restart: unless-stopped
volumes:
- gateway_data_volume:/gateway/overrideProperties/config
- gateway_database_volume:/gateway/database
- gateway_logs_volume:/gateway/tmp
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
gateway_data_volume:
name: gateway_data_volume
external: true
gateway_database_volume:
name: gateway_database_volume
external: true
gateway_logs_volume:
name: gateway_logs_volume

View File

@@ -1,119 +0,0 @@
services:
registry:
image: fidedocker/registry
container_name: registry
platform: linux/amd64
networks:
- beckn_network
ports:
- 3000:3000
- 3030:3030
restart: unless-stopped
volumes:
- registry_data_volume:/registry/overrideProperties/config
- registry_database_volume:/registry/database
gateway:
image: fidedocker/gateway
container_name: gateway
platform: linux/amd64
networks:
- beckn_network
ports:
- 4000:4000
- 4030:4030
restart: unless-stopped
volumes:
- gateway_data_volume:/gateway/overrideProperties/config
- gateway_database_volume:/gateway/database
bap-client:
image: fidedocker/protocol-server
container_name: bap-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 5001:5001
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-client.yml:/usr/src/app/config/default.yml
bap-network:
image: fidedocker/protocol-server
container_name: bap-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 5002:5002
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-network.yml:/usr/src/app/config/default.yml
sandbox-api:
image: fidedocker/sandbox-api
container_name: sandbox-api
platform: linux/amd64
networks:
- beckn_network
ports:
- 4010:4000
restart: unless-stopped
volumes:
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server
container_name: bpp-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 6001:6001
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-client.yml:/usr/src/app/config/default.yml
bpp-network:
image: fidedocker/protocol-server
container_name: bpp-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 6002:6002
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-network.yml:/usr/src/app/config/default.yml
generic-client-layer:
image: fidedocker/generic-client-layer
container_name: generic-client-layer
platform: linux/amd64
networks:
- beckn_network
ports:
- 3015:3000
restart: unless-stopped
volumes:
- ./ENV/.env-generic-client-layer:/app/.env
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
registry_data_volume:
name: registry_data_volume
external: true
registry_database_volume:
name: registry_database_volume
external: true
gateway_data_volume:
name: gateway_data_volume
external: true
gateway_database_volume:
name: gateway_database_volume
external: true

View File

@@ -1,30 +0,0 @@
services:
registry:
image: fidedocker/registry
container_name: registry
platform: linux/amd64
networks:
- beckn_network
ports:
- 3000:3000
- 3030:3030
restart: unless-stopped
volumes:
- registry_data_volume:/registry/overrideProperties/config
- registry_database_volume:/registry/database
- registry_logs_volume:/registry/tmp
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
registry_data_volume:
name: registry_data_volume
external: true
registry_database_volume:
name: registry_database_volume
external: true
registry_logs_volume:
name: registry_logs_volume

View File

@@ -1,119 +0,0 @@
services:
registry:
image: fidedocker/registry
container_name: registry
platform: linux/amd64
networks:
- beckn_network
ports:
- 3000:3000
- 3030:3030
restart: unless-stopped
volumes:
- registry_data_volume:/registry/overrideProperties/config
- registry_database_volume:/registry/database
gateway:
image: fidedocker/gateway
container_name: gateway
platform: linux/amd64
networks:
- beckn_network
ports:
- 4000:4000
- 4030:4030
restart: unless-stopped
volumes:
- gateway_data_volume:/gateway/overrideProperties/config
- gateway_database_volume:/gateway/database
bap-client:
image: fidedocker/protocol-server
container_name: bap-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 5001:5001
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-client.yml:/usr/src/app/config/default.yml
bap-network:
image: fidedocker/protocol-server
container_name: bap-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 5002:5002
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-network.yml:/usr/src/app/config/default.yml
sandbox-api:
image: fidedocker/sandbox-api
container_name: sandbox-api
platform: linux/amd64
networks:
- beckn_network
ports:
- 4010:4000
restart: unless-stopped
volumes:
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server
container_name: bpp-client
platform: linux/amd64
networks:
- beckn_network
ports:
- 6001:6001
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-client.yml:/usr/src/app/config/default.yml
bpp-network:
image: fidedocker/protocol-server
container_name: bpp-network
platform: linux/amd64
networks:
- beckn_network
ports:
- 6002:6002
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-network.yml:/usr/src/app/config/default.yml
generic-client-layer:
image: fidedocker/generic-client-layer
container_name: generic-client-layer
platform: linux/amd64
networks:
- beckn_network
ports:
- 3015:3000
restart: unless-stopped
volumes:
- ./ENV/.env-generic-client-layer:/app/.env
networks:
beckn_network:
name: beckn_network
driver: bridge
volumes:
registry_data_volume:
name: registry_data_volume
external: true
registry_database_volume:
name: registry_database_volume
external: true
gateway_data_volume:
name: gateway_data_volume
external: true
gateway_database_volume:
name: gateway_database_volume
external: true

View File

@@ -1,103 +0,0 @@
services:
registry:
image: fidedocker/registry
container_name: registry
networks:
- beckn_network
ports:
- 3000:3000
- 3030:3030
restart: unless-stopped
volumes:
- ./registry_data/config/swf.properties:/registry/overrideProperties/config/swf.properties
- ./registry_data/database:/registry/database
gateway:
image: fidedocker/gateway
depends_on:
- registry
container_name: gateway
networks:
- beckn_network
ports:
- 4000:4000
- 4030:4030
restart: unless-stopped
volumes:
- ./gateway_data/config/swf.properties:/gateway/overrideProperties/config/swf.properties
- ./gateway_data/database:/gateway/database
bap-client:
image: fidedocker/protocol-server
depends_on:
- registry
- gateway
container_name: bap-client
networks:
- beckn_network
ports:
- 5001:5001
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-client.yml:/usr/src/app/config/default.yml
bap-network:
image: fidedocker/protocol-server
depends_on:
- registry
- gateway
container_name: bap-network
networks:
- beckn_network
ports:
- 5002:5002
restart: unless-stopped
volumes:
- ./protocol-server-data/bap-network.yml:/usr/src/app/config/default.yml
sandbox-api:
image: fidedocker/sandbox-api
depends_on:
- registry
- gateway
container_name: sandbox-api
networks:
- beckn_network
ports:
- 4010:4000
restart: unless-stopped
volumes:
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server
depends_on:
- registry
- gateway
container_name: bpp-client
networks:
- beckn_network
ports:
- 6001:6001
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-client.yml:/usr/src/app/config/default.yml
bpp-network:
image: fidedocker/protocol-server
depends_on:
- registry
- gateway
container_name: bpp-network
networks:
- beckn_network
ports:
- 6002:6002
restart: unless-stopped
volumes:
- ./protocol-server-data/bpp-network.yml:/usr/src/app/config/default.yml
networks:
beckn_network:
name: beckn_network
driver: bridge

View File

@@ -1,2 +0,0 @@
export dport=4000
export wport=4030

View File

@@ -1,20 +0,0 @@
com.venky.core.log.InfoFileHandler.limit=500000
com.venky.core.log.InfoFileHandler.count=2
com.venky.core.log.InfoFileHandler.formatter=java.util.logging.SimpleFormatter
com.venky.core.log.InfoFileHandler.pattern=tmp/java_info%u.log
com.venky.core.log.InfoFileHandler.level=ALL
com.venky.core.log.WarningFileHandler.limit=500000
com.venky.core.log.WarningFileHandler.count=2
com.venky.core.log.WarningFileHandler.formatter=java.util.logging.SimpleFormatter
com.venky.core.log.WarningFileHandler.pattern=tmp/java_warn%u.log
com.venky.core.log.WarningFileHandler.level=WARNING
handlers=com.venky.core.log.WarningFileHandler com.venky.core.log.InfoFileHandler
logger.useParentHandlers=false
.level=INFO
com.venky.swf.plugins.background.core.level=FINEST
com.venky.swf.db.Database.level=FINEST
#com.venky.core.log.TimerStatistics.level=FINE

View File

@@ -1,11 +0,0 @@
{
"core_version" : "1.1.0",
"registry_id": "registry-dev.becknprotocol.io..LREG",
"search_provider_id" : "gateway-dev.becknprotocol.io",
"self_registration_supported": true,
"subscription_needed_post_registration" : true,
"base_url": "https://registry-dev.becknprotocol.io",
"registry_url" : "https://registry-dev.becknprotocol.io/subscribers",
"extension_package": "in.succinct.beckn.boc",
"wild_card" : ""
}

View File

@@ -1,11 +0,0 @@
{
"core_version" : "1.1.0",
"registry_id": "REGISTRY_ID..LREG",
"search_provider_id" : "GATEWAY_ID",
"self_registration_supported": true,
"subscription_needed_post_registration" : true,
"base_url": "REGISTRY_URL",
"registry_url" : "REGISTRY_URL/subscribers",
"extension_package": "in.succinct.beckn.boc",
"wild_card" : ""
}

View File

@@ -1,43 +0,0 @@
swf.load.complete.config.tables.if.count.less.than=500
swf.user.password.encrypted=false
swf.plugins.background.core.workers.numThreads=1
swf.application.authentication.required=false
swf.encryption.support=false
swf.key.store.directory=./.keystore
swf.key.store.password=venky12
swf.key.entry.succinct.password=succinct12
swf.host=GATEWAY_URL
swf.external.port=GATEWAY_PORT
swf.external.scheme=PROTOCOL
swf.jdbc.driver=org.h2.Driver
swf.jdbc.url=jdbc:h2:./database/standalone;AUTO_SERVER=TRUE;
swf.jdbc.userid=standalone
swf.jdbc.password=standalone
swf.jdbc.validationQuery=values(1)
swf.jdbc.dbschema=PUBLIC
swf.jdbc.dbschema.setonconnection=true
swf.jdbc.set.dbschema.command=set schema public
# These keys are needed if you want to in.succinct.beckn.gateway.subscriber_iduse push notifications.
# you can generate this from https://d3v.one/vapid-key-generator/ or similiar sites.
# you also need to specify the public key in src/main/resources/scripts/application.js
#push.server.private.key=your_private_key
#push.server.public.key=your_public_key
## Beckn Gateway configurations.
beckn.auth.enabled=true
in.succinct.beckn.gateway.subscriber_id=SUBSCRIBER_ID
in.succinct.beckn.gateway.public_key_id=SUBSCRIBER_ID.k1
in.succinct.onet.country.iso.3=IND
in.succinct.onet.country.iso.2=IN
in.succinct.onet.name=onix

View File

@@ -1,11 +0,0 @@
docker_data
gateway_data/config/swf.properties
registry_data/config/swf.properties
.vscode
protocol-server-data/bap-client.yml
protocol-server-data/bap-network.yml
protocol-server-data/bpp-client.yml
protocol-server-data/bpp-network.yml
ENV/.env-generic-client-layer
registry.lock*
gateway.lock*

View File

@@ -1,27 +0,0 @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:;;;;:;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;;::;:::;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;:;;;;:;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@..................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@.........,,::,,.........@@@@@........@@.......@@@@@@@........@.........@@@@@........@@@@@@@
@@@@@@.........,,::;;;;::,.........@@@...................@@@@@........@..........@@@.........@@@@@@@
@@@@@@.......,::;;;:,::;;;::,......@@@....................@@@@........@@..........@.........@@@@@@@@
@@@@@@.....,:;;;::,....,::;;;:,....@@@.....................@@@........@@@..................@@@@@@@@@
@@@@@@.....:;;:,..........,:;;,....@@@.....................@@@........@@@@................@@@@@@@@@@
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@.............@@@@@@@@@@@
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@@..........@@@@@@@@@@@@@
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@............@@@@@@@@@@@@
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@..............@@@@@@@@@@@
@@@@@@.....,;;;:,,......,::;;;,....@@@........@@@@@........@@@........@@@@................@@@@@@@@@@
@@@@@@......,::;;;:,,,::;;;::,.....@@@........@@@@@........@@@........@@@..................@@@@@@@@@
@@@@@@........,,:;;;;;;;::,........@@@........@@@@@........@@@........@@.........@@.........@@@@@@@@
@@@@@@@@.........,,::::,,.........@@@@........@@@@@........@@@........@.........@@@@.........@@@@@@@
@@@@@@@@@@@.........,..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@..............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

View File

@@ -1,138 +0,0 @@
# Mandatory
server:
port: BAP_CLIENT_PORT
# Mandatory.
cache:
host: "REDIS_URL"
port: 6379
ttl: "PT10M"
# Optional. Default is 0.
db: 1
# Optional.
responseCache:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
ttl: "PT10M"
# Mandatory.
# Priority order will be
# 1. Synchronous
# 2. webhook
# 3. pubSub
client:
synchronous:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
#webhook:
# url: "https://beckn.free.beeceptor.com/clientURL"
#messageQueue:
# amqpURL: "amqp://guest:guest@localhost:5672"
# incomingQueue: "protocol-server-incoming"
# outgoingQueue: "protocol-server-outgoing"
# Mandatory.
app:
# Mandatory.
mode: bap
# Two types of gateway mode present.
# client and network.
gateway:
mode: client
inboxQueue: "inbox"
outboxQueue: "outbox"
amqpURL: "amqp://RABBITMQ_USERNAME:RABBITMQ_PASSWORD@RABBITMQ_URL:5672"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl : "PT10S"
get_rating_categories:
ttl : "PT10S"
cancellation:
ttl : "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory.
privateKey: "PRIVATE_KEY"
publicKey: "PUBLIC_KEY"
# Mandatory.
subscriberId: "BAP_SUBSCRIBER_ID"
subscriberUri: "BAP_SUBSCRIBER_URL"
# Mandatory.
registryUrl: REGISTRY_URL
auth: false
uniqueKey: "BAP_SUBSCRIBER_KEY_ID"
# Mandatory.
city: "std:080"
country: "IND"
# Mandatory.
ttl: "PT10M"
# Mandatory.
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: USE_LAYER_2_CONFIG
mandateLayer2Config: MANDATE_LAYER_2_CONFIG

View File

@@ -1,136 +0,0 @@
# Mandatory
server:
port: BAP_NETWORK_PORT
# Mandatory.
cache:
host: "REDIS_URL"
port: 6379
ttl: "PT10M"
# Optional. Default is 0.
db: 1
# Optional.
responseCache:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
ttl: "PT10M"
# Mandatory.
# Priority order will be
# 1. Synchronous
# 2. webhook
# 3. pubSub
client:
synchronous:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
#webhook:
# url: "https://beckn.free.beeceptor.com/clientURL"
#messageQueue:
# amqpURL: "amqp://guest:guest@localhost:5672"
# incomingQueue: "protocol-server-incoming"
# outgoingQueue: "protocol-server-outgoing"
# Mandatory.
app:
# Mandatory.
mode: bap
# Two types of gateway mode present.
# client and network.
gateway:
mode: network
inboxQueue: "inbox"
outboxQueue: "outbox"
amqpURL: "amqp://RABBITMQ_USERNAME:RABBITMQ_PASSWORD@RABBITMQ_URL:5672"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl : "PT10S"
get_rating_categories:
ttl : "PT10S"
cancellation:
ttl : "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory.
privateKey: "PRIVATE_KEY"
publicKey: "PUBLIC_KEY"
# Mandatory.
subscriberId: "BAP_SUBSCRIBER_ID"
subscriberUri: "BAP_SUBSCRIBER_URL"
# Mandatory.
registryUrl: REGISTRY_URL
auth: false
uniqueKey: "BAP_SUBSCRIBER_KEY_ID"
# Mandatory.
city: "std:080"
country: "IND"
# Mandatory.
ttl: "PT10M"
# Mandatory.
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: USE_LAYER_2_CONFIG
mandateLayer2Config: MANDATE_LAYER_2_CONFIG

View File

@@ -1,134 +0,0 @@
# Mandatory
server:
port: BPP_CLIENT_PORT
# Mandatory.
cache:
host: "REDIS_URL"
port: 6379
ttl: "PT10M"
# Optional. Default is 0.
db: 0
# Optional.
responseCache:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
ttl: "PT10M"
# Mandatory.
# Priority order will be
# 1. Synchronous
# 2. webhook
# 3. pubSub
client:
# synchronous:
# mongoURL: "mongodb://tvast:password@mongoDB:27017/ps?authSource=admin"
webhook:
url: "WEBHOOK_URL"
#messageQueue:
# amqpURL: "amqp://guest:guest@localhost:5672"
# incomingQueue: "protocol-server-incoming"
# outgoingQueue: "protocol-server-outgoing"
# Mandatory.
app:
# Mandatory.
mode: bpp
# Two types of gateway mode present.
# client and network.
gateway:
mode: client
inboxQueue: "inbox-bpp"
outboxQueue: "outbox-bpp"
amqpURL: "amqp://RABBITMQ_USERNAME:RABBITMQ_PASSWORD@RABBITMQ_URL:5672"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl: "PT10S"
get_rating_categories:
ttl: "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory.
privateKey: "PRIVATE_KEY"
publicKey: "PUBLIC_KEY"
# Mandatory.
subscriberId: "BPP_SUBSCRIBER_ID"
subscriberUri: "BPP_SUBSCRIBER_URL"
# Mandatory.
registryUrl: REGISTRY_URL
auth: true
uniqueKey: "BPP_SUBSCRIBER_KEY_ID"
# Mandatory.
city: "std:080"
country: "IND"
# Mandatory.
ttl: "PT10M"
# Mandatory.
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: USE_LAYER_2_CONFIG
mandateLayer2Config: MANDATE_LAYER_2_CONFIG

View File

@@ -1,134 +0,0 @@
# Mandatory
server:
port: BPP_NETWORK_PORT
# Mandatory.
cache:
host: "REDIS_URL"
port: 6379
ttl: "PT10M"
# Optional. Default is 0.
db: 0
# Optional.
responseCache:
mongoURL: "mongodb://MONGO_USERNAME:MONGO_PASSWORD@MONOG_URL/MONGO_DB_NAME?authSource=admin"
ttl: "PT10M"
# Mandatory.
# Priority order will be
# 1. Synchronous
# 2. webhook
# 3. pubSub
client:
# synchronous:
# mongoURL: "mongodb://tvast:password@mongoDB:27017/ps?authSource=admin"
webhook:
url: "WEBHOOK_URL"
#messageQueue:
# amqpURL: "amqp://guest:guest@localhost:5672"
# incomingQueue: "protocol-server-incoming"
# outgoingQueue: "protocol-server-outgoing"
# Mandatory.
app:
# Mandatory.
mode: bpp
# Two types of gateway mode present.
# client and network.
gateway:
mode: network
inboxQueue: "inbox-bpp"
outboxQueue: "outbox-bpp"
amqpURL: "amqp://RABBITMQ_USERNAME:RABBITMQ_PASSWORD@RABBITMQ_URL:5672"
# Mandatory.
actions:
requests:
search:
ttl : "PT15S"
init:
ttl : "PT10S"
select:
ttl : "PT10S"
confirm:
ttl : "PT10S"
status:
ttl : "PT10S"
track:
ttl : "PT10S"
cancel:
ttl : "PT10S"
update:
ttl : "PT10S"
rating:
ttl : "PT10S"
support:
ttl : "PT10S"
get_cancellation_reasons:
ttl: "PT10S"
get_rating_categories:
ttl: "PT10S"
responses:
on_search:
ttl: "PT15S"
on_init:
ttl: "PT10S"
on_select:
ttl: "PT10S"
on_confirm:
ttl: "PT10S"
on_status:
ttl: "PT10S"
on_track:
ttl: "PT10S"
on_cancel:
ttl: "PT10S"
on_update:
ttl: "PT10S"
on_rating:
ttl: "PT10S"
on_support:
ttl: "PT10S"
cancellation_reasons:
ttl: "PT10S"
rating_categories:
ttl: "PT10S"
# Mandatory.
privateKey: "PRIVATE_KEY"
publicKey: "PUBLIC_KEY"
# Mandatory.
subscriberId: "BPP_SUBSCRIBER_ID"
subscriberUri: "BPP_SUBSCRIBER_URL"
# Mandatory.
registryUrl: REGISTRY_URL
auth: true
uniqueKey: "BPP_SUBSCRIBER_KEY_ID"
# Mandatory.
city: "std:080"
country: "IND"
# Mandatory.
ttl: "PT10M"
# Mandatory.
httpTimeout: "PT3S"
httpRetryCount: 2
telemetry:
enabled: false
url: ""
batchSize: 100
# In minutes
syncInterval: 30
redis_db: 3
useLayer2Config: USE_LAYER_2_CONFIG
mandateLayer2Config: MANDATE_LAYER_2_CONFIG

View File

@@ -1,2 +0,0 @@
export dport=3000
export wport=3030

View File

@@ -1,20 +0,0 @@
com.venky.core.log.InfoFileHandler.limit=500000
com.venky.core.log.InfoFileHandler.count=2
com.venky.core.log.InfoFileHandler.formatter=java.util.logging.SimpleFormatter
com.venky.core.log.InfoFileHandler.pattern=tmp/java_info%u.log
com.venky.core.log.InfoFileHandler.level=ALL
com.venky.core.log.WarningFileHandler.limit=500000
com.venky.core.log.WarningFileHandler.count=2
com.venky.core.log.WarningFileHandler.formatter=java.util.logging.SimpleFormatter
com.venky.core.log.WarningFileHandler.pattern=tmp/java_warn%u.log
com.venky.core.log.WarningFileHandler.level=WARNING
handlers=com.venky.core.log.WarningFileHandler com.venky.core.log.InfoFileHandler
logger.useParentHandlers=false
.level=INFO
com.venky.swf.plugins.background.core.level=FINEST
com.venky.swf.db.Database.level=FINEST
#com.venky.core.log.TimerStatistics.level=FINE

View File

@@ -1,43 +0,0 @@
swf.load.complete.config.tables.if.count.less.than=500
swf.user.password.encrypted=false
swf.plugins.background.core.workers.numThreads=3
swf.application.authentication.required=false
swf.application.requires.registration=true
#swf.host=localhost
swf.host=REGISTRY_URL
swf.external.port=REGISTRY_PORT
swf.external.scheme=PROTOCOL
swf.jdbc.driver=org.h2.Driver
swf.jdbc.url=jdbc:h2:./database/registry;AUTO_SERVER=TRUE;
swf.jdbc.userid=registry
swf.jdbc.password=registry
swf.jdbc.validationQuery=values(1)
swf.jdbc.dbschema=PUBLIC
swf.jdbc.dbschema.setonconnection=true
swf.jdbc.set.dbschema.command=set schema public
# These keys are needed if you want to use push notifications.
# you can generate this from https://d3v.one/vapid-key-generator/ or similiar sites.
# you also need to specify the public key in src/main/resources/scripts/application.js
#push.server.private.key=your_private_key
#push.server.public.key=your_public_key
swf.api.keys.case=SNAKE
swf.api.root.required=false
# Needed for Google Login
#swf.GOOGLE.client.id=
#swf.GOOGLE.client.secret=
swf.encryption.support=false
## Uncomment below if encryption is needed and set appropriate passwords
#swf.key.store.directory=./.keystore
#swf.key.store.password=venky12
#swf.key.entry.succinct.password=succinct12
swf.ftl.dir=src/main/resources/templates

View File

@@ -1,11 +0,0 @@
docker_data
gateway_data/config/swf.properties
registry_data/config/swf.properties
.vscode
protocol-server-data/bap-client.yml
protocol-server-data/bap-network.yml
protocol-server-data/bpp-client.yml
protocol-server-data/bpp-network.yml
ENV/.env-generic-client-layer
registry.lock*
gateway.lock*

View File

@@ -1,27 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/variables.sh
# Define the text to print in the banner
text="
###### ####### ##### # # # #
# # # # # # # ## #
# # # # # # # # #
###### ##### # ### # # #
# # # # # # # # #
# # # # # # # # ##
###### ####### ##### # # # #
"
text2="
######## ######## ###### ## ## ## ##
## ## ## ## ## ## ## ### ##
## ## ## ## ## ## #### ##
######## ###### ## ##### ## ## ##
## ## ## ## ## ## ## ####
## ## ## ## ## ## ## ## ###
######## ######## ###### ## ## ## ##
"
# Clear the terminal screen
clear
echo "${GREEN}$text2${NC}"

View File

@@ -1,27 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/variables.sh
# Run the script that generates keys and capture the output
get_keys() {
docker pull fidedocker/protocol-server > /dev/null 2>&1
docker run --name temp -itd fidedocker/protocol-server > /dev/null 2>&1
output=$(docker exec -i temp node /usr/src/app/scripts/generate-keys 2>&1)
docker stop temp > /dev/null 2>&1
docker rm temp > /dev/null 2>&1
# Check if the script executed successfully
if [ $? -eq 0 ]; then
# Extract Public Key and Private Key using grep and awk
public_key=$(echo "$output" | awk '/Your Public Key/ {getline; print $0}')
private_key=$(echo "$output" | awk '/Your Private Key/ {getline; print $0}')
# Remove leading and trailing whitespaces
public_key=$(echo "$public_key" | tr -d '[:space:]')
private_key=$(echo "$private_key" | tr -d '[:space:]')
else
# Print an error message if the script failed
echo "${RED}Error: Key generation script failed. Please check the script output.${NC}"
fi
}
#get_keys

View File

@@ -1,21 +0,0 @@
#!/bin/bash
update_env_file(){
cp ../ENV/.env-generic-client-layer-sample ../ENV/.env-generic-client-layer
envFile=../ENV/.env-generic-client-layer
bap_subscriber_id=$1
bap_subscriber_url=$2
bap_client_url=$3
if [[ $(uname) == "Darwin" ]]; then
sed -i '' "s|BAP_SUBSCRIBER_ID|$bap_subscriber_id|" $envFile
sed -i '' "s|BAP_SUBSCRIBER_URL|$bap_subscriber_url|" $envFile
sed -i '' "s|BAP_CLIENT_URL|$bap_client_url|" $envFile
else
sed -i "s|BAP_SUBSCRIBER_ID|$bap_subscriber_id|" $envFile
sed -i "s|BAP_SUBSCRIBER_URL|$bap_subscriber_url|" $envFile
sed -i "s|BAP_CLIENT_URL|$bap_client_url|" $envFile
fi
}
update_env_file $1 $2 $3

View File

@@ -1,8 +0,0 @@
#!/bin/bash
get_container_ip() {
container_name=$1
container_ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $container_name)
echo $container_ip
}
#get_container_ip $1

View File

@@ -1,7 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: swf-config
data:
swf.properties: |
# Content of swf.properties file for registry

View File

@@ -1,59 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: registry-deployment
spec:
replicas: 1
selector:
matchLabels:
app: registry
template:
metadata:
labels:
app: registry
spec:
containers:
- name: registry
image: fidedocker/registry
ports:
- containerPort: 3000
- containerPort: 3030
volumeMounts:
- name: registry-data
mountPath: /registry
volumes:
- name: registry-data
hostPath:
path: /absolute/path/to/registry_data/
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gateway-deployment
spec:
replicas: 1
selector:
matchLabels:
app: gateway
template:
metadata:
labels:
app: gateway
spec:
containers:
- name: gateway
image: fidedocker/gateway
ports:
- containerPort: 4000
- containerPort: 4030
volumeMounts:
- name: gateway-data
mountPath: /gateway
volumes:
- name: gateway-data
hostPath:
path: /path/to/gateway_data
# Repeat the above structure for other services

View File

@@ -1,24 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: beckn-ingress
spec:
rules:
- host: localhost
http:
paths:
- path: /registry
pathType: Prefix
backend:
service:
name: registry-service
port:
number: 3000
- path: /gateway
pathType: Prefix
backend:
service:
name: gateway-service
port:
number: 4000
# Repeat the above structure for other services

View File

@@ -1,33 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: registry-service
spec:
selector:
app: registry
ports:
- protocol: TCP
port: 3000
targetPort: 3000
- protocol: TCP
port: 3030
targetPort: 3030
---
apiVersion: v1
kind: Service
metadata:
name: gateway-service
spec:
selector:
app: gateway
ports:
- protocol: TCP
port: 4000
targetPort: 4000
- protocol: TCP
port: 4030
targetPort: 4030
# Repeat the above structure for other services

View File

@@ -1,172 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/variables.sh
#Required packages list as below.
package_list=("docker" "docker-compose" "jq")
command_exists() {
command -v "$1" &>/dev/null
}
# Redirect input from /dev/null to silence prompts
export DEBIAN_FRONTEND=noninteractive
export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
#Install Package
install_package() {
if [ -x "$(command -v apt-get)" ]; then
# APT (Debian/Ubuntu)
if [ "$1" == "docker" ]; then
if ! docker --version > /dev/null 2>&1; then
if [ -f /etc/debian_version ]; then
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
else
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
fi
sudo apt update >/dev/null 2>&1
sudo apt install -y docker-ce docker-ce-cli containerd.io >/dev/null 2>&1
sudo usermod -aG docker $USER
source ~/.bashrc
sudo systemctl enable docker.service
sudo systemctl restart docker.service
else
echo "Docker is already installed."
fi
else
if ! dpkg -l | grep -q "^ii $1 "; then
sudo apt-get update >/dev/null 2>&1
sudo apt-get install -y $1 >/dev/null 2>&1
else
echo "$1 is already installed."
fi
fi
elif [ -x "$(command -v yum)" ]; then
# YUM (Red Hat/CentOS/Amazon Linux)
if [ "$1" == "docker" ]; then
if ! docker --version > /dev/null 2>&1; then
if [ -f /etc/centos-release ]; then
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
elif [ -f /etc/redhat-release ]; then
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
elif grep -q "Amazon Linux release 2" /etc/system-release; then
sudo amazon-linux-extras install docker -y
elif grep -q "Amazon Linux release" /etc/system-release; then
sudo yum install -y docker
fi
sudo yum install -y docker-ce docker-ce-cli containerd.io >/dev/null 2>&1
sudo usermod -aG docker $USER
source ~/.bashrc
sudo systemctl enable docker.service
sudo systemctl restart docker.service
else
echo "Docker is already installed."
fi
else
if ! rpm -qa | grep -q "^$1-"; then
sudo yum install -y $1 >/dev/null 2>&1
else
echo "$1 is already installed."
fi
fi
elif [ -x "$(command -v amazon-linux-extras)" ]; then
# Amazon Linux 2 specific
if [ "$1" == "docker" ]; then
if ! docker --version > /dev/null 2>&1; then
sudo amazon-linux-extras install docker -y >/dev/null 2>&1
sudo systemctl enable docker.service
sudo systemctl start docker.service
sudo usermod -aG docker $USER
source ~/.bashrc
else
echo "Docker is already installed."
fi
else
if ! amazon-linux-extras list | grep -q "$1"; then
sudo amazon-linux-extras install $1 -y >/dev/null 2>&1
else
echo "$1 is already installed."
fi
fi
else
echo "Unsupported package manager. Please install $1 manually."
exit 1
fi
}
remove_package(){
if [ -x "$(command -v apt-get)" ]; then
# APT (Debian/Ubuntu)
sudo apt-get purge -y $1 >/dev/null 2>&1
sudo apt autoremove -y >/dev/null 2>&1
elif [ -x "$(command -v yum)" ]; then
# YUM (Red Hat/CentOS)
sudo yum remove -y $1 >/dev/null 2>&1
sudo yum autoremove -y >/dev/null 2>&1
fi
}
# Function to install Docker
install_docker_bash() {
# Install Docker Bash completion
echo "Installing Docker Bash completion..."
sudo curl -L https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker -o /etc/bash_completion.d/docker
}
# Function to install Docker Compose
install_docker_compose() {
command_exists docker-compose
if [ $? -eq 0 ]; then
echo "docker-compose is already installed."
return
else
echo "Installing Docker Compose..."
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
fi
# Check if Docker Compose installation was successful
if [ $? -eq 0 ]; then
echo "Docker Compose installed successfully."
else
echo "${RED}Failed to install Docker Compose. Exiting.${NC}"
exit 1
fi
if [ -f /etc/bash_completion.d/docker-compose ]; then
echo "Docker Compose Bash completion is already installed."
else
# Install Docker Compose Bash completion
echo "Installing Docker Compose Bash completion..."
sudo curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
fi
}
# Check if package is already installed
for package in "${package_list[@]}"; do
if ! command_exists $package; then
install_package "$package"
fi
if [ "$package" == "docker" ]; then
if [[ $(uname -s ) == 'Linux' ]];then
if [ -f /etc/bash_completion.d/docker ]; then
echo "Docker Bash completion is already installed."
else
install_docker_bash
fi
fi
fi
if [ "$package" == "docker-compose" ]; then
if [[ $(uname -s ) == 'Linux' ]];then
install_docker_compose
fi
fi
done

View File

@@ -1,32 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/get_container_details.sh
register_gw() {
cookie_file="cookies.txt"
# Step 1: Perform login and save the session cookies to a file
curl --cookie-jar $cookie_file --request POST $login_url
curl --request GET --cookie $cookie_file $subscribe_url
rm -rf $cookie_file
}
if [[ $(uname -s) == 'Darwin' ]]; then
ip=localhost
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
ip=$(hostname -I | awk '{print $1}')
else
ip=$(get_container_ip gateway)
fi
if [[ $1 ]]; then
if [[ $1 == https://* ]]; then
login_url="$1/login?name=root&password=root&_LOGIN=Login"
subscribe_url="$1/bg/subscribe"
register_gw
fi
else
login_url="http://$ip:4030/login?name=root&password=root&_LOGIN=Login"
subscribe_url="http://$ip:4030/bg/subscribe"
register_gw
fi

View File

@@ -1,46 +0,0 @@
#!/bin/bash
source $SCRIPT_DIR/variables.sh
create_network_participant() {
# Set your variables
registry_url="$1"
content_type="$2"
subscriber_id="$3"
pub_key_id="$4"
subscriber_url="$5"
encr_public_key="$6"
signing_public_key="$7"
valid_from="$8"
valid_until="$9"
type="${10}"
json_data=$(cat <<EOF
{
"subscriber_id": "$subscriber_id",
"pub_key_id": "$pub_key_id",
"unique_key_id": "$pub_key_id",
"subscriber_url": "$subscriber_url",
"domain": " ",
"extended_attributes": {"domains": []},
"encr_public_key": "$encr_public_key",
"signing_public_key": "$signing_public_key",
"valid_from": "$valid_from",
"valid_until": "$valid_until",
"type": "$type",
"country": "IND",
"status": "SUBSCRIBED"
}
EOF
)
response=$(curl --location --request POST "$registry_url/register" \
--header "Content-Type: $content_type" \
--data-raw "$json_data" 2>&1)
if [ $? -eq 0 ]; then
echo "${GREEN}Network Participant Entry is created. Please login to registry $registry_url and subscribe you Network Participant.${NC}"
else
echo "${RED}Error: $response${NC}"
fi
}

View File

@@ -1,126 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/registry_entry.sh
source $SCRIPT_DIR/generate_keys.sh
source $SCRIPT_DIR/variables.sh
source $SCRIPT_DIR/get_container_details.sh
newClientFile=$(echo "$bapClientFile" | sed 's/yaml-sample/yml/')
newNetworkFile=$(echo "$bapNetworkFile" | sed 's/yaml-sample/yml/')
cp $bapClientFile $newClientFile
cp $bapNetworkFile $newNetworkFile
clientFile=$newClientFile
networkFile=$newNetworkFile
client_port=$bap_client_port
network_port=$bap_network_port
if [[ $(uname) == "Darwin" ]]; then
sed -i '' "s|BAP_NETWORK_PORT|$network_port|" $networkFile
sed -i '' "s|BAP_CLIENT_PORT|$client_port|" $clientFile
else
sed -i "s|BAP_NETWORK_PORT|$network_port|" $networkFile
sed -i "s|BAP_CLIENT_PORT|$client_port|" $clientFile
fi
if [[ $1 ]]; then
registry_url=$1
bap_subscriber_id=$2
bap_subscriber_key_id=$3
bap_subscriber_url=$4
else
if [[ $(uname -s) == 'Darwin' ]]; then
ip=localhost
registry_url="http://$ip:3030/subscribers"
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
ip=$(hostname -I | awk '{print $1}')
registry_url="http://$ip:3030/subscribers"
else
registry_url="http://$(get_container_ip registry):3030/subscribers"
fi
fi
echo "Generating public/private key pair"
get_keys
echo "Your Private Key: $private_key"
echo "Your Public Key: $public_key"
if [[ $(uname -s ) == 'Darwin' ]];then
valid_from=$(date -u -v-1d +"%Y-%m-%dT%H:%M:%S.%000Z")
valid_until=$(date -u -v+3y +"%Y-%m-%dT%H:%M:%S.%000Z")
else
valid_from=$(date -u -d "-1 day" +"%Y-%m-%dT%H:%M:%S.%3NZ")
valid_until=$(date -u -d "+3 year" +"%Y-%m-%dT%H:%M:%S.%3NZ")
fi
type=BAP
# Define an associative array for replacements
if [[ $(uname -s ) == 'Darwin' ]];then
replacements=(
"REDIS_URL=$redisUrl"
"REGISTRY_URL=$registry_url"
"MONGO_USERNAME=$mongo_initdb_root_username"
"MONGO_PASSWORD=$mongo_initdb_root_password"
"MONGO_DB_NAME=$mongo_initdb_database"
"MONOG_URL=$mongoUrl"
"RABBITMQ_USERNAME=$rabbitmq_default_user"
"RABBITMQ_PASSWORD=$rabbitmq_default_pass"
"RABBITMQ_URL=$rabbitmqUrl"
"PRIVATE_KEY=$private_key"
"PUBLIC_KEY=$public_key"
"BAP_SUBSCRIBER_ID=$bap_subscriber_id"
"BAP_SUBSCRIBER_URL=$bap_subscriber_url"
"BAP_SUBSCRIBER_KEY_ID=$bap_subscriber_key_id"
"USE_LAYER_2_CONFIG"=true
"MANDATE_LAYER_2_CONFIG"=true
)
echo "Configuring BAP protocol server"
# Apply replacements in both files
for file in "$clientFile" "$networkFile"; do
for line in "${replacements[@]}"; do
key=$(echo "$line" | cut -d '=' -f1)
value=$(echo "$line" | cut -d '=' -f2)
sed -i '' "s|$key|$value|" "$file"
done
done
else
declare -A replacements=(
["REDIS_URL"]=$redisUrl
["REGISTRY_URL"]=$registry_url
["MONGO_USERNAME"]=$mongo_initdb_root_username
["MONGO_PASSWORD"]=$mongo_initdb_root_password
["MONGO_DB_NAME"]=$mongo_initdb_database
["MONOG_URL"]=$mongoUrl
["RABBITMQ_USERNAME"]=$rabbitmq_default_user
["RABBITMQ_PASSWORD"]=$rabbitmq_default_pass
["RABBITMQ_URL"]=$rabbitmqUrl
["PRIVATE_KEY"]=$private_key
["PUBLIC_KEY"]=$public_key
["BAP_SUBSCRIBER_ID"]=$bap_subscriber_id
["BAP_SUBSCRIBER_URL"]=$bap_subscriber_url
["BAP_SUBSCRIBER_KEY_ID"]=$bap_subscriber_key_id
["USE_LAYER_2_CONFIG"]=true
["MANDATE_LAYER_2_CONFIG"]=true
)
echo "Configuring BAP protocol server"
# Apply replacements in both files
for file in "$clientFile" "$networkFile"; do
for key in "${!replacements[@]}"; do
sed -i "s|$key|${replacements[$key]}|" "$file"
done
done
fi
echo "Registering BAP protocol server on the registry"
create_network_participant "$registry_url" "application/json" "$bap_subscriber_id" "$bap_subscriber_key_id" "$bap_subscriber_url" "$public_key" "$public_key" "$valid_from" "$valid_until" "$type"

View File

@@ -1,132 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/registry_entry.sh
source $SCRIPT_DIR/generate_keys.sh
source $SCRIPT_DIR/variables.sh
source $SCRIPT_DIR/get_container_details.sh
newClientFile=$(echo "$bppClientFile" | sed 's/yaml-sample/yml/')
newNetworkFile=$(echo "$bppNetworkFile" | sed 's/yaml-sample/yml/')
cp $bppClientFile $newClientFile
cp $bppNetworkFile $newNetworkFile
clientFile=$newClientFile
networkFile=$newNetworkFile
client_port=$bpp_client_port
network_port=$bpp_network_port
if [[ $(uname) == "Darwin" ]]; then
sed -i '' "s|BPP_NETWORK_PORT|$network_port|" $networkFile
sed -i '' "s|BPP_CLIENT_PORT|$client_port|" $clientFile
else
sed -i "s|BPP_NETWORK_PORT|$network_port|" $networkFile
sed -i "s|BPP_CLIENT_PORT|$client_port|" $clientFile
fi
if [[ $1 ]]; then
registry_url=$1
bpp_subscriber_id=$2
bpp_subscriber_key_id=$3
bpp_subscriber_url=$4
webhook_url=$5
else
if [[ $(uname -s) == 'Darwin' ]]; then
ip=localhost
registry_url="http://$ip:3030/subscribers"
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
ip=$(hostname -I | awk '{print $1}')
registry_url="http://$ip:3030/subscribers"
else
registry_url="http://$(get_container_ip registry):3030/subscribers"
fi
fi
echo "Generating public/private key pair"
get_keys
#echo "Your Private Key: $private_key"
#echo "Your Public Key: $public_key"
if [[ $(uname -s ) == 'Darwin' ]];then
valid_from=$(date -u -v-1d +"%Y-%m-%dT%H:%M:%S.%000Z")
valid_until=$(date -u -v+3y +"%Y-%m-%dT%H:%M:%S.%000Z")
else
valid_from=$(date -u -d "-1 day" +"%Y-%m-%dT%H:%M:%S.%3NZ")
valid_until=$(date -u -d "+3 year" +"%Y-%m-%dT%H:%M:%S.%3NZ")
fi
type=BPP
# Define an associative array for replacements
if [[ $(uname -s ) == 'Darwin' ]];then
replacements=(
"REDIS_URL=$redisUrl"
"REGISTRY_URL=$registry_url"
"MONGO_USERNAME=$mongo_initdb_root_username"
"MONGO_PASSWORD=$mongo_initdb_root_password"
"MONGO_DB_NAME=$mongo_initdb_database"
"MONOG_URL=$mongoUrl"
"RABBITMQ_USERNAME=$rabbitmq_default_user"
"RABBITMQ_PASSWORD=$rabbitmq_default_pass"
"RABBITMQ_URL=$rabbitmqUrl"
"PRIVATE_KEY=$private_key"
"PUBLIC_KEY=$public_key"
"BPP_SUBSCRIBER_URL=$bpp_subscriber_url"
"BPP_SUBSCRIBER_ID=$bpp_subscriber_id"
"BPP_SUBSCRIBER_KEY_ID=$bpp_subscriber_key_id"
"WEBHOOK_URL=$webhook_url"
"USE_LAYER_2_CONFIG"=true
"MANDATE_LAYER_2_CONFIG"=true
)
echo "Configuring BPP protocol server"
# Apply replacements in both files
for file in "$clientFile" "$networkFile"; do
for line in "${replacements[@]}"; do
key=$(echo "$line" | cut -d '=' -f1)
value=$(echo "$line" | cut -d '=' -f2)
sed -i '' "s|$key|$value|" "$file"
done
done
else
declare -A replacements=(
["REDIS_URL"]=$redisUrl
["REGISTRY_URL"]=$registry_url
["MONGO_USERNAME"]=$mongo_initdb_root_username
["MONGO_PASSWORD"]=$mongo_initdb_root_password
["MONGO_DB_NAME"]=$mongo_initdb_database
["MONOG_URL"]=$mongoUrl
["RABBITMQ_USERNAME"]=$rabbitmq_default_user
["RABBITMQ_PASSWORD"]=$rabbitmq_default_pass
["RABBITMQ_URL"]=$rabbitmqUrl
["PRIVATE_KEY"]=$private_key
["PUBLIC_KEY"]=$public_key
["BPP_SUBSCRIBER_URL"]=$bpp_subscriber_url
["BPP_SUBSCRIBER_ID"]=$bpp_subscriber_id
["BPP_SUBSCRIBER_KEY_ID"]=$bpp_subscriber_key_id
["WEBHOOK_URL"]=$webhook_url
["USE_LAYER_2_CONFIG"]=true
["MANDATE_LAYER_2_CONFIG"]=true
)
echo "Configuring BPP protocol server"
# Apply replacements in both files
for file in "$clientFile" "$networkFile"; do
for key in "${!replacements[@]}"; do
sed -i "s|$key|${replacements[$key]}|" "$file"
done
done
fi
echo "Registering BPP protocol server on the registry"
create_network_participant "$registry_url" "application/json" "$bpp_subscriber_id" "$bpp_subscriber_key_id" "$bpp_subscriber_url" "$public_key" "$public_key" "$valid_from" "$valid_until" "$type"

View File

@@ -1,120 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/get_container_details.sh
gateway_id=gateway
gateway_port=4030
protocol=http
reg_url=http://$1:3030/subscribers/lookup
registry_id=registry
registry_url=http://registry:3030
update_network_json(){
cp $SCRIPT_DIR/../gateway_data/config/networks/onix.json-sample $SCRIPT_DIR/../gateway_data/config/networks/onix.json
networks_config_file="$SCRIPT_DIR/../gateway_data/config/networks/onix.json"
tmp_file=$(mktemp "tempfile.XXXXXXXXXX")
sed " s|GATEWAY_ID|$gateway_id|g; s|REGISTRY_ID|$registry_id|g; s|REGISTRY_URL|$registry_url|g" "$networks_config_file" > "$tmp_file"
mv "$tmp_file" "$networks_config_file"
docker run --rm -v $SCRIPT_DIR/../gateway_data/config:/source -v gateway_data_volume:/target busybox cp -r /source/networks /target/
}
get_details_registry() {
# Make the curl request and store the output in a variable
response=$(curl --location --request POST "$reg_url" \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "LREG"
}')
# Check if the curl command was successful (HTTP status code 2xx)
if [ $? -eq 0 ]; then
# Extract signing_public_key and encr_public_key using jq
signing_public_key=$(echo "$response" | jq -r '.[0].signing_public_key')
encr_public_key=$(echo "$response" | jq -r '.[0].encr_public_key')
subscriber_url=$(echo "$response" | jq -r '.[0].subscriber_url')
else
echo "Error: Unable to fetch data from the server."
fi
}
update_gateway_config() {
# Print the extracted keys
# echo "Signing Public Key: $signing_public_key"
# echo "Encryption Public Key: $encr_public_key"
# echo "URL $subscriber_url"
cp $SCRIPT_DIR/../gateway_data/config/swf.properties-sample $SCRIPT_DIR/../gateway_data/config/swf.properties
config_file="$SCRIPT_DIR/../gateway_data/config/swf.properties"
tmp_file=$(mktemp "tempfile.XXXXXXXXXX")
#sed " s|SUBSCRIBER_ID|$gateway_id|g; s|SIGNING_PUBLIC_KEY|$signing_public_key|g; s|ENCRYPTION_PUBLIC_KEY|$encr_public_key|g; s|GATEWAY_URL|$gateway_id|g; s|GATEWAY_PORT|$gateway_port|g; s|PROTOCOL|$protocol|g; s|REGISTRY_URL|$subscriber_url|g" "$config_file" > "$tmp_file"
sed " s|SUBSCRIBER_ID|$gateway_id|g; s|GATEWAY_URL|$gateway_id|g; s|GATEWAY_PORT|$gateway_port|g; s|PROTOCOL|$protocol|g; s|REGISTRY_URL|$subscriber_url|g" "$config_file" > "$tmp_file"
mv "$tmp_file" "$config_file"
docker volume create gateway_data_volume
docker volume create gateway_database_volume
docker run --rm -v $SCRIPT_DIR/../gateway_data/config:/source -v gateway_data_volume:/target busybox cp /source/{envvars,logger.properties,swf.properties} /target/
update_network_json
}
# if [[ $1 == https://* ]]; then
# reg_url=$1/subscribers/lookup
# get_details_registry $reg_url
# else
# service_name=$1
# if [[ $(uname -s) == 'Darwin' ]]; then
# ip=localhost
# elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
# ip=$(hostname -I | awk '{print $1}')
# else
# ip=$(get_container_ip $service_name)
# fi
# reg_url=http://$ip:3030/subscribers/lookup
# get_details_registry $reg_url
# fi
echo "Registry: $1 && Gateway: $2"
if [[ $1 ]]; then
registry_url=$1
if [[ $1 == https://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
registry_id=$(echo "$1" | sed -E 's/https:\/\///')
else
registry_id=$(echo "$1" | sed 's/https:\/\///')
fi
elif [[ $1 == http://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
registry_id=$(echo "$1" | sed -E 's/http:\/\///')
else
registry_id=$(echo "$1" | sed 's/http:\/\///')
fi
fi
if [[ $registry_id = "registry:3030" ]]; then
registry_id="registry"
fi
fi
if [[ $2 ]]; then
if [[ $2 == https://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
gateway_id=$(echo "$2" | sed -E 's/https:\/\///')
else
gateway_id=$(echo "$2" | sed 's/https:\/\///')
fi
gateway_port=443
protocol=https
update_gateway_config
elif [[ $2 == http://* ]]; then
if [[ $(uname -s) == 'Darwin' ]]; then
gateway_id=$(echo "$2" | sed -E 's/http:\/\///')
else
gateway_id=$(echo "$2" | sed 's/http:\/\///')
fi
gateway_port=80
protocol=http
update_gateway_config
fi
else
update_gateway_config
fi

View File

@@ -1,60 +0,0 @@
#!/bin/bash
#Colour Code
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
NC=$(tput sgr0)
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#Comman Variables with Default values
mongo_initdb_root_username="beckn"
mongo_initdb_root_password="beckn123"
mongo_initdb_database="protocol_server"
mongoUrl="mongoDB:27017"
rabbitmq_default_user="beckn"
rabbitmq_default_pass="beckn123"
rabbitmqUrl="rabbitmq"
redisUrl="redis"
registry_url="http://registry:3030/subscribers"
beckn_registry_url="https://registry.becknprotocol.io/subscribers"
#public_key="KKHOpMKQCbJHzjme+CPKI3HQxIhzKMpcLLRGMhzf7rk="
#private_key="W7HkCMPWvxv6/jWqHlyUI4vWX8704+rN3kCwBGIA7rcooc6kwpAJskfOOZ74I8ojcdDEiHMoylwstEYyHN/uuQ=="
#BAP varibales.
bapClientFile="$SCRIPT_DIR/../protocol-server-data/bap-client.yaml-sample"
bapNetworkFile="$SCRIPT_DIR/../protocol-server-data/bap-network.yaml-sample"
bap_client_port=5001
bap_network_port=5002
bap_subscriber_id="bap-network"
bap_subscriber_key_id="bap-network-key"
bap_subscriber_url="http://bap-network:5002"
bap_client_url="http://bap-client:5002"
#BPP varibales.
bppClientFile="$SCRIPT_DIR/../protocol-server-data/bpp-client.yaml-sample"
bppNetworkFile="$SCRIPT_DIR/../protocol-server-data/bpp-network.yaml-sample"
bpp_client_port=6001
bpp_network_port=6002
bpp_subscriber_id="bpp-network"
bpp_subscriber_key_id="bpp-network-key"
bpp_subscriber_url="http://bpp-network:6002"
webhook_url="http://sandbox-api:3000"
bpp_docker_compose_file=docker-compose-bpp.yml
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