Merge pull request #78 from beckn/remove_old
Fixes #3 Remove old shell scripts
This commit is contained in:
@@ -1,112 +0,0 @@
|
||||
#!/bin/bash
|
||||
source ./scripts/variables.sh
|
||||
source ./scripts/get_container_details.sh
|
||||
|
||||
#below function will start specifice service inside docker-compose file
|
||||
start_container(){
|
||||
echo "$1"
|
||||
docker-compose up -d $1
|
||||
|
||||
}
|
||||
|
||||
#below function will start the MongoDB, Redis and RabbitMQ Services.
|
||||
start_support_services(){
|
||||
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"
|
||||
}
|
||||
# Main script starts here
|
||||
text="
|
||||
Welcome to Beckn-ONIX!
|
||||
The following components will be installed
|
||||
|
||||
1. MongoDB, RabbitMQ and Redis
|
||||
2. Registry
|
||||
3. Gateway
|
||||
4. Sandbox
|
||||
5. Sandbox Webhook
|
||||
6. Protocol Server for BAP
|
||||
7. Protocol Server for BPP
|
||||
"
|
||||
echo "$text"
|
||||
sleep 5
|
||||
echo "${GREEN}................Installing required packages................${NC}"
|
||||
./scripts/package_manager.sh
|
||||
echo "Package Installation is done"
|
||||
|
||||
export COMPOSE_IGNORE_ORPHANS=1
|
||||
|
||||
echo "${GREEN}................Installing Registry service................${NC}"
|
||||
start_container registry
|
||||
sleep 10
|
||||
echo "Registry installation successful"
|
||||
sleep 5
|
||||
./scripts/update_gateway_details.sh registry
|
||||
echo "${GREEN}................Installing Gateway service................${NC}"
|
||||
start_container gateway
|
||||
echo "Registering Gateway in the registry"
|
||||
sleep 5
|
||||
./scripts/register_gateway.sh
|
||||
echo " "
|
||||
echo "Gateway installation successful"
|
||||
|
||||
#Start the MongoDB, Redis and RabbitMQ Services.
|
||||
start_support_services
|
||||
sleep 10
|
||||
|
||||
echo "${GREEN}................Installing Protocol Server for BAP................${NC}"
|
||||
./scripts/update_bap_config.sh
|
||||
sleep 10
|
||||
start_container "bap-client"
|
||||
start_container "bap-network"
|
||||
sleep 10
|
||||
echo "Protocol server BAP installation successful"
|
||||
|
||||
echo "${GREEN}................Installing Sandbox................${NC}"
|
||||
start_container "sandbox-api"
|
||||
sleep 5
|
||||
echo "Sandbox installation successful"
|
||||
|
||||
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
|
||||
bash scripts/update_bpp_config.sh
|
||||
sleep 10
|
||||
start_container "bpp-client"
|
||||
start_container "bpp-network"
|
||||
sleep 10
|
||||
echo "Protocol server BPP installation successful"
|
||||
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
ip=localhost
|
||||
bap_network_ip=$ip
|
||||
bap_client_ip=$ip
|
||||
bpp_network_ip=$ip
|
||||
bap_network_ip=$ip
|
||||
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
|
||||
ip=$(hostname -I | awk '{print $1}')
|
||||
bap_network_ip=$ip
|
||||
bap_client_ip=$ip
|
||||
bpp_network_ip=$ip
|
||||
bap_network_ip=$ip
|
||||
else
|
||||
bap_network_ip=$(get_container_ip bap-network)
|
||||
bap_client_ip=$(get_container_ip bap-client)
|
||||
bpp_network_ip=$(get_container_ip bpp-network)
|
||||
bap_network_ip=$(get_container_ip bpp-client)
|
||||
fi
|
||||
|
||||
echo " "
|
||||
echo "##########################################################"
|
||||
echo "${GREEN}Please find below details of protocol server which required in postman collection${NC}"
|
||||
echo "BASE_URL=http://$bap_client_ip:$bap_client_port/"
|
||||
echo "BAP_ID=$bap_subscriber_id"
|
||||
echo "BAP_URI=http://$bap_network_ip:$bap_network_port/"
|
||||
echo "BPP_ID=$bpp_subscriber_id"
|
||||
echo "BPP_URI=http://$bpp_network_ip:$bpp_network_port/"
|
||||
@@ -1,314 +0,0 @@
|
||||
#!/bin/bash
|
||||
source scripts/variables.sh
|
||||
source scripts/get_container_details.sh
|
||||
|
||||
# Function to start a specific service inside docker-compose file
|
||||
install_package(){
|
||||
echo "${GREEN}................Installing required packages................${NC}"
|
||||
bash scripts/package_manager.sh
|
||||
echo "Package Installation is done"
|
||||
|
||||
}
|
||||
start_container(){
|
||||
#ignore orphaned containers warning
|
||||
export COMPOSE_IGNORE_ORPHANS=1
|
||||
docker compose -f $1 up -d $2
|
||||
}
|
||||
|
||||
update_registry_details() {
|
||||
if [[ $1 ]];then
|
||||
if [[ $1 == https://* ]]; then
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
registry_url=$(echo "$1" | sed -E 's/https:\/\///')
|
||||
else
|
||||
registry_url=$(echo "$1" | sed 's/https:\/\///')
|
||||
fi
|
||||
registry_port=443
|
||||
protocol=https
|
||||
elif [[ $1 == http://* ]]; then
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
registry_url=$(echo "$1" | sed -E 's/http:\/\///')
|
||||
else
|
||||
registry_url=$(echo "$1" | sed 's/http:\/\///')
|
||||
fi
|
||||
registry_port=80
|
||||
protocol=http
|
||||
fi
|
||||
|
||||
else
|
||||
registry_url=registry
|
||||
registry_port=3030
|
||||
protocol=http
|
||||
fi
|
||||
echo $registry_url
|
||||
cp $SCRIPT_DIR/../registry_data/config/swf.properties-sample $SCRIPT_DIR/../registry_data/config/swf.properties
|
||||
config_file="$SCRIPT_DIR/../registry_data/config/swf.properties"
|
||||
|
||||
tmp_file=$(mktemp "tempfile.XXXXXXXXXX")
|
||||
sed "s|REGISTRY_URL|$registry_url|g; s|REGISTRY_PORT|$registry_port|g; s|PROTOCOL|$protocol|g" "$config_file" > "$tmp_file"
|
||||
mv "$tmp_file" "$config_file"
|
||||
|
||||
}
|
||||
# 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 registry
|
||||
fi
|
||||
echo "${GREEN}................Installing Gateway service................${NC}"
|
||||
start_container $gateway_docker_compose_file gateway
|
||||
echo "Registering Gateway in the registry"
|
||||
|
||||
sleep 10
|
||||
if [[ $1 && $2 ]]; then
|
||||
bash scripts/register_gateway.sh $2
|
||||
else
|
||||
bash scripts/register_gateway.sh
|
||||
fi
|
||||
echo " "
|
||||
echo "Gateway installation successful"
|
||||
}
|
||||
|
||||
# Function to install Beckn Gateway and Beckn Registry
|
||||
install_registry(){
|
||||
if [[ $1 ]]; then
|
||||
update_registry_details $1
|
||||
else
|
||||
update_registry_details
|
||||
fi
|
||||
|
||||
echo "${GREEN}................Installing Registry service................${NC}"
|
||||
start_container $registry_docker_compose_file registry
|
||||
sleep 10
|
||||
echo "Registry installation successful"
|
||||
}
|
||||
|
||||
# Function to install BAP Protocol Server
|
||||
install_bap_protocol_server(){
|
||||
start_support_services
|
||||
if [[ $1 ]];then
|
||||
registry_url=$1
|
||||
bap_subscriber_id=$2
|
||||
bap_subscriber_key_id=$3
|
||||
bap_subscriber_url=$4
|
||||
bash scripts/update_bap_config.sh $registry_url $bap_subscriber_id $bap_subscriber_key_id $bap_subscriber_url
|
||||
else
|
||||
bash scripts/update_bap_config.sh
|
||||
fi
|
||||
sleep 10
|
||||
start_container $bap_docker_compose_file "bap-client"
|
||||
start_container $bap_docker_compose_file "bap-network"
|
||||
sleep 10
|
||||
echo "Protocol server BAP installation successful"
|
||||
}
|
||||
|
||||
# Function to install BPP Protocol Server with BPP Sandbox
|
||||
install_bpp_protocol_server_with_sandbox(){
|
||||
start_support_services
|
||||
echo "${GREEN}................Installing Sandbox................${NC}"
|
||||
start_container $bpp_docker_compose_file_sandbox "sandbox-api"
|
||||
sleep 5
|
||||
echo "Sandbox installation successful"
|
||||
|
||||
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
|
||||
|
||||
if [[ $1 ]];then
|
||||
registry_url=$1
|
||||
bpp_subscriber_id=$2
|
||||
bpp_subscriber_key_id=$3
|
||||
bpp_subscriber_url=$4
|
||||
webhook_url=$5
|
||||
bash scripts/update_bpp_config.sh $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||
else
|
||||
bash scripts/update_bpp_config.sh
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
start_container $bpp_docker_compose_file_sandbox "bpp-client"
|
||||
start_container $bpp_docker_compose_file_sandbox "bpp-network"
|
||||
sleep 10
|
||||
echo "Protocol server BPP installation successful"
|
||||
}
|
||||
|
||||
# Function to install BPP Protocol Server without Sandbox
|
||||
install_bpp_protocol_server(){
|
||||
start_support_services
|
||||
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
|
||||
|
||||
if [[ $1 ]];then
|
||||
registry_url=$1
|
||||
bpp_subscriber_id=$2
|
||||
bpp_subscriber_key_id=$3
|
||||
bpp_subscriber_url=$4
|
||||
webhook_url=$5
|
||||
bash scripts/update_bpp_config.sh $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||
else
|
||||
bash scripts/update_bpp_config.sh
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
start_container $bpp_docker_compose_file "bpp-client"
|
||||
start_container $bpp_docker_compose_file "bpp-network"
|
||||
sleep 10
|
||||
echo "Protocol server BPP installation successful"
|
||||
}
|
||||
|
||||
text="
|
||||
The following components will be installed
|
||||
|
||||
1. Registry
|
||||
2. Gateway
|
||||
3. Sandbox
|
||||
4. Sandbox Webhook
|
||||
5. Protocol Server for BAP
|
||||
6. Protocol Server for BPP
|
||||
"
|
||||
|
||||
# Main script starts here
|
||||
bash scripts/banner.sh
|
||||
echo "Welcome to Beckn-ONIX"
|
||||
echo "$text"
|
||||
|
||||
read -p "${GREEN}Do you want to install all the components on the local system? (Y/n): ${NC}" install_all
|
||||
|
||||
if [[ $install_all =~ ^[Yy]$ ]]; then
|
||||
# Install and bring up everything
|
||||
install_package
|
||||
install_registry
|
||||
install_gateway
|
||||
start_support_services
|
||||
install_bap_protocol_server
|
||||
install_bpp_protocol_server_with_sandbox
|
||||
else
|
||||
# User selects specific components to install
|
||||
echo "Please select the components that you want to install"
|
||||
echo "1. Beckn Registry"
|
||||
echo "2. Beckn Gateway"
|
||||
echo "3. BAP Protocol Server"
|
||||
echo "4. BPP Protocol Server with BPP Sandbox"
|
||||
echo "5. BPP Protocol Server"
|
||||
echo "6. Generic Client Layer"
|
||||
echo "7. Exit"
|
||||
|
||||
read -p "Enter your choice (1-6): " user_choice
|
||||
|
||||
case $user_choice in
|
||||
1)
|
||||
echo "${GREEN}Default Registry URL: $registry_url"
|
||||
read -p "Do you want to change Registry URL? (Y/N): ${NC}" change_url
|
||||
if [[ $change_url =~ ^[Yy]$ ]]; then
|
||||
read -p "Enter publicly accessible registry URL: " registry_url
|
||||
|
||||
if [[ $registry_url =~ /$ ]]; then
|
||||
new_registry_url=${registry_url%/}
|
||||
else
|
||||
new_registry_url=$registry_url
|
||||
fi
|
||||
|
||||
install_package
|
||||
install_registry $new_registry_url
|
||||
#install_gateway $new_registry_url $gateway_url
|
||||
|
||||
else
|
||||
install_package
|
||||
install_registry
|
||||
#install_gateway
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
echo "${GREEN}Default Registry URL: $registry_url"
|
||||
echo "Default Gateway URL will be docker URL"
|
||||
read -p "Do you want to change Registry and Gateway URL? (Y/N): ${NC}" change_url
|
||||
if [[ $change_url =~ ^[Yy]$ ]]; then
|
||||
read -p "Enter publicly accessible registry URL: " registry_url
|
||||
read -p "Enter publicly accessible gateway URL: " gateway_url
|
||||
|
||||
if [[ $registry_url =~ /$ ]]; then
|
||||
new_registry_url=${registry_url%/}
|
||||
else
|
||||
new_registry_url=$registry_url
|
||||
fi
|
||||
if [[ $gateway_url =~ /$ ]]; then
|
||||
gateway_url=${gateway_url%/}
|
||||
fi
|
||||
|
||||
install_package
|
||||
install_gateway $new_registry_url $gateway_url
|
||||
|
||||
else
|
||||
install_package
|
||||
install_gateway
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
echo "${GREEN}................Installing Protocol Server for BAP................${NC}"
|
||||
|
||||
read -p "Enter BAP Subscriber ID: " bap_subscriber_id
|
||||
read -p "Enter BAP Subscriber URL: " bap_subscriber_url
|
||||
# Ask the user if they want to change the registry_url
|
||||
read -p "Do you want to change the registry_url? (${GREEN}Press Enter to accept default: $beckn_registry_url${NC}): " custom_registry_url
|
||||
registry_url=${custom_registry_url:-$beckn_registry_url}
|
||||
bap_subscriber_key_id=$bap_subscriber_id-key
|
||||
install_package
|
||||
install_bap_protocol_server $registry_url $bap_subscriber_id $bap_subscriber_key_id $bap_subscriber_url
|
||||
;;
|
||||
4)
|
||||
read -p "Enter BPP Subscriber ID: " bpp_subscriber_id
|
||||
read -p "Enter BPP Subscriber URL: " bpp_subscriber_url
|
||||
read -p "Enter Webhook URL: " webhook_url
|
||||
# Ask the user if they want to change the registry_url
|
||||
read -p "Do you want to change the registry_url? (${GREEN}Press Enter to accept default: $beckn_registry_url${NC}): " custom_registry_url
|
||||
registry_url=${custom_registry_url:-$beckn_registry_url}
|
||||
bpp_subscriber_key_id=$bpp_subscriber_id-key
|
||||
install_package
|
||||
install_bpp_protocol_server_with_sandbox $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||
;;
|
||||
5)
|
||||
read -p "Enter BPP Subscriber ID: " bpp_subscriber_id
|
||||
read -p "Enter BPP Subscriber URL: " bpp_subscriber_url
|
||||
read -p "Enter Webhook URL: " webhook_url
|
||||
|
||||
# Ask the user if they want to change the registry_url
|
||||
read -p "Do you want to change the registry_url? (${GREEN}Press Enter to accept default: $beckn_registry_url${NC}): " custom_registry_url
|
||||
registry_url=${custom_registry_url:-$beckn_registry_url}
|
||||
bpp_subscriber_key_id=$bpp_subscriber_id-key
|
||||
install_package
|
||||
install_bpp_protocol_server $registry_url $bpp_subscriber_id $bpp_subscriber_key_id $bpp_subscriber_url $webhook_url
|
||||
;;
|
||||
|
||||
6)
|
||||
echo "${GREEN}................Installing GENERIC CLIENT LAYER................${NC}"
|
||||
read -p "Enter BAP Subscriber ID: " bap_subscriber_id
|
||||
read -p "Enter BAP Subscriber URL: " bap_subscriber_url
|
||||
read -p "Enter BAP Client URL: " bap_client_url
|
||||
bash scripts/generic-client-layer.sh $bap_subscriber_id $bap_subscriber_url $bap_client_url
|
||||
start_container $gcl_docker_compose_file "generic-client-layer"
|
||||
;;
|
||||
|
||||
7)
|
||||
echo "Exiting Beckn-ONIX"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid choice. Exiting Beckn-ONIX."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
Binary file not shown.
Reference in New Issue
Block a user