Files
proxmox/scripts/cloudflare-tunnels/scripts/complete-automated-setup.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

114 lines
3.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Complete automated setup - runs all automation steps
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TUNNELS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_error() { echo -e "${RED}[✗]${NC} $1"; }
echo ""
log_info "=========================================="
log_info " Complete Automated Cloudflare Setup"
log_info "=========================================="
echo ""
# Step 1: Verify prerequisites
log_info "Step 1: Verifying prerequisites..."
if ! "$SCRIPT_DIR/verify-prerequisites.sh"; then
log_error "Prerequisites check failed"
exit 1
fi
# Step 2: Run Cloudflare API automation
log_info ""
log_info "Step 2: Running Cloudflare API automation..."
log_info "This will create tunnels, DNS records, and Access applications"
echo ""
if ! "$SCRIPT_DIR/automate-cloudflare-setup.sh"; then
log_error "Cloudflare API automation failed"
exit 1
fi
# Step 3: Parse output and save credentials
log_info ""
log_info "Step 3: Saving tunnel credentials..."
log_warn "Note: You'll need to manually extract tunnel IDs and tokens from the output above"
log_warn "Then run: ./scripts/save-tunnel-credentials.sh <name> <id> <token>"
echo ""
# Step 4: Install systemd services
log_info ""
log_info "Step 4: Installing systemd services..."
if ! "$SCRIPT_DIR/setup-multi-tunnel.sh" --skip-credentials; then
log_warn "Service installation may need manual completion"
fi
# Step 5: Start services
log_info ""
log_info "Step 5: Starting tunnel services..."
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
VMID="${VMID:-102}"
if command -v pct &> /dev/null; then
for tunnel in ml110 r630-01 r630-02; do
if pct exec "$VMID" -- systemctl start "cloudflared-${tunnel}.service" 2>/dev/null; then
log_success "Started cloudflared-${tunnel}.service"
else
log_warn "Could not start cloudflared-${tunnel}.service (may need credentials first)"
fi
done
else
log_warn "Cannot start services remotely. Run manually:"
echo " ssh root@${PROXMOX_HOST} 'pct exec $VMID -- systemctl start cloudflared-*'"
fi
# Step 6: Health check
log_info ""
log_info "Step 6: Running health check..."
if "$SCRIPT_DIR/check-tunnel-health.sh"; then
log_success "Health check completed"
else
log_warn "Health check found issues (may be expected if credentials not saved yet)"
fi
echo ""
log_success "=========================================="
log_success " Automated Setup Complete"
log_success "=========================================="
echo ""
log_info "Next steps:"
echo ""
echo "1. Extract tunnel IDs and tokens from Step 2 output"
echo "2. Save credentials:"
echo " ./scripts/save-tunnel-credentials.sh ml110 <id> <token>"
echo " ./scripts/save-tunnel-credentials.sh r630-01 <id> <token>"
echo " ./scripts/save-tunnel-credentials.sh r630-02 <id> <token>"
echo ""
echo "3. Start services:"
echo " systemctl start cloudflared-*"
echo ""
echo "4. Verify:"
echo " ./scripts/check-tunnel-health.sh"
echo ""