mirror of
https://github.com/logos-messaging/logos-messaging-nim-compose.git
synced 2026-01-04 06:53:08 +00:00
chore: caught some minor bugs and improvemnet while testing
This commit is contained in:
parent
4e5a66d306
commit
2075c81f14
@ -23,11 +23,20 @@ print_banner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_node() {
|
start_node() {
|
||||||
# Start the node
|
|
||||||
echo -e "\n🚀 Starting Waku node..."
|
echo -e "\n🚀 Starting Waku node..."
|
||||||
docker-compose up -d &
|
echo ""
|
||||||
|
|
||||||
echo -e "\n${GREEN}${BOLD}✨ Your Waku node is ready!${NC}"
|
docker-compose up -d
|
||||||
|
|
||||||
|
# Wait a moment for services to initialize
|
||||||
|
echo -e "\nInitializing services..."
|
||||||
|
for i in {1..3}; do
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Now show the success message and instructions
|
||||||
|
echo -e "\n\n${GREEN}${BOLD}✨ Your Waku node is ready!${NC}"
|
||||||
echo -e "📊 View metrics: http://localhost:3000"
|
echo -e "📊 View metrics: http://localhost:3000"
|
||||||
echo -e "💬 Chat interface: http://localhost:4000"
|
echo -e "💬 Chat interface: http://localhost:4000"
|
||||||
echo -e "🔍 Check node health: make status"
|
echo -e "🔍 Check node health: make status"
|
||||||
@ -78,11 +87,30 @@ setup_sepolia_rpc() {
|
|||||||
if [[ $rpc_url =~ ^https://sepolia\.infura\.io/v3/[0-9a-fA-F]{32}$ ]]; then
|
if [[ $rpc_url =~ ^https://sepolia\.infura\.io/v3/[0-9a-fA-F]{32}$ ]]; then
|
||||||
echo -e "\n${GREEN}✅ Sepolia RPC URL configured successfully!${NC}"
|
echo -e "\n${GREEN}✅ Sepolia RPC URL configured successfully!${NC}"
|
||||||
sed -i.bak "s|RLN_RELAY_ETH_CLIENT_ADDRESS=.*|RLN_RELAY_ETH_CLIENT_ADDRESS=$rpc_url|" .env
|
sed -i.bak "s|RLN_RELAY_ETH_CLIENT_ADDRESS=.*|RLN_RELAY_ETH_CLIENT_ADDRESS=$rpc_url|" .env
|
||||||
return 0
|
break
|
||||||
else
|
else
|
||||||
echo -e "\n${RED}Invalid Infura URL format. Please check and try again.${NC}"
|
echo -e "\n${RED}Invalid Infura URL format. Please check and try again.${NC}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Get Ethereum private key
|
||||||
|
while true; do
|
||||||
|
echo -e "\n🔑 Enter your Sepolia ETH private key:"
|
||||||
|
echo -e "${YELLOW}Note: Input will be hidden for security${NC}"
|
||||||
|
IFS= read -r eth_key
|
||||||
|
|
||||||
|
# Remove any 0x prefix if present
|
||||||
|
eth_key="${eth_key#0x}"
|
||||||
|
|
||||||
|
# Validate the key
|
||||||
|
if [[ ${#eth_key} == 64 && "$eth_key" =~ ^[0-9a-fA-F]+$ ]]; then
|
||||||
|
sed -i.bak "s|ETH_TESTNET_KEY=.*|ETH_TESTNET_KEY=$eth_key|" .env
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error: Private key should be 64 hexadecimal characters (excluding any '0x' prefix)${NC}"
|
||||||
|
echo -e "${YELLOW}Please try again...${NC}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Interactive setup function
|
# Interactive setup function
|
||||||
@ -112,50 +140,11 @@ setup() {
|
|||||||
|
|
||||||
setup_sepolia_rpc
|
setup_sepolia_rpc
|
||||||
|
|
||||||
# Get and validate Sepolia RPC URL
|
|
||||||
while true; do
|
|
||||||
echo -e "\n🔗 Enter your Sepolia endpoint URL:"
|
|
||||||
echo -e "${YELLOW}Format: https://sepolia.infura.io/v3/YOUR-PROJECT-ID${NC}\n"
|
|
||||||
read -p "URL: " rpc_url
|
|
||||||
|
|
||||||
if [[ $rpc_url =~ ^https://sepolia\.infura\.io/v3/[0-9a-fA-F]{32}$ ]]; then
|
|
||||||
echo -e "\n${GREEN}✅ Sepolia RPC URL configured successfully!${NC}"
|
|
||||||
sed -i.bak "s|RLN_RELAY_ETH_CLIENT_ADDRESS=.*|RLN_RELAY_ETH_CLIENT_ADDRESS=$rpc_url|" .env
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo -e "\n${RED}Invalid Infura URL format. Please check and try again.${NC}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Get Ethereum private key
|
|
||||||
while true; do
|
|
||||||
echo -e "\n🔑 Enter your Sepolia ETH private key:"
|
|
||||||
echo -e "${YELLOW}Note: Input will be hidden for security${NC}"
|
|
||||||
IFS= read -r eth_key
|
|
||||||
|
|
||||||
# Remove any 0x prefix if present
|
|
||||||
eth_key="${eth_key#0x}"
|
|
||||||
|
|
||||||
# Validate the key
|
|
||||||
if [[ ${#eth_key} == 64 && "$eth_key" =~ ^[0-9a-fA-F]+$ ]]; then
|
|
||||||
sed -i.bak "s|ETH_TESTNET_KEY=.*|ETH_TESTNET_KEY=$eth_key|" .env
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo -e "${RED}Error: Private key should be 64 hexadecimal characters (excluding any '0x' prefix)${NC}"
|
|
||||||
echo -e "${YELLOW}Please try again...${NC}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Get RLN password
|
# Get RLN password
|
||||||
read -s -p "🔒 Create a password for your RLN membership: " rln_password
|
read -s -p "🔒 Create a password for your RLN membership: " rln_password
|
||||||
echo
|
echo
|
||||||
sed -i.bak "s|RLN_RELAY_CRED_PASSWORD=.*|RLN_RELAY_CRED_PASSWORD=\"$rln_password\"|" .env
|
sed -i.bak "s|RLN_RELAY_CRED_PASSWORD=.*|RLN_RELAY_CRED_PASSWORD=\"$rln_password\"|" .env
|
||||||
|
|
||||||
# Clean up backup file
|
|
||||||
rm -f .env.bak
|
|
||||||
|
|
||||||
echo -e "\n${GREEN}✅ Configuration saved${NC}"
|
|
||||||
|
|
||||||
# Show configuration summary
|
# Show configuration summary
|
||||||
echo -e "\n${BOLD}Configuration Summary:${NC}"
|
echo -e "\n${BOLD}Configuration Summary:${NC}"
|
||||||
echo -e "RPC URL: $rpc_url"
|
echo -e "RPC URL: $rpc_url"
|
||||||
@ -263,11 +252,13 @@ node_management_menu() {
|
|||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
echo -e "\n${BOLD}Stopping node...${NC}"
|
echo -e "\n${BOLD}Stopping node...${NC}"
|
||||||
|
echo ""
|
||||||
docker-compose down
|
docker-compose down
|
||||||
press_enter
|
press_enter
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
echo -e "\n${BOLD}Restarting node...${NC}"
|
echo -e "\n${BOLD}Restarting node...${NC}"
|
||||||
|
echo ""
|
||||||
docker-compose restart
|
docker-compose restart
|
||||||
press_enter
|
press_enter
|
||||||
;;
|
;;
|
||||||
@ -446,13 +437,13 @@ backup_config() {
|
|||||||
if [ ! -f ".env" ]; then
|
if [ ! -f ".env" ]; then
|
||||||
echo -e "${RED}⚠️ No configuration files found to backup${NC}"
|
echo -e "${RED}⚠️ No configuration files found to backup${NC}"
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
# Create backup directory
|
# Create backup directory
|
||||||
if ! mkdir -p "$backup_dir"; then
|
if ! mkdir -p "$backup_dir"; then
|
||||||
echo -e "${RED}⚠️ Failed to create backup directory${NC}"
|
echo -e "${RED}⚠️ Failed to create backup directory${NC}"
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
# Copy files with error checking
|
# Copy files with error checking
|
||||||
if cp .env "$backup_dir/"; then
|
if cp .env "$backup_dir/"; then
|
||||||
@ -471,7 +462,7 @@ restore_config() {
|
|||||||
echo -e "\n${RED}⚠️ No backups found${NC}"
|
echo -e "\n${RED}⚠️ No backups found${NC}"
|
||||||
echo -e "Please create a backup first using the backup command\n"
|
echo -e "Please create a backup first using the backup command\n"
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
echo -e "\n${BOLD}Available backups:${NC}"
|
echo -e "\n${BOLD}Available backups:${NC}"
|
||||||
select backup in $(ls -r backups); do # -r for reverse order (newest first)
|
select backup in $(ls -r backups); do # -r for reverse order (newest first)
|
||||||
@ -480,7 +471,7 @@ restore_config() {
|
|||||||
if [ ! -f "backups/$backup/.env" ]; then
|
if [ ! -f "backups/$backup/.env" ]; then
|
||||||
echo -e "\n${RED}⚠️ Invalid or corrupted backup${NC}"
|
echo -e "\n${RED}⚠️ Invalid or corrupted backup${NC}"
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
# Create backup of current config before restoring
|
# Create backup of current config before restoring
|
||||||
if [ -f ".env" ]; then
|
if [ -f ".env" ]; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user