Merge pull request #498 from MayurWitsLab/beckn-onix-v1.0-develop
Beckn onix v1.0 develop
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -142,3 +142,10 @@ coverage.html
|
|||||||
# Generated files
|
# Generated files
|
||||||
.env.vault
|
.env.vault
|
||||||
server
|
server
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
beckn-adapter
|
||||||
|
*.log
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
test_request.json
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ services:
|
|||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
container_name: redis
|
container_name: redis
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "6379:6379"
|
- "6379:6379"
|
||||||
networks:
|
networks:
|
||||||
@@ -47,6 +48,7 @@ services:
|
|||||||
vault:
|
vault:
|
||||||
image: hashicorp/vault:latest
|
image: hashicorp/vault:latest
|
||||||
container_name: vault
|
container_name: vault
|
||||||
|
platform: linux/amd64
|
||||||
cap_add:
|
cap_add:
|
||||||
- IPC_LOCK
|
- IPC_LOCK
|
||||||
ports:
|
ports:
|
||||||
@@ -71,6 +73,7 @@ services:
|
|||||||
registry:
|
registry:
|
||||||
image: fidedocker/registry:latest
|
image: fidedocker/registry:latest
|
||||||
container_name: registry
|
container_name: registry
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000" # Main registry port
|
- "3000:3000" # Main registry port
|
||||||
- "3030:3030" # Admin/monitoring port
|
- "3030:3030" # Admin/monitoring port
|
||||||
@@ -88,6 +91,7 @@ services:
|
|||||||
gateway:
|
gateway:
|
||||||
image: fidedocker/gateway:latest
|
image: fidedocker/gateway:latest
|
||||||
container_name: gateway
|
container_name: gateway
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "4000:4000" # Main gateway port
|
- "4000:4000" # Main gateway port
|
||||||
- "4030:4030" # Admin/monitoring port
|
- "4030:4030" # Admin/monitoring port
|
||||||
@@ -111,6 +115,7 @@ services:
|
|||||||
bap-client:
|
bap-client:
|
||||||
image: fidedocker/protocol-server:latest
|
image: fidedocker/protocol-server:latest
|
||||||
container_name: bap-client
|
container_name: bap-client
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -132,6 +137,7 @@ services:
|
|||||||
bap-network:
|
bap-network:
|
||||||
image: fidedocker/protocol-server:latest
|
image: fidedocker/protocol-server:latest
|
||||||
container_name: bap-network
|
container_name: bap-network
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "5002:5002"
|
- "5002:5002"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -158,6 +164,7 @@ services:
|
|||||||
bpp-client:
|
bpp-client:
|
||||||
image: fidedocker/protocol-server:latest
|
image: fidedocker/protocol-server:latest
|
||||||
container_name: bpp-client
|
container_name: bpp-client
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "6001:6001"
|
- "6001:6001"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -179,6 +186,7 @@ services:
|
|||||||
bpp-network:
|
bpp-network:
|
||||||
image: fidedocker/protocol-server:latest
|
image: fidedocker/protocol-server:latest
|
||||||
container_name: bpp-network
|
container_name: bpp-network
|
||||||
|
platform: linux/amd64
|
||||||
ports:
|
ports:
|
||||||
- "6002:6002"
|
- "6002:6002"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/beckn/beckn-onix
|
module github.com/beckn/beckn-onix
|
||||||
|
|
||||||
go 1.24
|
go 1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/kr/pretty v0.3.1 // indirect
|
github.com/kr/pretty v0.3.1 // indirect
|
||||||
|
|||||||
16
install/.gitignore
vendored
Normal file
16
install/.gitignore
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
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
|
||||||
|
gateway_data/config/networks/onix.json
|
||||||
|
|
||||||
19
install/ENV/.env-generic-client-layer-sample
Normal file
19
install/ENV/.env-generic-client-layer-sample
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
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
|
||||||
2
install/ENV/.env-sandbox
Normal file
2
install/ENV/.env-sandbox
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
BPPCLIENTURL=http://bpp-client:6001
|
||||||
|
BASE_URL=http://sandbox-api:3000
|
||||||
2
install/ENV/.env-webhook
Normal file
2
install/ENV/.env-webhook
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
SANDBOXURL=http://sandbox-api:3000
|
||||||
|
BPPCLIENTURL=http://bpp-client:6001
|
||||||
39
install/add_layer2_conifg_manually.sh
Normal file
39
install/add_layer2_conifg_manually.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Prompt for container name
|
||||||
|
echo "Please provide the container name for which you want to create the layer2config:"
|
||||||
|
read CONTAINER_NAME
|
||||||
|
|
||||||
|
# Validate container name is not empty
|
||||||
|
if [ -z "$CONTAINER_NAME" ]; then
|
||||||
|
echo "Error: Container name cannot be empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prompt for domain name
|
||||||
|
echo "Please provide the domain name for which you want to create the layer2config:"
|
||||||
|
read DOMAIN_NAME
|
||||||
|
|
||||||
|
# Validate domain name is not empty
|
||||||
|
if [ -z "$DOMAIN_NAME" ]; then
|
||||||
|
echo "Error: Domain name cannot be empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace all occurrences of ':' with '_' in domain name
|
||||||
|
PROCESSED_DOMAIN=$(echo "$DOMAIN_NAME" | tr ':' '_')
|
||||||
|
|
||||||
|
# Create the final filename
|
||||||
|
FINAL_FILENAME="${PROCESSED_DOMAIN}_1.1.0.yaml"
|
||||||
|
|
||||||
|
# Execute the docker command
|
||||||
|
echo "Creating layer2 config file with name: $FINAL_FILENAME"
|
||||||
|
docker exec -it "$CONTAINER_NAME" cp schemas/core_1.1.0.yaml schemas/"$FINAL_FILENAME"
|
||||||
|
|
||||||
|
# Check if the command was successful
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Successfully created $FINAL_FILENAME in container $CONTAINER_NAME"
|
||||||
|
else
|
||||||
|
echo "Failed to create the file. Please check if the container exists and is running."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
765
install/beckn-onix.sh
Executable file
765
install/beckn-onix.sh
Executable file
@@ -0,0 +1,765 @@
|
|||||||
|
#!/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"
|
||||||
|
|
||||||
|
#Update Role Permission for registry.
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
bash scripts/registry_role_permissions.sh $1
|
||||||
|
else
|
||||||
|
bash scripts/registry_role_permissions.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to install Layer2 Config
|
||||||
|
install_layer2_config() {
|
||||||
|
container_name=$1
|
||||||
|
FILENAME="$(basename "$layer2_url")"
|
||||||
|
wget -O "$(basename "$layer2_url")" "$layer2_url" >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
docker cp "$FILENAME" $container_name:"$schemas_path/$FILENAME" >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "${GREEN}Successfully copied $FILENAME to Docker container $container_name.${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${BoldRed}The Layer 2 configuration file has not been downloaded.${NC}"
|
||||||
|
echo -e "${BoldGreen}Please download the Layer 2 configuration files by running the download_layer_2_config_bap.sh script located in the ../layer2 folder."
|
||||||
|
echo -e "For further information, refer to this URL: https://github.com/beckn/beckn-onix/blob/main/docs/user_guide.md#downloading-layer-2-configuration-for-a-domain.${NC}"
|
||||||
|
fi
|
||||||
|
rm -f $FILENAME >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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 $api_key $np_domain
|
||||||
|
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"
|
||||||
|
sleep 20
|
||||||
|
start_container $bap_docker_compose_file "bap-network"
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
if [[ -z "$layer2_url" ]]; then
|
||||||
|
echo -e "${BoldGreen}Please download the Layer 2 configuration files by running the download_layer_2_config_bap.sh script located in the ../layer2 folder."
|
||||||
|
echo -e "For further information, refer to this URL:${BLUE}https://github.com/beckn/beckn-onix/blob/main/docs/user_guide.md#downloading-layer-2-configuration-for-a-domain.${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Installing layer configuration for $(basename "$layer2_url")${NC}"
|
||||||
|
install_layer2_config bap-client
|
||||||
|
install_layer2_config bap-network
|
||||||
|
fi
|
||||||
|
echo "Protocol server BAP installation successful"
|
||||||
|
sleep 40
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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 $api_key $np_domain
|
||||||
|
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
|
||||||
|
if [[ -z "$layer2_url" ]]; then
|
||||||
|
echo -e "${BoldGreen}Please download the Layer 2 configuration files by running the download_layer_2_config_bpp.sh script located in the ../layer2 folder."
|
||||||
|
echo -e "For further information, refer to this URL:${BLUE} https://github.com/beckn/beckn-onix/blob/main/docs/user_guide.md#downloading-layer-2-configuration-for-a-domain.${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${BoldGreen}Installing layer configuration for $(basename "$layer2_url")"
|
||||||
|
install_layer2_config bpp-client
|
||||||
|
install_layer2_config bpp-network
|
||||||
|
fi
|
||||||
|
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 $api_key $np_domain
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
layer2_config() {
|
||||||
|
while true; do
|
||||||
|
read -p "Paste the URL of the Layer 2 configuration here (or press Enter to skip): " layer2_url
|
||||||
|
if [[ -z "$layer2_url" ]]; then
|
||||||
|
break #If URL is empty then skip the URL validation
|
||||||
|
elif [[ $layer2_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Validate the user credentials against the Registry
|
||||||
|
validate_user() {
|
||||||
|
# Prompt for username
|
||||||
|
read -p "Enter your registry username: " username
|
||||||
|
|
||||||
|
# Prompt for password with '*' masking
|
||||||
|
echo -n "Enter your registry password: "
|
||||||
|
stty -echo # Disable terminal echo
|
||||||
|
|
||||||
|
password=""
|
||||||
|
while IFS= read -r -n1 char; do
|
||||||
|
if [[ "$char" == $'\0' ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
password+="$char"
|
||||||
|
echo -n "*" # Display '*' for each character typed
|
||||||
|
done
|
||||||
|
stty echo # Re-enable terminal echo
|
||||||
|
echo # Move to a new line after input
|
||||||
|
|
||||||
|
# Replace '/subscribers' with '/login' for validation
|
||||||
|
local login_url="${registry_url%/subscribers}/login"
|
||||||
|
|
||||||
|
# Validate credentials using a POST request
|
||||||
|
local response
|
||||||
|
response=$(curl -s -w "%{http_code}" -X POST "$login_url" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{ "Name" : "'"$username"'", "Password" : "'"$password"'" }')
|
||||||
|
|
||||||
|
# Check if the HTTP response is 200 (success)
|
||||||
|
status_code="${response: -3}"
|
||||||
|
if [ "$status_code" -eq 200 ]; then
|
||||||
|
response_body="${response%???}"
|
||||||
|
api_key=$(echo "$response_body" | jq -r '.api_key')
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
response=$(curl -s -w "%{http_code}" -X POST "$login_url" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{ "User" : { "Name" : "'"$username"'", "Password" : "'"$password"'" }}')
|
||||||
|
|
||||||
|
status_code="${response: -3}"
|
||||||
|
if [ "$status_code" -eq 200 ]; then
|
||||||
|
response_body="${response%???}"
|
||||||
|
api_key=$(echo "$response_body" | jq -r '.api_key')
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "Please check your credentials or register new user on $login_url"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get_np_domain() {
|
||||||
|
if [[ $2 ]]; then
|
||||||
|
read -p "Do you want to setup this $1 and $2 for specific domain? {Y/N} " dchoice
|
||||||
|
else
|
||||||
|
read -p "Do you want to setup this $1 for specific domain? {Y/N} " dchoice
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$dchoice" == "Y" || "$dchoice" == "y" ]]; then
|
||||||
|
local login_url="${registry_url%/subscribers}"
|
||||||
|
read -p "Enter the domain name for $1 : " np_domain
|
||||||
|
domain_present=$(curl -s -H "ApiKey:$api_key" --header 'Content-Type: application/json' $login_url/network_domains/index | jq -r '.[].name' | tr '\n' ' ')
|
||||||
|
if echo "$domain_present" | grep -Fqw "$np_domain"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "${BoldRed}The domain '$np_domain' is NOT present in the network domains.${NC}"
|
||||||
|
echo "${BoldGreen}Available network domains: $domain_present ${NC}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
np_domain=" " #If user don't want to add specific domain then save empty string
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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..."
|
||||||
|
|
||||||
|
case $platform in
|
||||||
|
"Registry")
|
||||||
|
while true; do
|
||||||
|
read -p "Enter publicly accessible registry URL: " registry_url
|
||||||
|
if [[ $registry_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
new_registry_url="${registry_url%/}"
|
||||||
|
public_address=$registry_url
|
||||||
|
install_package
|
||||||
|
install_registry $new_registry_url
|
||||||
|
;;
|
||||||
|
"Gateway" | "Beckn Gateway")
|
||||||
|
while true; do
|
||||||
|
read -p "Enter your registry URL: " registry_url
|
||||||
|
if [[ $registry_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -p "Enter publicly accessible gateway URL: " gateway_url
|
||||||
|
if [[ $gateway_url =~ ^(http|https):// ]]; then
|
||||||
|
gateway_url="${gateway_url%/}"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
public_address=$gateway_url
|
||||||
|
install_package
|
||||||
|
install_gateway $registry_url $gateway_url
|
||||||
|
;;
|
||||||
|
"BAP")
|
||||||
|
echo "${GREEN}................Installing Protocol Server for BAP................${NC}"
|
||||||
|
|
||||||
|
read -p "Enter BAP Subscriber ID: " bap_subscriber_id
|
||||||
|
while true; do
|
||||||
|
read -p "Enter BAP Subscriber URL: " bap_subscriber_url
|
||||||
|
if [[ $bap_subscriber_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -p "Enter the registry URL (e.g., https://registry.becknprotocol.io/subscribers): " registry_url
|
||||||
|
if [[ $registry_url =~ ^(http|https):// ]] && [[ $registry_url == */subscribers ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
validate_user
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_np_domain $bap_subscriber_id
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
bap_subscriber_key_id="$bap_subscriber_id-key"
|
||||||
|
public_address=$bap_subscriber_url
|
||||||
|
|
||||||
|
layer2_config
|
||||||
|
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 BPP................${NC}"
|
||||||
|
|
||||||
|
read -p "Enter BPP Subscriber ID: " bpp_subscriber_id
|
||||||
|
while true; do
|
||||||
|
read -p "Enter BPP Subscriber URL: " bpp_subscriber_url
|
||||||
|
if [[ $bpp_subscriber_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -p "Enter Webhook URL: " webhook_url
|
||||||
|
if [[ $webhook_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -p "Enter the registry URL (e.g., https://registry.becknprotocol.io/subscribers): " registry_url
|
||||||
|
if [[ $registry_url =~ ^(http|https):// ]] && [[ $registry_url == */subscribers ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Please mention /subscribers in your registry URL${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
validate_user
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_np_domain $bpp_subscriber_id
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
bpp_subscriber_key_id="$bpp_subscriber_id-key"
|
||||||
|
public_address=$bpp_subscriber_url
|
||||||
|
|
||||||
|
layer2_config
|
||||||
|
install_package
|
||||||
|
install_bpp_protocol_server $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||||
|
;;
|
||||||
|
"ALL")
|
||||||
|
# Collect all inputs at once for all components
|
||||||
|
|
||||||
|
# Registry input
|
||||||
|
while true; do
|
||||||
|
read -p "Enter publicly accessible registry URL: " registry_url
|
||||||
|
if [[ $registry_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Gateway inputs
|
||||||
|
while true; do
|
||||||
|
read -p "Enter publicly accessible gateway URL: " gateway_url
|
||||||
|
if [[ $gateway_url =~ ^(http|https):// ]]; then
|
||||||
|
gateway_url="${gateway_url%/}"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# BAP inputs
|
||||||
|
read -p "Enter BAP Subscriber ID: " bap_subscriber_id
|
||||||
|
while true; do
|
||||||
|
read -p "Enter BAP Subscriber URL: " bap_subscriber_url
|
||||||
|
if [[ $bap_subscriber_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# BPP inputs
|
||||||
|
read -p "Enter BPP Subscriber ID: " bpp_subscriber_id
|
||||||
|
while true; do
|
||||||
|
read -p "Enter BPP Subscriber URL: " bpp_subscriber_url
|
||||||
|
if [[ $bpp_subscriber_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
read -p "Enter Webhook URL: " webhook_url
|
||||||
|
if [[ $webhook_url =~ ^(http|https):// ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid URL format. Please enter a valid URL starting with http:// or https://.${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install components after gathering all inputs
|
||||||
|
install_package
|
||||||
|
|
||||||
|
install_registry $registry_url
|
||||||
|
|
||||||
|
install_gateway $registry_url $gateway_url
|
||||||
|
|
||||||
|
layer2_config
|
||||||
|
#Append /subscribers for registry_url
|
||||||
|
new_registry_url="${registry_url%/}/subscribers"
|
||||||
|
bap_subscriber_key_id="$bap_subscriber_id-key"
|
||||||
|
install_bap_protocol_server $new_registry_url $bap_subscriber_id $bap_subscriber_key_id $bap_subscriber_url
|
||||||
|
|
||||||
|
bpp_subscriber_key_id="$bpp_subscriber_id-key"
|
||||||
|
install_bpp_protocol_server $new_registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown platform: $platform"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
restart_script() {
|
||||||
|
read -p "${GREEN}Do you want to restart the script or exit the script? (r for restart, e for exit): ${NC}" choice
|
||||||
|
if [[ $choice == "r" ]]; then
|
||||||
|
echo "Restarting the script..."
|
||||||
|
exec "$0" # Restart the script by re-executing it
|
||||||
|
elif [[ $choice == "e" ]]; then
|
||||||
|
echo "Exiting the script..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to validate user input
|
||||||
|
validate_input() {
|
||||||
|
local input=$1
|
||||||
|
local max_option=$2
|
||||||
|
|
||||||
|
# Check if the input is a digit and within the valid range
|
||||||
|
if [[ "$input" =~ ^[0-9]+$ ]] && ((input >= 1 && input <= max_option)); then
|
||||||
|
return 0 # Valid input
|
||||||
|
else
|
||||||
|
echo "${RED}Invalid input. Please enter a number between 1 and $max_option.${NC}"
|
||||||
|
return 1 # Invalid input
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_docker_permissions() {
|
||||||
|
if ! command -v docker &>/dev/null; then
|
||||||
|
echo -e "${RED}Error: Docker is not installed on this system.${NC}"
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
install_package
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo -e "${RED}Please install Docker and try again.${NC}"
|
||||||
|
echo -e "${RED}Please install Docker and jq manually.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if ! groups "$USER" | grep -q '\bdocker\b'; then
|
||||||
|
echo -e "${RED}Error: You do not have permission to run Docker. Please add yourself to the docker group by running the following command:${NC}"
|
||||||
|
echo -e "${BoldGreen}sudo usermod -aG docker \$USER"
|
||||||
|
echo -e "After running the above command, please log out and log back in to your system, then restart the deployment script.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to update/upgrade a specific service
|
||||||
|
update_service() {
|
||||||
|
service_name=$1
|
||||||
|
docker_compose_file=$2
|
||||||
|
image_name=$3
|
||||||
|
|
||||||
|
echo "${GREEN}................Updating $service_name................${NC}"
|
||||||
|
|
||||||
|
export COMPOSE_IGNORE_ORPHANS=1
|
||||||
|
# Pull the latest image
|
||||||
|
docker pull "$image_name"
|
||||||
|
|
||||||
|
# Stop and remove the existing container
|
||||||
|
docker compose -f "$docker_compose_file" stop "$service_name"
|
||||||
|
docker compose -f "$docker_compose_file" rm -f "$service_name"
|
||||||
|
|
||||||
|
# Start the service with the new image
|
||||||
|
docker compose -f "$docker_compose_file" up -d "$service_name"
|
||||||
|
|
||||||
|
echo "$service_name update successful"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle the update/upgrade process
|
||||||
|
update_network() {
|
||||||
|
echo -e "\nWhich component would you like to update?\n1. Registry\n2. Gateway\n3. BAP Protocol Server\n4. BPP Protocol Server\n5. All components"
|
||||||
|
read -p "Enter your choice: " update_choice
|
||||||
|
|
||||||
|
validate_input "$update_choice" 5
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
restart_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $update_choice in
|
||||||
|
1)
|
||||||
|
update_service "registry" "$registry_docker_compose_file" "fidedocker/registry"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
update_service "gateway" "$gateway_docker_compose_file" "fidedocker/gateway"
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
update_service "bap-client" "$bap_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
update_service "bap-network" "$bap_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
update_service "bpp-client" "$bpp_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
update_service "bpp-network" "$bpp_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
update_service "registry" "$registry_docker_compose_file" "fidedocker/registry"
|
||||||
|
update_service "gateway" "$gateway_docker_compose_file" "fidedocker/gateway"
|
||||||
|
update_service "bap-client" "$bap_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
update_service "bap-network" "$bap_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
update_service "bpp-client" "$bpp_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
update_service "bpp-network" "$bpp_docker_compose_file" "fidedocker/protocol-server"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown choice"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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 "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)"
|
||||||
|
read -p "Enter your choice: " choice
|
||||||
|
|
||||||
|
validate_input "$choice" 6
|
||||||
|
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"
|
||||||
|
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
|
||||||
|
elif [[ $choice -eq 5 ]]; then
|
||||||
|
echo "${BoldGreen}Currently this feature is not available in this distribution of Beckn ONIX${NC}"
|
||||||
|
restart_script
|
||||||
|
elif [[ $choice -eq 6 ]]; then
|
||||||
|
update_network
|
||||||
|
else
|
||||||
|
# Determine the platforms available based on the initial choice
|
||||||
|
platforms=("Gateway" "BAP" "BPP" "ALL")
|
||||||
|
[ "$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
|
||||||
|
validate_input "$platform_choice" "${#platforms[@]}"
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
restart_script # Restart the script if input is invalid
|
||||||
|
fi
|
||||||
|
|
||||||
|
selected_platform="${platforms[$((platform_choice - 1))]}"
|
||||||
|
|
||||||
|
if [[ -n $selected_platform ]]; then
|
||||||
|
completeSetup "$selected_platform"
|
||||||
|
else
|
||||||
|
restart_script
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Process complete. Thank you for using Beckn-ONIX!"
|
||||||
61
install/docker-compose-app.yml
Normal file
61
install/docker-compose-app.yml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
services:
|
||||||
|
mongo_db:
|
||||||
|
image: mongo:4.4
|
||||||
|
platform: linux/amd64
|
||||||
|
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
|
||||||
|
platform: linux/amd64
|
||||||
|
restart: unless-stopped
|
||||||
|
container_name: redis
|
||||||
|
networks:
|
||||||
|
- beckn_network
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- beckn_redis:/data
|
||||||
|
|
||||||
|
queue_service:
|
||||||
|
image: rabbitmq:3.8-management-alpine
|
||||||
|
platform: linux/amd64
|
||||||
|
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
|
||||||
49
install/docker-compose-bap.yml
Normal file
49
install/docker-compose-bap.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
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
|
||||||
62
install/docker-compose-bpp-with-sandbox.yml
Normal file
62
install/docker-compose-bpp-with-sandbox.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
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
|
||||||
|
environment:
|
||||||
|
- PORT=4000
|
||||||
|
- WEBHOOK_URL=http://host.docker.internal:3001/webhook
|
||||||
|
|
||||||
|
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
|
||||||
49
install/docker-compose-bpp.yml
Normal file
49
install/docker-compose-bpp.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
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
|
||||||
30
install/docker-compose-gateway.yml
Normal file
30
install/docker-compose-gateway.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
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
|
||||||
119
install/docker-compose-gcl.yml
Normal file
119
install/docker-compose-gcl.yml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
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
|
||||||
30
install/docker-compose-registry.yml
Normal file
30
install/docker-compose-registry.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
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
|
||||||
119
install/docker-compose-v2.yml
Normal file
119
install/docker-compose-v2.yml
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
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
|
||||||
103
install/docker-compose.yml
Normal file
103
install/docker-compose.yml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
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
|
||||||
2
install/gateway_data/config/envvars
Normal file
2
install/gateway_data/config/envvars
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export dport=4000
|
||||||
|
export wport=4030
|
||||||
20
install/gateway_data/config/logger.properties
Normal file
20
install/gateway_data/config/logger.properties
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
11
install/gateway_data/config/networks/onix.json-sample
Normal file
11
install/gateway_data/config/networks/onix.json-sample
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"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" : ""
|
||||||
|
}
|
||||||
43
install/gateway_data/config/swf.properties-sample
Normal file
43
install/gateway_data/config/swf.properties-sample
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
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
|
||||||
11
install/gateway_data/database/.gitignore
vendored
Normal file
11
install/gateway_data/database/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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*
|
||||||
27
install/onix_ascii_art.txt
Normal file
27
install/onix_ascii_art.txt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:;;;;:;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;;::;:::;;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@......@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@;:;;;;:;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@::::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@..................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@.........,,::,,.........@@@@@........@@.......@@@@@@@........@.........@@@@@........@@@@@@@
|
||||||
|
@@@@@@.........,,::;;;;::,.........@@@...................@@@@@........@..........@@@.........@@@@@@@
|
||||||
|
@@@@@@.......,::;;;:,::;;;::,......@@@....................@@@@........@@..........@.........@@@@@@@@
|
||||||
|
@@@@@@.....,:;;;::,....,::;;;:,....@@@.....................@@@........@@@..................@@@@@@@@@
|
||||||
|
@@@@@@.....:;;:,..........,:;;,....@@@.....................@@@........@@@@................@@@@@@@@@@
|
||||||
|
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@.............@@@@@@@@@@@
|
||||||
|
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@@..........@@@@@@@@@@@@@
|
||||||
|
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@@............@@@@@@@@@@@@
|
||||||
|
@@@@@@.....:;;:............:;;,....@@@........@@@@@........@@@........@@@@@..............@@@@@@@@@@@
|
||||||
|
@@@@@@.....,;;;:,,......,::;;;,....@@@........@@@@@........@@@........@@@@................@@@@@@@@@@
|
||||||
|
@@@@@@......,::;;;:,,,::;;;::,.....@@@........@@@@@........@@@........@@@..................@@@@@@@@@
|
||||||
|
@@@@@@........,,:;;;;;;;::,........@@@........@@@@@........@@@........@@.........@@.........@@@@@@@@
|
||||||
|
@@@@@@@@.........,,::::,,.........@@@@........@@@@@........@@@........@.........@@@@.........@@@@@@@
|
||||||
|
@@@@@@@@@@@.........,..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@..............@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
|
|
||||||
138
install/protocol-server-data/bap-client.yaml-sample
Normal file
138
install/protocol-server-data/bap-client.yaml-sample
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
136
install/protocol-server-data/bap-network.yaml-sample
Normal file
136
install/protocol-server-data/bap-network.yaml-sample
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
# 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
|
||||||
134
install/protocol-server-data/bpp-client.yaml-sample
Normal file
134
install/protocol-server-data/bpp-client.yaml-sample
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
# 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: false
|
||||||
|
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
|
||||||
134
install/protocol-server-data/bpp-network.yaml-sample
Normal file
134
install/protocol-server-data/bpp-network.yaml-sample
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
# 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: false
|
||||||
|
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
|
||||||
2
install/registry_data/config/envvars
Normal file
2
install/registry_data/config/envvars
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export dport=3000
|
||||||
|
export wport=3030
|
||||||
20
install/registry_data/config/logger.properties
Normal file
20
install/registry_data/config/logger.properties
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
43
install/registry_data/config/swf.properties-sample
Normal file
43
install/registry_data/config/swf.properties-sample
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
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
|
||||||
11
install/registry_data/database/.gitignore
vendored
Normal file
11
install/registry_data/database/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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*
|
||||||
BIN
install/scripts/RolePermission.xlsx
Executable file
BIN
install/scripts/RolePermission.xlsx
Executable file
Binary file not shown.
27
install/scripts/banner.sh
Executable file
27
install/scripts/banner.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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}"
|
||||||
27
install/scripts/generate_keys.sh
Executable file
27
install/scripts/generate_keys.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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
|
||||||
21
install/scripts/generic-client-layer.sh
Executable file
21
install/scripts/generic-client-layer.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/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
|
||||||
8
install/scripts/get_container_details.sh
Executable file
8
install/scripts/get_container_details.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/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
|
||||||
7
install/scripts/k8s/ConfigMap.yaml
Normal file
7
install/scripts/k8s/ConfigMap.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: swf-config
|
||||||
|
data:
|
||||||
|
swf.properties: |
|
||||||
|
# Content of swf.properties file for registry
|
||||||
59
install/scripts/k8s/deployment.yaml
Normal file
59
install/scripts/k8s/deployment.yaml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
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
|
||||||
24
install/scripts/k8s/ingress.yaml
Normal file
24
install/scripts/k8s/ingress.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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
|
||||||
33
install/scripts/k8s/service.yaml
Normal file
33
install/scripts/k8s/service.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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
|
||||||
172
install/scripts/package_manager.sh
Executable file
172
install/scripts/package_manager.sh
Executable file
@@ -0,0 +1,172 @@
|
|||||||
|
#!/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 [ "$(lsb_release -is | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')" = "ubuntu" ]; then
|
||||||
|
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
|
||||||
|
else
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
32
install/scripts/register_gateway.sh
Executable file
32
install/scripts/register_gateway.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/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
|
||||||
55
install/scripts/registry_entry.sh
Executable file
55
install/scripts/registry_entry.sh
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
#!/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}"
|
||||||
|
api_key="${11}"
|
||||||
|
np_domain="${12}"
|
||||||
|
|
||||||
|
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": "$np_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 "ApiKey:$api_key" --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
|
||||||
|
response=$(curl --location --request POST "$registry_url/register" \
|
||||||
|
--header "ApiKey:$api_key" --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
|
||||||
|
echo "${RED}Error: $response${NC}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
101
install/scripts/registry_role_permissions.sh
Executable file
101
install/scripts/registry_role_permissions.sh
Executable file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Set script directory and source variables
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/variables.sh"
|
||||||
|
|
||||||
|
API_KEY=""
|
||||||
|
|
||||||
|
# Function to log in and retrieve the API key
|
||||||
|
get_api_key() {
|
||||||
|
local login_url="${registry_url%/subscribers}/login"
|
||||||
|
local username="$1"
|
||||||
|
local password="$2"
|
||||||
|
local max_retries=20
|
||||||
|
local retry_count=0
|
||||||
|
local success=false
|
||||||
|
|
||||||
|
while [ $retry_count -lt $max_retries ] && [ "$success" = false ]; do
|
||||||
|
# Call the login API
|
||||||
|
local response
|
||||||
|
response=$(curl -s -H "Accept: application/json" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{ \"Name\": \"${username}\", \"Password\": \"${password}\" }" \
|
||||||
|
"$login_url")
|
||||||
|
|
||||||
|
# Check if curl failed
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "${BoldRed}Error: Failed to connect to $login_url. Retrying in 5 seconds... (Attempt $((retry_count + 1)) of $max_retries)${NC}"
|
||||||
|
retry_count=$((retry_count + 1))
|
||||||
|
sleep 5
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract API key using jq
|
||||||
|
API_KEY=$(echo "$response" | jq -r '.api_key')
|
||||||
|
|
||||||
|
# Validate API key
|
||||||
|
if [[ -z "$API_KEY" || "$API_KEY" == "null" ]]; then
|
||||||
|
echo -e "${BoldRed}Error: Failed to retrieve API key. Retrying in 5 seconds... (Attempt $((retry_count + 1)) of $max_retries)${NC}"
|
||||||
|
retry_count=$((retry_count + 1))
|
||||||
|
sleep 5
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
success=true
|
||||||
|
echo -e "${BoldGreen}API Key retrieved successfully${NC}"
|
||||||
|
return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$success" = false ]; then
|
||||||
|
echo -e "${BoldRed}Error: Failed to retrieve API key after $max_retries attempts${NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to upload the RolePermission.xlsx file
|
||||||
|
upload_role_permission() {
|
||||||
|
local api_key="$1"
|
||||||
|
local login_url="${registry_url%/subscribers}/role_permissions/importxls"
|
||||||
|
# Validate if file exists
|
||||||
|
if [[ ! -f "$REGISTRY_FILE_PATH" ]]; then
|
||||||
|
echo -e "${BoldRed}Error: File $REGISTRY_FILE_PATH not found${NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
# Upload the file
|
||||||
|
local response
|
||||||
|
response=$(curl -s -w "%{http_code}" -o /dev/null -H "ApiKey:$api_key" \
|
||||||
|
-F "datafile=@${REGISTRY_FILE_PATH}" \
|
||||||
|
"$login_url")
|
||||||
|
|
||||||
|
# # Check if curl failed
|
||||||
|
if [ "$response" -ne 302 ]; then
|
||||||
|
echo -e "${BoldRed}Error: Failed to upload RolePermission.xlsx. HTTP Status: $response${NC}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo -e "${BoldGreen}RolePermission.xlsx uploaded successfully${NC}"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main Execution
|
||||||
|
REGISTRY_FILE_PATH=$SCRIPT_DIR/RolePermission.xlsx
|
||||||
|
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
registry_url=$1
|
||||||
|
else
|
||||||
|
registry_url="http://localhost:3030"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 1: Get the API key
|
||||||
|
if ! get_api_key "$USERNAME" "$PASSWORD"; then
|
||||||
|
echo -e "${BoldRed}Error: Role permission update failed. Please upload manually.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 2: Upload the file
|
||||||
|
if upload_role_permission "$API_KEY"; then
|
||||||
|
echo -e "${BoldGreen}Role permission updated in registry successfully.${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${BoldRed}Error: Role permission update failed.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
127
install/scripts/update_bap_config.sh
Executable file
127
install/scripts/update_bap_config.sh
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
#!/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
|
||||||
|
api_key=$5
|
||||||
|
np_domain=$6
|
||||||
|
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
|
||||||
|
|
||||||
|
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="${line%%=*}"
|
||||||
|
value="${line#*=}"
|
||||||
|
|
||||||
|
escaped_key=$(printf '%s\n' "$key" | sed 's/[]\/$*.^[]/\\&/g')
|
||||||
|
escaped_value=$(printf '%s\n' "$value" | sed 's/[&/]/\\&/g')
|
||||||
|
sed -i '' "s|$escaped_key|$escaped_value|g" "$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" "$api_key" "$np_domain"
|
||||||
135
install/scripts/update_bpp_config.sh
Executable file
135
install/scripts/update_bpp_config.sh
Executable file
@@ -0,0 +1,135 @@
|
|||||||
|
#!/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
|
||||||
|
api_key=$6
|
||||||
|
np_domain=$7
|
||||||
|
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
|
||||||
|
|
||||||
|
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="${line%%=*}"
|
||||||
|
value="${line#*=}"
|
||||||
|
|
||||||
|
escaped_key=$(printf '%s\n' "$key" | sed 's/[]\/$*.^[]/\\&/g')
|
||||||
|
escaped_value=$(printf '%s\n' "$value" | sed 's/[&/]/\\&/g')
|
||||||
|
|
||||||
|
sed -i '' "s|$escaped_key|$escaped_value|g" "$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" "$api_key" "$np_domain"
|
||||||
120
install/scripts/update_gateway_details.sh
Executable file
120
install/scripts/update_gateway_details.sh
Executable file
@@ -0,0 +1,120 @@
|
|||||||
|
#!/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
|
||||||
76
install/scripts/variables.sh
Executable file
76
install/scripts/variables.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Colour Code
|
||||||
|
RED=$(tput setaf 1)
|
||||||
|
GREEN=$(tput setaf 2)
|
||||||
|
YELLOW=$(tput setaf 3)
|
||||||
|
BLUE=$(tput setaf 4)
|
||||||
|
NC=$(tput sgr0)
|
||||||
|
|
||||||
|
# Bold Colour Code
|
||||||
|
BOLD=$(tput bold)
|
||||||
|
BoldGreen="${BOLD}$(tput setaf 2)"
|
||||||
|
BoldRed="${BOLD}$(tput setaf 1)"
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# Default registry and gateway username and password
|
||||||
|
USERNAME="root"
|
||||||
|
PASSWORD="root"
|
||||||
|
|
||||||
|
#NP Domain
|
||||||
|
np_domain=""
|
||||||
|
api_key=""
|
||||||
|
# Registry Role Permission file path
|
||||||
|
REGISTRY_FILE_PATH="../registry_data/RolePermission.xlsx"
|
||||||
|
|
||||||
|
#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"
|
||||||
|
|
||||||
|
layer2_url=""
|
||||||
|
schemas_path="/usr/src/app/schemas"
|
||||||
|
|
||||||
|
#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
|
||||||
7
install/uninstall.sh
Normal file
7
install/uninstall.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
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
|
||||||
|
docker compose -f docker-compose-gateway.yml down -v
|
||||||
|
docker compose -f docker-compose-registry.yml down -v
|
||||||
|
docker compose -f docker-compose-app.yml down -v
|
||||||
|
docker volume rm registry_data_volume registry_database_volume registry_logs_volume gateway_data_volume gateway_database_volume bap_client_config_volume bap_network_config_volume bpp_client_config_volume bpp_network_config_volume
|
||||||
251
setup.sh
251
setup.sh
@@ -17,22 +17,50 @@ if ! docker info > /dev/null 2>&1; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 1: Start all services with docker-compose
|
# Step 1: Run the Beckn network installer
|
||||||
echo -e "${YELLOW}Step 1: Starting all Beckn network services...${NC}"
|
echo -e "${YELLOW}Step 1: Setting up Beckn network services...${NC}"
|
||||||
docker compose down 2>/dev/null
|
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
# Wait for services to be ready
|
# Check if install directory exists
|
||||||
|
if [ ! -d "./install" ]; then
|
||||||
|
echo -e "${RED}Error: install directory not found.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make the installer executable
|
||||||
|
chmod +x ./install/beckn-onix.sh
|
||||||
|
|
||||||
|
# Navigate to install directory and run setup
|
||||||
|
cd install
|
||||||
|
|
||||||
|
# Auto-select option 3 (local setup) for the installer
|
||||||
|
echo -e "${GREEN}Running local network setup...${NC}"
|
||||||
|
echo "3" | ./beckn-onix.sh
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Wait for services to stabilize
|
||||||
echo -e "${YELLOW}Waiting for services to be ready...${NC}"
|
echo -e "${YELLOW}Waiting for services to be ready...${NC}"
|
||||||
sleep 10
|
sleep 15
|
||||||
|
|
||||||
# Step 2: Configure Vault
|
# Step 2: Configure Vault for key management
|
||||||
echo -e "${YELLOW}Step 2: Configuring Vault for key management...${NC}"
|
echo -e "${YELLOW}Step 2: Setting up Vault for key management...${NC}"
|
||||||
|
|
||||||
# Wait for Vault to be ready
|
# Check if Vault is running, if not start it
|
||||||
for i in {1..30}; do
|
if ! docker ps | grep -q "vault"; then
|
||||||
|
echo -e "${BLUE}Starting Vault container...${NC}"
|
||||||
|
docker run -d \
|
||||||
|
--name vault \
|
||||||
|
--cap-add=IPC_LOCK \
|
||||||
|
-e VAULT_DEV_ROOT_TOKEN_ID=root \
|
||||||
|
-e VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200 \
|
||||||
|
-p 8200:8200 \
|
||||||
|
hashicorp/vault:latest > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Wait for Vault to be ready
|
||||||
|
echo -e "${BLUE}Waiting for Vault to start...${NC}"
|
||||||
|
for i in {1..30}; do
|
||||||
if docker exec -e VAULT_ADDR=http://127.0.0.1:8200 vault vault status > /dev/null 2>&1; then
|
if docker exec -e VAULT_ADDR=http://127.0.0.1:8200 vault vault status > /dev/null 2>&1; then
|
||||||
echo -e "${GREEN}Vault is ready!${NC}"
|
echo -e "${GREEN}✓ Vault is ready${NC}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if [ $i -eq 30 ]; then
|
if [ $i -eq 30 ]; then
|
||||||
@@ -40,66 +68,193 @@ for i in {1..30}; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Configure Vault
|
# Configure Vault with error handling
|
||||||
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
echo -e "${BLUE}Configuring Vault policies...${NC}"
|
||||||
vault auth enable approle > /dev/null 2>&1 || true
|
|
||||||
|
|
||||||
|
# Enable AppRole auth
|
||||||
|
if ! docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
|
vault auth list 2>/dev/null | grep -q "approle"; then
|
||||||
|
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
|
vault auth enable approle 2>/dev/null || {
|
||||||
|
echo -e "${YELLOW}AppRole already enabled or error occurred${NC}"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create policy
|
||||||
echo 'path "beckn/*" { capabilities = ["create", "read", "update", "delete", "list"] }' | \
|
echo 'path "beckn/*" { capabilities = ["create", "read", "update", "delete", "list"] }' | \
|
||||||
docker exec -i -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
docker exec -i -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
vault policy write beckn-policy - > /dev/null 2>&1
|
vault policy write beckn-policy - > /dev/null 2>&1 || {
|
||||||
|
echo -e "${YELLOW}Policy already exists or updated${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create role
|
||||||
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
vault write auth/approle/role/beckn-role \
|
vault write auth/approle/role/beckn-role \
|
||||||
token_policies="beckn-policy" \
|
token_policies="beckn-policy" \
|
||||||
token_ttl=24h \
|
token_ttl=24h \
|
||||||
token_max_ttl=48h > /dev/null 2>&1
|
token_max_ttl=48h > /dev/null 2>&1 || {
|
||||||
|
echo -e "${YELLOW}Role already exists or updated${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
# Get credentials
|
# Get Vault credentials with error handling
|
||||||
|
echo -e "${BLUE}Getting Vault credentials...${NC}"
|
||||||
ROLE_ID=$(docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
ROLE_ID=$(docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
vault read -field=role_id auth/approle/role/beckn-role/role-id 2>/dev/null)
|
vault read -field=role_id auth/approle/role/beckn-role/role-id 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -z "$ROLE_ID" ]; then
|
||||||
|
echo -e "${RED}Error: Failed to get ROLE_ID from Vault${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
SECRET_ID=$(docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
SECRET_ID=$(docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
vault write -field=secret_id -f auth/approle/role/beckn-role/secret-id 2>/dev/null)
|
vault write -field=secret_id -f auth/approle/role/beckn-role/secret-id 2>/dev/null)
|
||||||
|
|
||||||
|
if [ -z "$SECRET_ID" ]; then
|
||||||
|
echo -e "${RED}Error: Failed to get SECRET_ID from Vault${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${GREEN}✓ Got Vault credentials:${NC}"
|
||||||
|
echo -e " ROLE_ID: ${ROLE_ID:0:20}..."
|
||||||
|
echo -e " SECRET_ID: ${SECRET_ID:0:20}..."
|
||||||
|
|
||||||
# Enable KV v2 secrets engine
|
# Enable KV v2 secrets engine
|
||||||
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
||||||
vault secrets enable -path=beckn kv-v2 > /dev/null 2>&1 || true
|
vault secrets enable -path=beckn kv-v2 > /dev/null 2>&1 || {
|
||||||
|
echo -e "${YELLOW}Secrets engine already enabled${NC}"
|
||||||
|
}
|
||||||
|
|
||||||
# Store sample keys
|
echo -e "${GREEN}✓ Vault configured successfully${NC}"
|
||||||
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
|
||||||
vault kv put beckn/keys/bap \
|
|
||||||
private_key='sample_bap_private_key' \
|
|
||||||
public_key='sample_bap_public_key' > /dev/null 2>&1
|
|
||||||
|
|
||||||
docker exec -e VAULT_ADDR=http://127.0.0.1:8200 -e VAULT_TOKEN=root vault \
|
# Step 3: Check services status
|
||||||
vault kv put beckn/keys/bpp \
|
echo -e "${YELLOW}Step 3: Checking services status...${NC}"
|
||||||
private_key='sample_bpp_private_key' \
|
|
||||||
public_key='sample_bpp_public_key' > /dev/null 2>&1
|
# Check if services are running
|
||||||
|
if docker ps | grep -q "registry"; then
|
||||||
|
echo -e "${GREEN}✓ Registry is running${NC}"
|
||||||
|
fi
|
||||||
|
if docker ps | grep -q "gateway"; then
|
||||||
|
echo -e "${GREEN}✓ Gateway is running${NC}"
|
||||||
|
fi
|
||||||
|
if docker ps | grep -q "bap-client"; then
|
||||||
|
echo -e "${GREEN}✓ BAP services are running${NC}"
|
||||||
|
fi
|
||||||
|
if docker ps | grep -q "bpp-client"; then
|
||||||
|
echo -e "${GREEN}✓ BPP services are running${NC}"
|
||||||
|
fi
|
||||||
|
if docker ps | grep -q "vault"; then
|
||||||
|
echo -e "${GREEN}✓ Vault is running${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 4: Create required directories
|
||||||
|
echo -e "${YELLOW}Step 4: Creating required directories...${NC}"
|
||||||
|
|
||||||
|
# Create schemas directory for validation
|
||||||
|
if [ ! -d "schemas" ]; then
|
||||||
|
mkdir -p schemas
|
||||||
|
echo -e "${GREEN}✓ Created schemas directory${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}schemas directory already exists${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create logs directory
|
||||||
|
if [ ! -d "logs" ]; then
|
||||||
|
mkdir -p logs
|
||||||
|
echo -e "${GREEN}✓ Created logs directory${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}logs directory already exists${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create plugins directory if not exists
|
||||||
|
if [ ! -d "plugins" ]; then
|
||||||
|
mkdir -p plugins
|
||||||
|
echo -e "${GREEN}✓ Created plugins directory${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}plugins directory already exists${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 5: Build adapter plugins
|
||||||
|
echo -e "${YELLOW}Step 5: Building adapter plugins...${NC}"
|
||||||
|
|
||||||
# Step 3: Build plugins
|
|
||||||
echo -e "${YELLOW}Step 3: Building plugins...${NC}"
|
|
||||||
if [ -f "./build-plugins.sh" ]; then
|
if [ -f "./build-plugins.sh" ]; then
|
||||||
chmod +x ./build-plugins.sh
|
chmod +x ./build-plugins.sh
|
||||||
./build-plugins.sh
|
./build-plugins.sh
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}✓ Plugins built successfully${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error: Plugin build failed${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${RED}Warning: build-plugins.sh not found. Please build plugins manually.${NC}"
|
echo -e "${RED}Error: build-plugins.sh not found${NC}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 4: Build server
|
# Step 6: Build the adapter server
|
||||||
echo -e "${YELLOW}Step 4: Building Beckn-ONIX server...${NC}"
|
echo -e "${YELLOW}Step 6: Building Beckn-ONIX adapter server...${NC}"
|
||||||
go build -o server cmd/adapter/main.go
|
|
||||||
|
|
||||||
# Create .env.vault file
|
if [ -f "go.mod" ]; then
|
||||||
echo -e "${YELLOW}Step 5: Creating environment file...${NC}"
|
go build -o beckn-adapter cmd/adapter/main.go
|
||||||
cat > .env.vault <<EOF
|
if [ $? -eq 0 ]; then
|
||||||
# Vault Credentials for Beckn-ONIX
|
echo -e "${GREEN}✓ Adapter server built successfully${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error: Failed to build adapter server${NC}"
|
||||||
|
echo -e "${YELLOW}Please check Go installation and dependencies${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error: go.mod not found${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 7: Create environment file
|
||||||
|
echo -e "${YELLOW}Step 7: Creating environment configuration...${NC}"
|
||||||
|
|
||||||
|
# Check if we have Vault credentials
|
||||||
|
if [ -z "$ROLE_ID" ] || [ -z "$SECRET_ID" ]; then
|
||||||
|
echo -e "${RED}Error: Vault credentials not available${NC}"
|
||||||
|
echo -e "${YELLOW}Please check Vault configuration and try again${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > .env <<EOF
|
||||||
|
# Beckn-ONIX Environment Configuration
|
||||||
# Generated on $(date)
|
# Generated on $(date)
|
||||||
|
|
||||||
|
# Service URLs
|
||||||
|
export REGISTRY_URL=http://localhost:3000
|
||||||
|
export GATEWAY_URL=http://localhost:4000
|
||||||
|
export BAP_CLIENT_URL=http://localhost:5001
|
||||||
|
export BAP_NETWORK_URL=http://localhost:5002
|
||||||
|
export BPP_CLIENT_URL=http://localhost:6001
|
||||||
|
export BPP_NETWORK_URL=http://localhost:6002
|
||||||
|
export REDIS_URL=localhost:6379
|
||||||
|
export MONGO_URL=mongodb://localhost:27017
|
||||||
|
|
||||||
|
# Adapter Configuration
|
||||||
|
export ADAPTER_PORT=8080
|
||||||
|
export ADAPTER_MODE=development
|
||||||
|
|
||||||
|
# Vault Configuration
|
||||||
|
export VAULT_ADDR=http://localhost:8200
|
||||||
|
export VAULT_TOKEN=root
|
||||||
export VAULT_ROLE_ID=$ROLE_ID
|
export VAULT_ROLE_ID=$ROLE_ID
|
||||||
export VAULT_SECRET_ID=$SECRET_ID
|
export VAULT_SECRET_ID=$SECRET_ID
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Display status
|
if [ -f ".env" ]; then
|
||||||
|
echo -e "${GREEN}✓ Environment file created successfully${NC}"
|
||||||
|
echo -e "${YELLOW} Vault ROLE_ID and SECRET_ID have been saved to .env${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error: Failed to create .env file${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Display final status
|
||||||
|
echo ""
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
echo -e "${GREEN}✅ Setup Complete!${NC}"
|
echo -e "${GREEN}✅ Setup Complete!${NC}"
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
@@ -111,15 +266,19 @@ echo -e " 🛒 BAP Client: http://localhost:5001"
|
|||||||
echo -e " 🛒 BAP Network: http://localhost:5002"
|
echo -e " 🛒 BAP Network: http://localhost:5002"
|
||||||
echo -e " 🏪 BPP Client: http://localhost:6001"
|
echo -e " 🏪 BPP Client: http://localhost:6001"
|
||||||
echo -e " 🏪 BPP Network: http://localhost:6002"
|
echo -e " 🏪 BPP Network: http://localhost:6002"
|
||||||
echo -e " 🔐 Vault UI: http://localhost:8200 (token: root)"
|
|
||||||
echo -e " 💾 Redis: localhost:6379"
|
echo -e " 💾 Redis: localhost:6379"
|
||||||
|
echo -e " 🗄️ MongoDB: localhost:27017"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}To run the Beckn-ONIX server:${NC}"
|
echo -e "${GREEN}Next Steps:${NC}"
|
||||||
echo " source .env.vault && ./server --config=config/local-dev.yaml"
|
echo -e "1. Run the adapter:"
|
||||||
|
echo -e " ${YELLOW}source .env && ./beckn-adapter --config=config/local-dev.yaml${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}To stop all services:${NC}"
|
echo -e "2. Test the endpoints:"
|
||||||
echo " docker compose down"
|
echo -e " ${YELLOW}./test_endpoints.sh${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${GREEN}To view logs:${NC}"
|
echo -e "3. Stop all services:"
|
||||||
echo " docker compose logs -f [service-name]"
|
echo -e " ${YELLOW}cd install && docker compose down${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "4. View logs:"
|
||||||
|
echo -e " ${YELLOW}cd install && docker compose logs -f [service-name]${NC}"
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
Reference in New Issue
Block a user