- Resolve stash: merge load_deployment_env path with secure-secrets and CR/LF RPC strip - create-pmm-full-mesh-chain138.sh delegates to sync-chain138-pmm-pools-from-json.sh - env.additions.example: canonical PMM pool defaults (cUSDT/USDT per crosscheck) - Include Chain138 scripts, official mirror deploy scaffolding, and prior staged changes Made-with: Cursor
68 lines
2.4 KiB
Bash
Executable File
68 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy Phase 2 from Nginx proxy host
|
|
# This script should be run on the proxy host (20.160.58.99) after copying the project
|
|
# Usage: ssh besuadmin@20.160.58.99, then run this script
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
cd "$PROJECT_ROOT"
|
|
# Load .env via dotenv (RPC CR/LF trim). Fallback: raw source.
|
|
if [[ -f "$SCRIPT_DIR/../lib/deployment/dotenv.sh" ]]; then
|
|
# shellcheck disable=SC1090
|
|
source "$SCRIPT_DIR/../lib/deployment/dotenv.sh"
|
|
load_deployment_env --repo-root "${PROJECT_ROOT:-$REPO_ROOT}"
|
|
elif [[ -n "${PROJECT_ROOT:-}" && -f "$PROJECT_ROOT/.env" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$PROJECT_ROOT/.env"
|
|
set +a
|
|
elif [[ -n "${REPO_ROOT:-}" && -f "$REPO_ROOT/.env" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$REPO_ROOT/.env"
|
|
set +a
|
|
fi
|
|
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "Phase 2 Deployment from Proxy Host"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
# Check if .env exists
|
|
if [ ! -f .env ]; then
|
|
echo "Error: .env file not found"
|
|
echo "Please ensure .env is available on this host"
|
|
exit 1
|
|
fi
|
|
|
|
source .env
|
|
|
|
# Change to Phase 2 directory
|
|
cd terraform/phases/phase2
|
|
|
|
# Initialize Terraform if needed
|
|
if [ ! -d .terraform ]; then
|
|
echo "Initializing Terraform..."
|
|
terraform init -upgrade > /dev/null 2>&1
|
|
fi
|
|
|
|
# Deploy (no bastion needed since we're already on the proxy)
|
|
echo "Deploying Phase 2 to all 5 regions..."
|
|
echo "Running from proxy host - direct access to private IPs"
|
|
echo ""
|
|
|
|
terraform apply -auto-approve
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "✅ Phase 2 Deployment Complete"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Start services: ./terraform/phases/phase2/scripts/start-services.sh all"
|
|
echo "2. Check status: ./terraform/phases/phase2/scripts/status.sh all"
|
|
|