Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control. - Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities. - Created .gitmodules to include OpenZeppelin contracts as a submodule. - Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment. - Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks. - Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring. - Created scripts for resource import and usage validation across non-US regions. - Added tests for CCIP error handling and integration to ensure robust functionality. - Included various new files and directories for the orchestration portal and deployment scripts.
This commit is contained in:
89
scripts/backup/backup-chaindata.sh
Executable file
89
scripts/backup/backup-chaindata.sh
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Backup chaindata script for Besu nodes
|
||||
# This script creates backups of chaindata volumes
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
# Configuration
|
||||
NAMESPACE="${NAMESPACE:-besu-network}"
|
||||
BACKUP_DIR="${BACKUP_DIR:-/backup/chaindata}"
|
||||
RETENTION_DAYS="${RETENTION_DAYS:-30}"
|
||||
DATE=$(date +%Y%m%d-%H%M%S)
|
||||
|
||||
|
||||
log_success "Starting chaindata backup"
|
||||
|
||||
# Create backup directory
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Backup validators
|
||||
log_warn "Backing up validator chaindata..."
|
||||
VALIDATOR_PODS=$(kubectl get pods -n "$NAMESPACE" -l component=validator -o jsonpath='{.items[*].metadata.name}')
|
||||
|
||||
for pod in $VALIDATOR_PODS; do
|
||||
log_warn "Backing up $pod..."
|
||||
|
||||
# Create snapshot
|
||||
kubectl exec -n "$NAMESPACE" "$pod" -- tar czf - /data/besu > "$BACKUP_DIR/validator-$pod-$DATE.tar.gz"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "✓ Backup created: validator-$pod-$DATE.tar.gz"
|
||||
else
|
||||
log_error "✗ Backup failed for $pod"
|
||||
fi
|
||||
done
|
||||
|
||||
# Backup RPC nodes (optional - only if using full sync)
|
||||
log_warn "Backing up RPC chaindata..."
|
||||
RPC_PODS=$(kubectl get pods -n "$NAMESPACE" -l component=rpc -o jsonpath='{.items[*].metadata.name}')
|
||||
|
||||
for pod in $RPC_PODS; do
|
||||
log_warn "Backing up $pod..."
|
||||
|
||||
# Create snapshot
|
||||
kubectl exec -n "$NAMESPACE" "$pod" -- tar czf - /data/besu > "$BACKUP_DIR/rpc-$pod-$DATE.tar.gz"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "✓ Backup created: rpc-$pod-$DATE.tar.gz"
|
||||
else
|
||||
log_error "✗ Backup failed for $pod"
|
||||
fi
|
||||
done
|
||||
|
||||
# Clean up old backups
|
||||
log_warn "Cleaning up old backups (older than $RETENTION_DAYS days)..."
|
||||
find "$BACKUP_DIR" -name "*.tar.gz" -mtime +$RETENTION_DAYS -delete
|
||||
|
||||
log_success "Backup completed"
|
||||
|
||||
# Upload to Azure Blob Storage (optional)
|
||||
if [ -n "$AZURE_STORAGE_ACCOUNT" ] && [ -n "$AZURE_STORAGE_CONTAINER" ]; then
|
||||
log_warn "Uploading backups to Azure Blob Storage..."
|
||||
|
||||
# Install azure-cli if not present
|
||||
if ! command -v az &> /dev/null; then
|
||||
log_error "Azure CLI not found. Install it to upload backups."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload backups
|
||||
az storage blob upload-batch \
|
||||
--account-name "$AZURE_STORAGE_ACCOUNT" \
|
||||
--destination "$AZURE_STORAGE_CONTAINER" \
|
||||
--source "$BACKUP_DIR" \
|
||||
--pattern "*-$DATE.tar.gz"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "✓ Backups uploaded to Azure Blob Storage"
|
||||
else
|
||||
log_error "✗ Upload failed"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_success "Backup process completed"
|
||||
|
||||
74
scripts/backup/restore-chaindata.sh
Executable file
74
scripts/backup/restore-chaindata.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Restore chaindata script for Besu nodes
|
||||
# This script restores chaindata from backups
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../lib/init.sh"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
# Configuration
|
||||
NAMESPACE="${NAMESPACE:-besu-network}"
|
||||
BACKUP_DIR="${BACKUP_DIR:-/backup/chaindata}"
|
||||
BACKUP_FILE="${1:-}"
|
||||
|
||||
|
||||
if [ -z "$BACKUP_FILE" ]; then
|
||||
log_error "Error: Backup file not specified"
|
||||
echo "Usage: $0 <backup-file> [pod-name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$BACKUP_FILE" ]; then
|
||||
log_error "Error: Backup file not found: $BACKUP_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
POD_NAME="${2:-}"
|
||||
|
||||
if [ -z "$POD_NAME" ]; then
|
||||
log_warn "Available pods:"
|
||||
kubectl get pods -n "$NAMESPACE" -l component=validator -o jsonpath='{.items[*].metadata.name}'
|
||||
read -p "Enter pod name: " POD_NAME
|
||||
fi
|
||||
|
||||
log_warn "Restoring chaindata to $POD_NAME from $BACKUP_FILE"
|
||||
log_error "WARNING: This will overwrite existing chaindata. Continue? (y/N)"
|
||||
read -r CONFIRM
|
||||
|
||||
if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then
|
||||
echo "Restore cancelled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Scale down pod
|
||||
log_warn "Scaling down pod..."
|
||||
kubectl scale statefulset --replicas=0 -n "$NAMESPACE" $(kubectl get statefulset -n "$NAMESPACE" -l component=validator -o jsonpath='{.items[0].metadata.name}')
|
||||
|
||||
# Wait for pod to terminate
|
||||
log_warn "Waiting for pod to terminate..."
|
||||
kubectl wait --for=delete pod/"$POD_NAME" -n "$NAMESPACE" --timeout=300s
|
||||
|
||||
# Restore data
|
||||
log_warn "Restoring chaindata..."
|
||||
cat "$BACKUP_FILE" | kubectl exec -i -n "$NAMESPACE" "$POD_NAME" -- tar xzf - -C /
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "✓ Chaindata restored"
|
||||
else
|
||||
log_error "✗ Restore failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Scale up pod
|
||||
log_warn "Scaling up pod..."
|
||||
kubectl scale statefulset --replicas=1 -n "$NAMESPACE" $(kubectl get statefulset -n "$NAMESPACE" -l component=validator -o jsonpath='{.items[0].metadata.name}')
|
||||
|
||||
# Wait for pod to be ready
|
||||
log_warn "Waiting for pod to be ready..."
|
||||
kubectl wait --for=condition=ready pod/"$POD_NAME" -n "$NAMESPACE" --timeout=300s
|
||||
|
||||
log_success "Restore completed"
|
||||
|
||||
Reference in New Issue
Block a user