Initial commit: Chain 138 Explorer monorepo structure
This commit is contained in:
43
.gitignore
vendored
Normal file
43
.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
vendor/
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
build/
|
||||
*.min.js
|
||||
*.min.css
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
*.tmp
|
||||
|
||||
# Deployment
|
||||
deployment/.env
|
||||
deployment/secrets/
|
||||
|
||||
# Testing
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
78
README.md
Normal file
78
README.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Chain 138 Explorer Monorepo
|
||||
|
||||
A comprehensive blockchain explorer for ChainID 138 with bridge monitoring and WETH utilities.
|
||||
|
||||
## 🏗️ Monorepo Structure
|
||||
|
||||
```
|
||||
explorer-monorepo/
|
||||
├── frontend/ # Frontend application
|
||||
│ ├── src/ # Source files (if using build tools)
|
||||
│ ├── assets/ # Static assets (images, fonts, etc.)
|
||||
│ └── public/ # Public HTML/CSS/JS files
|
||||
├── backend/ # Backend services (if needed)
|
||||
│ └── api/ # API services
|
||||
├── scripts/ # Deployment and utility scripts
|
||||
├── docs/ # Documentation
|
||||
├── deployment/ # Deployment configurations
|
||||
├── config/ # Configuration files
|
||||
└── package.json # Root package.json for monorepo
|
||||
```
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Block Explorer**: Browse blocks, transactions, and addresses
|
||||
- **Bridge Monitoring**: Monitor CCIP bridge contracts and cross-chain activity
|
||||
- **WETH Utilities**: Wrap/unwrap ETH using WETH9 and WETH10 contracts
|
||||
- **MetaMask Integration**: Full wallet connectivity and transaction signing
|
||||
- **Real-time Updates**: Live network statistics and data
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone <repository-url>
|
||||
cd explorer-monorepo
|
||||
|
||||
# Or if used as submodule
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
### Deployment
|
||||
|
||||
```bash
|
||||
# Deploy to production
|
||||
./scripts/deploy.sh
|
||||
```
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
See the `docs/` directory for detailed documentation:
|
||||
- API documentation
|
||||
- Deployment guides
|
||||
- Configuration references
|
||||
- Feature documentation
|
||||
|
||||
## 🔧 Development
|
||||
|
||||
### Local Development
|
||||
|
||||
```bash
|
||||
# Serve locally
|
||||
cd frontend/public
|
||||
python3 -m http.server 8000
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
```bash
|
||||
# If using build tools
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 📝 License
|
||||
|
||||
See LICENSE file for details.
|
||||
|
||||
16
config/deployment.json
Normal file
16
config/deployment.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"production": {
|
||||
"host": "192.168.11.140",
|
||||
"domain": "explorer.d-bis.org",
|
||||
"deployment_path": "/var/www/html",
|
||||
"backup_enabled": true,
|
||||
"ssl_enabled": true
|
||||
},
|
||||
"development": {
|
||||
"host": "localhost",
|
||||
"domain": "localhost",
|
||||
"deployment_path": "./frontend/public",
|
||||
"port": 8000
|
||||
}
|
||||
}
|
||||
|
||||
59
docs/DEPLOYMENT.md
Normal file
59
docs/DEPLOYMENT.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Deployment Guide
|
||||
|
||||
## Production Deployment
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- SSH access to production server (192.168.11.140)
|
||||
- Password for root user
|
||||
- `sshpass` installed (or use SSH keys)
|
||||
|
||||
### Quick Deploy
|
||||
|
||||
```bash
|
||||
# From explorer-monorepo root
|
||||
./scripts/deploy.sh
|
||||
```
|
||||
|
||||
### Manual Deploy
|
||||
|
||||
```bash
|
||||
# Copy files manually
|
||||
scp frontend/public/index.html root@192.168.11.140:/var/www/html/index.html
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
The deployment script uses these environment variables:
|
||||
|
||||
- `IP`: Production server IP (default: 192.168.11.140)
|
||||
- `DOMAIN`: Domain name (default: explorer.d-bis.org)
|
||||
- `PASSWORD`: SSH password (default: L@kers2010)
|
||||
|
||||
```bash
|
||||
IP=192.168.11.140 DOMAIN=explorer.d-bis.org ./scripts/deploy.sh
|
||||
```
|
||||
|
||||
## Rollback
|
||||
|
||||
If deployment fails, rollback to previous version:
|
||||
|
||||
```bash
|
||||
ssh root@192.168.11.140
|
||||
cp /var/www/html/index.html.backup.* /var/www/html/index.html
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
After deployment, test the explorer:
|
||||
|
||||
```bash
|
||||
./scripts/test.sh
|
||||
```
|
||||
|
||||
Or manually:
|
||||
|
||||
```bash
|
||||
curl -k -I https://explorer.d-bis.org/
|
||||
```
|
||||
|
||||
1200
frontend/public/index.html
Normal file
1200
frontend/public/index.html
Normal file
File diff suppressed because it is too large
Load Diff
26
package.json
Normal file
26
package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "chain-138-explorer",
|
||||
"version": "1.0.0",
|
||||
"description": "Comprehensive blockchain explorer for ChainID 138",
|
||||
"main": "frontend/public/index.html",
|
||||
"scripts": {
|
||||
"deploy": "./scripts/deploy.sh",
|
||||
"test": "./scripts/test.sh",
|
||||
"lint": "echo 'Linting not configured'"
|
||||
},
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"explorer",
|
||||
"ethereum",
|
||||
"blockscout",
|
||||
"bridge",
|
||||
"weth"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": ""
|
||||
}
|
||||
}
|
||||
|
||||
67
scripts/deploy.sh
Executable file
67
scripts/deploy.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy Explorer to Production
|
||||
# Copies frontend files to the Blockscout container
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
IP="${IP:-192.168.11.140}"
|
||||
DOMAIN="${DOMAIN:-explorer.d-bis.org}"
|
||||
PASSWORD="${PASSWORD:-L@kers2010}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
||||
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
log_step() { echo -e "${CYAN}[STEP]${NC} $1"; }
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
|
||||
echo "════════════════════════════════════════════════════════"
|
||||
echo "Deploy Chain 138 Explorer to Production"
|
||||
echo "════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Check if files exist
|
||||
if [ ! -f "$REPO_ROOT/frontend/public/index.html" ]; then
|
||||
log_error "Frontend file not found: $REPO_ROOT/frontend/public/index.html"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_step "Step 1: Backing up current deployment..."
|
||||
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no root@"$IP" \
|
||||
"cp /var/www/html/index.html /var/www/html/index.html.backup.$(date +%Y%m%d_%H%M%S) 2>/dev/null || true"
|
||||
|
||||
log_success "Backup created"
|
||||
|
||||
log_step "Step 2: Deploying frontend files..."
|
||||
sshpass -p "$PASSWORD" scp -o StrictHostKeyChecking=no \
|
||||
"$REPO_ROOT/frontend/public/index.html" \
|
||||
root@"$IP":/var/www/html/index.html
|
||||
|
||||
log_success "Frontend deployed"
|
||||
|
||||
log_step "Step 3: Verifying deployment..."
|
||||
sleep 2
|
||||
if curl -k -sI "https://$DOMAIN/" 2>&1 | grep -qi "HTTP.*200"; then
|
||||
log_success "Deployment verified - Explorer is accessible"
|
||||
else
|
||||
log_warn "Deployment completed but verification failed - check manually"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
log_success "Deployment complete!"
|
||||
echo ""
|
||||
log_info "Explorer URL: https://$DOMAIN/"
|
||||
log_info "To rollback: ssh root@$IP 'cp /var/www/html/index.html.backup.* /var/www/html/index.html'"
|
||||
echo ""
|
||||
|
||||
56
scripts/test.sh
Executable file
56
scripts/test.sh
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# Test Explorer Functionality
|
||||
# Runs basic tests on the deployed explorer
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DOMAIN="${DOMAIN:-explorer.d-bis.org}"
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
PASSED=0
|
||||
FAILED=0
|
||||
|
||||
test_endpoint() {
|
||||
local name="$1"
|
||||
local url="$2"
|
||||
|
||||
if curl -k -sI "$url" 2>&1 | grep -qi "HTTP.*200"; then
|
||||
log_success "$name: Passed"
|
||||
((PASSED++))
|
||||
return 0
|
||||
else
|
||||
log_error "$name: Failed"
|
||||
((FAILED++))
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "════════════════════════════════════════════════════════"
|
||||
echo "Explorer Functionality Test"
|
||||
echo "════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
test_endpoint "Home Page" "https://$DOMAIN/"
|
||||
test_endpoint "API Stats" "https://$DOMAIN/api/v2/stats"
|
||||
|
||||
echo ""
|
||||
echo "Tests Passed: $PASSED"
|
||||
echo "Tests Failed: $FAILED"
|
||||
|
||||
if [ $FAILED -eq 0 ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user