Merge pull request #536 from Beckn-One/533-dockerfixes
Issue 535 - merge docker compose file and update scripts ,docs
This commit is contained in:
@@ -205,7 +205,7 @@ This automated script will:
|
|||||||
- Start ONIX adapter in Docker
|
- Start ONIX adapter in Docker
|
||||||
- Create environment configuration
|
- Create environment configuration
|
||||||
|
|
||||||
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image ,update docker-compose-adapter2.yaml to use the correct image
|
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image if required ,update docker-compose-adapter.yaml to use the correct onix image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# from the repository root
|
# from the repository root
|
||||||
|
|||||||
12
SETUP.md
12
SETUP.md
@@ -88,7 +88,7 @@ This will automatically:
|
|||||||
|
|
||||||
**Key Management:** Uses `simplekeymanager` with embedded keys - no Vault setup required!
|
**Key Management:** Uses `simplekeymanager` with embedded keys - no Vault setup required!
|
||||||
|
|
||||||
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image ,update docker-compose-adapter2.yaml to use the correct image
|
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated setup, build the adapter image ,update docker-compose-adapter.yaml to use the correct image (optional)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# from the repository root
|
# from the repository root
|
||||||
@@ -113,7 +113,7 @@ This will automatically:
|
|||||||
- Create BAP Protocol Server registry entries
|
- Create BAP Protocol Server registry entries
|
||||||
- Create BPP Protocol Server registry entries
|
- Create BPP Protocol Server registry entries
|
||||||
- Build ONIX adapter plugins
|
- Build ONIX adapter plugins
|
||||||
- **Detect config file** from `docker-compose-adapter2.yml`
|
- **Detect config file** from `docker-compose-adapter.yml`
|
||||||
- **Extract keys** from protocol server configs (`bap-client.yml`, `bpp-client.yml`)
|
- **Extract keys** from protocol server configs (`bap-client.yml`, `bpp-client.yml`)
|
||||||
- **Auto-update simplekeymanager** in the detected config file with extracted keys
|
- **Auto-update simplekeymanager** in the detected config file with extracted keys
|
||||||
- Start ONIX Adapter with Redis
|
- Start ONIX Adapter with Redis
|
||||||
@@ -125,7 +125,7 @@ This will automatically:
|
|||||||
- ONIX Adapter: http://localhost:8081
|
- ONIX Adapter: http://localhost:8081
|
||||||
- Redis: localhost:6379
|
- Redis: localhost:6379
|
||||||
|
|
||||||
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated full-network setup, build the adapter image , update docker-compose-adapter2.yaml to use the correct image
|
**Note:** Extract schemas before running: `unzip schemas.zip` (required for schema validation) and before running the automated full-network setup, build the adapter image , update docker-compose-adapter.yaml to use the correct image(optional)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# from the repository root
|
# from the repository root
|
||||||
@@ -133,9 +133,9 @@ docker build -f Dockerfile.adapter-with-plugins -t beckn-onix:latest .
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Intelligent Key Management:**
|
**Intelligent Key Management:**
|
||||||
The script reads `docker-compose-adapter2.yml` to detect which config file is being used (default: `local-simple.yaml`), extracts keys from protocol server configs, and automatically updates the `simplekeymanager` section in that config file - no manual configuration needed!
|
The script reads `docker-compose-adapter.yml` to detect which config file is being used (default: `local-simple.yaml`), extracts keys from protocol server configs, and automatically updates the `simplekeymanager` section in that config file - no manual configuration needed!
|
||||||
|
|
||||||
**Note:** Update `docker-compose-adapter2.yml` to use the correct config file and correct image:
|
**Note:** Update `docker-compose-adapter.yml` to use the correct config file and correct image (optional):
|
||||||
- For combined setup (simplekeymanager): `CONFIG_FILE: "/app/config/local-simple.yaml"`
|
- For combined setup (simplekeymanager): `CONFIG_FILE: "/app/config/local-simple.yaml"`
|
||||||
- For combined setup (keymanager with Vault): `CONFIG_FILE: "/app/config/local-dev.yaml"`
|
- For combined setup (keymanager with Vault): `CONFIG_FILE: "/app/config/local-dev.yaml"`
|
||||||
- For combined setup (production): `CONFIG_FILE: "/app/config/onix/adapter.yaml"`
|
- For combined setup (production): `CONFIG_FILE: "/app/config/onix/adapter.yaml"`
|
||||||
@@ -315,7 +315,7 @@ The `local-simple.yaml` config uses `simplekeymanager` plugin with embedded keys
|
|||||||
**With Docker:**
|
**With Docker:**
|
||||||
```bash
|
```bash
|
||||||
cd install
|
cd install
|
||||||
docker compose -f docker-compose-adapter2.yml up -d
|
docker compose -f docker-compose-adapter.yml up -d onix-adapter
|
||||||
```
|
```
|
||||||
|
|
||||||
The server will start on `http://localhost:8081`
|
The server will start on `http://localhost:8081`
|
||||||
|
|||||||
@@ -625,18 +625,18 @@ validate_config_modules() {
|
|||||||
if [[ "$key_type" == "BAP" && $has_bap_modules -eq 0 ]]; then
|
if [[ "$key_type" == "BAP" && $has_bap_modules -eq 0 ]]; then
|
||||||
echo "${RED}Error: BAP deployment selected but no BAP modules found in config file${NC}"
|
echo "${RED}Error: BAP deployment selected but no BAP modules found in config file${NC}"
|
||||||
echo "${BLUE}Config file: $config_file${NC}"
|
echo "${BLUE}Config file: $config_file${NC}"
|
||||||
echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with BAP modules${NC}"
|
echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with BAP modules${NC}"
|
||||||
return 1
|
return 1
|
||||||
elif [[ "$key_type" == "BPP" && $has_bpp_modules -eq 0 ]]; then
|
elif [[ "$key_type" == "BPP" && $has_bpp_modules -eq 0 ]]; then
|
||||||
echo "${RED}Error: BPP deployment selected but no BPP modules found in config file${NC}"
|
echo "${RED}Error: BPP deployment selected but no BPP modules found in config file${NC}"
|
||||||
echo "${BLUE}Config file: $config_file${NC}"
|
echo "${BLUE}Config file: $config_file${NC}"
|
||||||
echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with BPP modules${NC}"
|
echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with BPP modules${NC}"
|
||||||
return 1
|
return 1
|
||||||
elif [[ "$key_type" == "BOTH" && ($has_bap_modules -eq 0 || $has_bpp_modules -eq 0) ]]; then
|
elif [[ "$key_type" == "BOTH" && ($has_bap_modules -eq 0 || $has_bpp_modules -eq 0) ]]; then
|
||||||
echo "${RED}Error: Combined deployment selected but missing modules in config file${NC}"
|
echo "${RED}Error: Combined deployment selected but missing modules in config file${NC}"
|
||||||
echo "${BLUE}Config file: $config_file${NC}"
|
echo "${BLUE}Config file: $config_file${NC}"
|
||||||
echo "${BLUE}BAP modules found: $has_bap_modules, BPP modules found: $has_bpp_modules${NC}"
|
echo "${BLUE}BAP modules found: $has_bap_modules, BPP modules found: $has_bpp_modules${NC}"
|
||||||
echo "${YELLOW}Please update docker-compose-adapter2.yml to use a config file with both BAP and BPP modules${NC}"
|
echo "${YELLOW}Please update docker-compose-adapter.yml to use a config file with both BAP and BPP modules${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -656,9 +656,9 @@ configure_onix_registry_keys() {
|
|||||||
|
|
||||||
# Determine config file - only auto-detect if not provided
|
# Determine config file - only auto-detect if not provided
|
||||||
if [ -z "$config_file" ]; then
|
if [ -z "$config_file" ]; then
|
||||||
local docker_config=$(grep -o '/app/config/[^"]*' docker-compose-adapter2.yml | head -1)
|
local docker_config=$(grep -o '/app/config/[^"]*' docker-compose-adapter.yml | head -1)
|
||||||
if [ -z "$docker_config" ]; then
|
if [ -z "$docker_config" ]; then
|
||||||
echo "${RED}Error: Could not find config file in docker-compose-adapter2.yml${NC}"
|
echo "${RED}Error: Could not find config file in docker-compose-adapter.yml${NC}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
config_file="${docker_config/\/app\/config\//../config/}"
|
config_file="${docker_config/\/app\/config\//../config/}"
|
||||||
@@ -878,6 +878,14 @@ install_adapter() {
|
|||||||
local key_type=${1:-"BOTH"}
|
local key_type=${1:-"BOTH"}
|
||||||
local config_file=$2
|
local config_file=$2
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
echo "${GREEN}................Building plugins for ONIX Adapter................${NC}"
|
echo "${GREEN}................Building plugins for ONIX Adapter................${NC}"
|
||||||
|
|
||||||
# Build plugins the same way as setup.sh
|
# Build plugins the same way as setup.sh
|
||||||
|
|||||||
@@ -17,6 +17,27 @@ services:
|
|||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
|
onix-adapter:
|
||||||
|
image: fidedocker/onix-adapter
|
||||||
|
container_name: onix-adapter
|
||||||
|
platform: linux/amd64
|
||||||
|
networks:
|
||||||
|
- beckn_network
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
environment:
|
||||||
|
CONFIG_FILE: "/app/config/local-simple.yaml"
|
||||||
|
VAULT_ADDR: http://vault:8200
|
||||||
|
VAULT_TOKEN: root
|
||||||
|
REDIS_ADDR: redis:6379
|
||||||
|
RABBITMQ_ADDR: rabbitmq:5672
|
||||||
|
RABBITMQ_USER: admin
|
||||||
|
RABBITMQ_PASS: admin123
|
||||||
|
volumes:
|
||||||
|
- ../config:/app/config
|
||||||
|
- ../schemas:/app/schemas
|
||||||
|
command: ["./server", "--config=/app/config/local-simple.yaml"]
|
||||||
|
|
||||||
# Vault - Key Management Service
|
# Vault - Key Management Service
|
||||||
vault:
|
vault:
|
||||||
image: hashicorp/vault:latest
|
image: hashicorp/vault:latest
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
onix-adapter:
|
|
||||||
image: fidedocker/onix-adapter
|
|
||||||
container_name: onix-adapter
|
|
||||||
platform: linux/amd64
|
|
||||||
networks:
|
|
||||||
- beckn_network
|
|
||||||
ports:
|
|
||||||
- "8081:8081"
|
|
||||||
environment:
|
|
||||||
CONFIG_FILE: "/app/config/local-simple.yaml"
|
|
||||||
VAULT_ADDR: http://vault:8200
|
|
||||||
VAULT_TOKEN: root
|
|
||||||
REDIS_ADDR: redis:6379
|
|
||||||
RABBITMQ_ADDR: rabbitmq:5672
|
|
||||||
RABBITMQ_USER: admin
|
|
||||||
RABBITMQ_PASS: admin123
|
|
||||||
volumes:
|
|
||||||
- ../config:/app/config
|
|
||||||
- ../schemas:/app/schemas
|
|
||||||
command: ["./server", "--config=/app/config/local-simple.yaml"]
|
|
||||||
#command: ["sh", "-c", "ls -la plugins schemas config"]
|
|
||||||
|
|
||||||
networks:
|
|
||||||
beckn_network:
|
|
||||||
name: beckn_network
|
|
||||||
driver: bridge
|
|
||||||
@@ -40,6 +40,9 @@ else
|
|||||||
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
|
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
|
||||||
ip=$(hostname -I | awk '{print $1}')
|
ip=$(hostname -I | awk '{print $1}')
|
||||||
registry_url="http://$ip:3030/subscribers"
|
registry_url="http://$ip:3030/subscribers"
|
||||||
|
elif [[ $(grep -i 'ubuntu' /etc/os-release) ]]; then
|
||||||
|
ip=localhost
|
||||||
|
registry_url="http://$ip:3030/subscribers"
|
||||||
else
|
else
|
||||||
registry_url="http://$(get_container_ip registry):3030/subscribers"
|
registry_url="http://$(get_container_ip registry):3030/subscribers"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ else
|
|||||||
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
|
elif [[ $(systemd-detect-virt) == 'wsl' ]]; then
|
||||||
ip=$(hostname -I | awk '{print $1}')
|
ip=$(hostname -I | awk '{print $1}')
|
||||||
registry_url="http://$ip:3030/subscribers"
|
registry_url="http://$ip:3030/subscribers"
|
||||||
|
elif [[ $(grep -i 'ubuntu' /etc/os-release) ]]; then
|
||||||
|
ip=localhost
|
||||||
|
registry_url="http://$ip:3030/subscribers"
|
||||||
else
|
else
|
||||||
registry_url="http://$(get_container_ip registry):3030/subscribers"
|
registry_url="http://$(get_container_ip registry):3030/subscribers"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -74,4 +74,4 @@ bap_docker_compose_file=docker-compose-bap.yml
|
|||||||
registry_docker_compose_file=docker-compose-registry.yml
|
registry_docker_compose_file=docker-compose-registry.yml
|
||||||
gateway_docker_compose_file=docker-compose-gateway.yml
|
gateway_docker_compose_file=docker-compose-gateway.yml
|
||||||
gcl_docker_compose_file=docker-compose-gcl.yml
|
gcl_docker_compose_file=docker-compose-gcl.yml
|
||||||
adapter_docker_compose_file=docker-compose-adapter2.yml
|
adapter_docker_compose_file=docker-compose-adapter.yml
|
||||||
@@ -148,7 +148,7 @@ fi
|
|||||||
# Step 5: Start ONIX Adapter
|
# Step 5: Start ONIX Adapter
|
||||||
echo -e "${YELLOW}Step 5: Starting ONIX Adapter...${NC}"
|
echo -e "${YELLOW}Step 5: Starting ONIX Adapter...${NC}"
|
||||||
cd install
|
cd install
|
||||||
docker compose -f ./docker-compose-adapter2.yml up -d
|
docker compose -f ./docker-compose-adapter.yml up -d onix-adapter
|
||||||
echo "ONIX Adapter installation successful"
|
echo "ONIX Adapter installation successful"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
@@ -204,8 +204,8 @@ echo -e "3. Test the endpoints:"
|
|||||||
echo -e " ${YELLOW}curl -X POST http://localhost:8081/bap/caller/search${NC}"
|
echo -e " ${YELLOW}curl -X POST http://localhost:8081/bap/caller/search${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "4. Stop all services:"
|
echo -e "4. Stop all services:"
|
||||||
echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml down && docker compose -f docker-compose-adapter2.yml down${NC}"
|
echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml down ${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "5. View logs:"
|
echo -e "5. View logs:"
|
||||||
echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter2.yml logs -f onix-adapter${NC}"
|
echo -e " ${YELLOW}cd install && docker compose -f docker-compose-adapter.yml logs -f onix-adapter${NC}"
|
||||||
echo -e "${GREEN}========================================${NC}"
|
echo -e "${GREEN}========================================${NC}"
|
||||||
2
install/uninstall.sh
Normal file → Executable file
2
install/uninstall.sh
Normal file → Executable file
@@ -1,4 +1,4 @@
|
|||||||
docker compose -f docker-compose-adapter2.yml down -v
|
docker compose -f docker-compose-adapter.yml down -v
|
||||||
docker compose -f docker-compose-bap.yml down -v
|
docker compose -f docker-compose-bap.yml down -v
|
||||||
docker compose -f docker-compose-bpp.yml down -v
|
docker compose -f docker-compose-bpp.yml down -v
|
||||||
docker compose -f docker-compose-bpp-with-sandbox.yml down -v
|
docker compose -f docker-compose-bpp-with-sandbox.yml down -v
|
||||||
|
|||||||
Reference in New Issue
Block a user