Merge pull request #75 from beckn/local

Local
This commit is contained in:
Venkatesh Babu
2024-05-10 19:07:48 +05:30
committed by GitHub
14 changed files with 2261 additions and 101 deletions

View File

@@ -38,6 +38,7 @@ Experience the convenience and efficiency of Beckn-ONIX as you embark on your jo
- The GUI installer needs Node, NPM and LocalTunnel to be installed before starting.
### Release date
2024-05-06
## Beckn-ONIX Version 0.3.0 (2024-03-20)
@@ -66,7 +67,7 @@ Experience the convenience and efficiency of Beckn-ONIX as you embark on your jo
### Limitations
- The beckn-onix.sh installer used for multi node. For single node installation the start_beckn.sh file has to be used.
- The beckn-onix.sh installer used for multi node. For single node installation the start_beckn.sh file has to be used. (This is not true anymore. The beckn-onix.sh has an option to install all components on a single machine)
### Upcoming Version

View File

@@ -46,6 +46,13 @@ Docker compose and docker are extensively used in the installation and running o
- Atleast four virtual servers (EC2 instances) configured on the cloud provider with administrator login (e.g. ssh access) to them.
- Access to domain name management with ability to create domain-name/subdomains for each of the components.
- Run the following two commands on all machines where the script is being run for the first time. Login to a new shell for the command to take effect and continue with the installation. Not doing so will result in docker permisssion error
```
sudo groupadd docker
sudo usermod -aG docker $USER
```
- Each of the various sections below list additional pre-requisites which build on these.
### Setting up a new network - Registry
@@ -233,7 +240,7 @@ Refer to the [core specification](https://github.com/beckn/protocol-specificatio
## Running Beckn-ONIX locally
- In order for people new to Beckn who want to try out Beckn on their own machine, a simple one click installer has been written. Currently it can be installed by running the `start_beckn.sh` script present in the installfolder. In the next release, this will be integrated with the main script and the `start_beckn.sh` script deprecated. An all in one installation has preconfigured values for variables and so pretty much does not ask for any input.
- In order for people new to Beckn who want to try out Beckn on their own machine, choose the option to "Set up a network on your local machine" in the main screen. The all in one installation has preconfigured values for variables and so pretty much does not ask for any input.
## Appendix A - Registering or adding domain or subdomains

2
install/ENV/.env-sandbox Normal file
View File

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

View File

@@ -73,13 +73,7 @@ This shell script, `start_beckn_v2.sh`, automates the setup of Beckn components,
./start_container "sandbox-api"
```
7. **Install Webhook:**
```bash
./start_container "sandbox-webhook"
```
8. **Install Protocol Server for BPP:**
7. **Install Protocol Server for BPP:**
```bash
./update_bpp_config.sh

View File

@@ -73,7 +73,7 @@ install_gateway() {
if [[ $1 && $2 ]]; then
bash scripts/update_gateway_details.sh $1 $2
else
bash scripts/update_gateway_details.sh registry
bash scripts/update_gateway_details.sh http://registry:3030
fi
echo "${GREEN}................Installing Gateway service................${NC}"
start_container $gateway_docker_compose_file gateway
@@ -162,24 +162,44 @@ install_bpp_protocol_server(){
echo "Protocol server BPP installation successful"
}
# 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"
# MAIN SCRIPT STARTS HERE
#!/bin/bash
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
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
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
echo "Beckn-ONIX is a platform that helps you quickly launch and configure beckn-enabled networks."
echo -e "\nWhat would you like to do?\n1. Join an existing network\n2. Create new production network\n3. Set up a network on your local machine\n4. Merge multiple networks\n5. Configure Existing Network\n(Press Ctrl+C to exit)"
read -p "Enter your choice: " choice
start_container $bpp_docker_compose_file "bpp-client"
start_container $bpp_docker_compose_file "bpp-network"
sleep 10
echo "Protocol server BPP installation successful"
}
boldGreen="\e[1m\e[92m"
reset="\e[0m"
# Function to handle the setup process for each platform
completeSetup() {
@@ -254,25 +274,51 @@ completeSetup() {
# Key generation and subscription logic follows here
}
# Determine the platforms available based on the initial choice
platforms=("Gateway" "BAP" "BPP")
[ "$choice" -eq 2 ] && platforms=("Registry" "${platforms[@]}") # Add Registry for new network setups
echo "Great choice! Get ready."
echo -e "\nWhich platform would you like to set up?"
for i in "${!platforms[@]}"; do
echo "$((i+1)). ${platforms[$i]}"
done
# MAIN SCRIPT STARTS HERE
read -p "Enter your choice: " platform_choice
selected_platform="${platforms[$((platform_choice-1))]}"
if [[ -n $selected_platform ]]; then
completeSetup "$selected_platform"
echo "Welcome to Beckn-ONIX!"
if [ -f ./onix_ascii_art.txt ]; then
cat ./onix_ascii_art.txt
else
echo "Invalid option. Please restart the script and select a valid option."
exit 1
echo "[Display Beckn-ONIX ASCII Art]"
fi
echo "Beckn-ONIX is a platform that helps you quickly launch and configure beckn-enabled networks."
echo -e "\nWhat would you like to do?\n1. Join an existing network\n2. Create new production network\n3. Set up a network on your local machine\n4. Merge multiple networks\n5. Configure Existing Network\n(Press Ctrl+C to exit)"
read -p "Enter your choice: " choice
boldGreen="\e[1m\e[92m"
reset="\e[0m"
if [[ $choice -eq 3 ]]; then
echo "Installing all components on the local machine"
install_package
install_registry
install_gateway
install_bap_protocol_server
install_bpp_protocol_server_with_sandbox
else
# Determine the platforms available based on the initial choice
platforms=("Gateway" "BAP" "BPP")
[ "$choice" -eq 2 ] && platforms=("Registry" "${platforms[@]}") # Add Registry for new network setups
echo "Great choice! Get ready."
echo -e "\nWhich platform would you like to set up?"
for i in "${!platforms[@]}"; do
echo "$((i+1)). ${platforms[$i]}"
done
read -p "Enter your choice: " platform_choice
selected_platform="${platforms[$((platform_choice-1))]}"
if [[ -n $selected_platform ]]; then
completeSetup "$selected_platform"
else
echo "Invalid option. Please restart the script and select a valid option."
exit 1
fi
fi
echo "Process complete. Thank you for using Beckn-ONIX!"

View File

@@ -25,7 +25,6 @@ services:
- 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
@@ -34,19 +33,8 @@ services:
ports:
- 4010:4000
restart: unless-stopped
sandbox-webhook:
image: fidedocker/sandbox-webhook-api
depends_on:
- sandbox-api
container_name: sandbox-webhook
networks:
- beckn_network
ports:
- 3005:3005
restart: unless-stopped
volumes:
- ./ENV/.env-webhook:/usr/src/app/.env
- ./ENV/.env-sandbox:/usr/src/app/.env
networks:
beckn_network:

View File

@@ -55,19 +55,8 @@ services:
ports:
- 4010:4000
restart: unless-stopped
sandbox-webhook:
image: fidedocker/sandbox-webhook-api
depends_on:
- sandbox-api
container_name: sandbox-webhook
networks:
- beckn_network
ports:
- 3005:3005
restart: unless-stopped
volumes:
- ./ENV/.env-webhook:/usr/src/app/.env
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server

View File

@@ -55,19 +55,8 @@ services:
ports:
- 4010:4000
restart: unless-stopped
sandbox-webhook:
image: fidedocker/sandbox-webhook-api
depends_on:
- sandbox-api
container_name: sandbox-webhook
networks:
- beckn_network
ports:
- 3005:3005
restart: unless-stopped
volumes:
- ./ENV/.env-webhook:/usr/src/app/.env
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server

View File

@@ -66,21 +66,8 @@ services:
ports:
- 4010:4000
restart: unless-stopped
sandbox-webhook:
image: fidedocker/sandbox-webhook-api
depends_on:
- registry
- gateway
- sandbox-api
container_name: sandbox-webhook
networks:
- beckn_network
ports:
- 3005:3005
restart: unless-stopped
volumes:
- ./ENV/.env-webhook:/usr/src/app/.env
- ./ENV/.env-sandbox:/usr/src/app/.env
bpp-client:
image: fidedocker/protocol-server

View File

@@ -90,6 +90,9 @@ if [[ $1 ]]; then
registry_id=$(echo "$1" | sed 's/http:\/\///')
fi
fi
if [[ $registry_id = "registry:3030" ]]; then
registry_id="registry"
fi
fi
if [[ $2 ]]; then

View File

@@ -50,7 +50,7 @@ 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-webhook:3005"
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

View File

@@ -75,11 +75,6 @@ start_container "sandbox-api"
sleep 5
echo "Sandbox installation successful"
echo "${GREEN}................Installing Webhook................${NC}"
start_container "sandbox-webhook"
sleep
echo "Webhook installation successful"
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
bash scripts/update_bpp_config.sh
sleep 10

View File

@@ -127,11 +127,6 @@ install_bpp_protocol_server_with_sandbox(){
sleep 5
echo "Sandbox installation successful"
echo "${GREEN}................Installing Webhook................${NC}"
start_container $bpp_docker_compose_file_sandbox "sandbox-webhook"
sleep 5
echo "Webhook installation successful"
echo "${GREEN}................Installing Protocol Server for BPP................${NC}"
if [[ $1 ]];then

File diff suppressed because it is too large Load Diff