feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths. - Frontend wallet and liquidity surfaces; MetaMask token list alignment. - Deployment docs, verification scripts, address inventory updates. Check: go build ./... under backend/ (pass). Made-with: Cursor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Run all deployment steps
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
@@ -10,15 +10,28 @@ echo "=== Running All Deployment Steps ==="
|
||||
echo ""
|
||||
|
||||
# Database credentials
|
||||
export DB_PASSWORD='***REDACTED-LEGACY-PW***'
|
||||
export DB_HOST="${DB_HOST:-localhost}"
|
||||
export DB_PORT="${DB_PORT:-5432}"
|
||||
export DB_USER="${DB_USER:-explorer}"
|
||||
export DB_NAME="${DB_NAME:-explorer}"
|
||||
if [ -z "${DB_PASSWORD:-}" ]; then
|
||||
echo "❌ DB_PASSWORD is required"
|
||||
echo " Export DB_PASSWORD before running this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract_error_message() {
|
||||
local body="${1:-}"
|
||||
if [ -z "$body" ]; then
|
||||
return 0
|
||||
fi
|
||||
echo "$body" | jq -r '.error.message // empty' 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Step 1: Test database connection
|
||||
echo "Step 1: Testing database connection..."
|
||||
export PGPASSWORD="$DB_PASSWORD"
|
||||
if psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -c "SELECT 1;" > /dev/null 2>&1; then
|
||||
if psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -c "SELECT 1;" > /dev/null 2>&1; then
|
||||
echo "✅ Database connection successful"
|
||||
else
|
||||
echo "❌ Database connection failed"
|
||||
@@ -29,18 +42,18 @@ echo ""
|
||||
|
||||
# Step 2: Check existing tables
|
||||
echo "Step 2: Checking for existing tables..."
|
||||
TABLE_COUNT=$(psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -c "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers');" -t 2>/dev/null | tr -d ' ')
|
||||
TABLE_COUNT=$(psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -c "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers');" -t 2>/dev/null | tr -d ' ')
|
||||
echo "Found $TABLE_COUNT/4 track schema tables"
|
||||
echo ""
|
||||
|
||||
# Step 3: Run migration if needed
|
||||
if [ "$TABLE_COUNT" -lt "4" ]; then
|
||||
echo "Step 3: Running database migration..."
|
||||
MIGRATION_FILE="$PROJECT_ROOT/backend/database/migrations/0010_track_schema.up.sql"
|
||||
if psql -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" -f "$MIGRATION_FILE" > /dev/null 2>&1; then
|
||||
if bash "$SCRIPT_DIR/run-migration-0010.sh" > /dev/null; then
|
||||
echo "✅ Migration completed"
|
||||
else
|
||||
echo "⚠️ Migration may have partially completed (some tables may already exist)"
|
||||
echo "❌ Migration failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Step 3: Migration already complete (tables exist)"
|
||||
@@ -111,13 +124,21 @@ else
|
||||
fi
|
||||
|
||||
echo -n " Auth nonce... "
|
||||
NONCE_CODE=$(curl -s -w "%{http_code}" -o /dev/null -X POST "http://localhost:8080/api/v1/auth/nonce" \
|
||||
NONCE_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "http://localhost:8080/api/v1/auth/nonce" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"address":"0x1234567890123456789012345678901234567890"}')
|
||||
NONCE_CODE=$(echo "$NONCE_RESPONSE" | tail -n1)
|
||||
NONCE_BODY=$(echo "$NONCE_RESPONSE" | sed '$d')
|
||||
NONCE_ERROR=$(extract_error_message "$NONCE_BODY")
|
||||
if [ "$NONCE_CODE" = "200" ]; then
|
||||
echo "✅"
|
||||
else
|
||||
echo "⚠️ (HTTP $NONCE_CODE)"
|
||||
echo "❌ (HTTP $NONCE_CODE)"
|
||||
if [ -n "$NONCE_ERROR" ]; then
|
||||
echo " $NONCE_ERROR"
|
||||
fi
|
||||
echo " Wallet auth is not healthy; stop here until migration and DB access are fixed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n " Track 2 auth check... "
|
||||
@@ -155,4 +176,3 @@ echo " 3. Monitor: tail -f backend/logs/api-server.log"
|
||||
echo ""
|
||||
|
||||
unset PGPASSWORD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user