Some checks failed
AITBC CI/CD Pipeline / lint-and-test (3.11) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.12) (push) Has been cancelled
AITBC CI/CD Pipeline / lint-and-test (3.13) (push) Has been cancelled
AITBC CI/CD Pipeline / test-cli (push) Has been cancelled
AITBC CI/CD Pipeline / test-services (push) Has been cancelled
AITBC CI/CD Pipeline / test-production-services (push) Has been cancelled
AITBC CI/CD Pipeline / security-scan (push) Has been cancelled
AITBC CI/CD Pipeline / build (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-staging (push) Has been cancelled
AITBC CI/CD Pipeline / deploy-production (push) Has been cancelled
AITBC CI/CD Pipeline / performance-test (push) Has been cancelled
AITBC CI/CD Pipeline / docs (push) Has been cancelled
AITBC CI/CD Pipeline / release (push) Has been cancelled
AITBC CI/CD Pipeline / notify (push) Has been cancelled
Security Scanning / Bandit Security Scan (apps/coordinator-api/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (cli/aitbc_cli) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-core/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-crypto/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (packages/py/aitbc-sdk/src) (push) Has been cancelled
Security Scanning / Bandit Security Scan (tests) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (javascript) (push) Has been cancelled
Security Scanning / CodeQL Security Analysis (python) (push) Has been cancelled
Security Scanning / Dependency Security Scan (push) Has been cancelled
Security Scanning / Container Security Scan (push) Has been cancelled
Security Scanning / OSSF Scorecard (push) Has been cancelled
Security Scanning / Security Summary Report (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.11) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.12) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-cli-level1 (3.13) (push) Has been cancelled
AITBC CLI Level 1 Commands Test / test-summary (push) Has been cancelled
- Remove debugging service documentation (DEBUgging_SERVICES.md) - Remove development logs policy and quick reference guides - Remove E2E test creation summary - Remove gift certificate example file - Remove GitHub pull summary documentation
95 lines
2.4 KiB
Bash
Executable File
95 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Deploy blockchain explorer to incus container
|
|
|
|
set -e
|
|
|
|
echo "🔍 Deploying Blockchain Explorer"
|
|
echo "================================="
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
print_status() {
|
|
echo -e "${GREEN}[INFO]${NC} $1"
|
|
}
|
|
|
|
print_warning() {
|
|
echo -e "${YELLOW}[WARN]${NC} $1"
|
|
}
|
|
|
|
# Copy explorer to container
|
|
print_status "Copying blockchain explorer to container..."
|
|
ssh ns3-root "rm -rf /opt/blockchain-explorer 2>/dev/null || true"
|
|
scp -r apps/blockchain-explorer ns3-root:/opt/
|
|
|
|
# Setup explorer in container
|
|
print_status "Setting up blockchain explorer..."
|
|
ssh ns3-root << 'EOF'
|
|
cd /opt/blockchain-explorer
|
|
|
|
# Create Python environment
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
EOF
|
|
|
|
# Create systemd service for explorer
|
|
print_status "Creating systemd service for blockchain explorer..."
|
|
ssh ns3-root << 'EOF'
|
|
cat > /etc/systemd/system/blockchain-explorer.service << EOL
|
|
[Unit]
|
|
Description=AITBC Blockchain Explorer
|
|
After=blockchain-rpc.service
|
|
|
|
[Service]
|
|
Type=exec
|
|
User=root
|
|
WorkingDirectory=/opt/blockchain-explorer
|
|
Environment=PATH=/opt/blockchain-explorer/.venv/bin:/usr/local/bin:/usr/bin:/bin
|
|
ExecStart=/opt/blockchain-explorer/.venv/bin/python3 main.py
|
|
Restart=always
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOL
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable blockchain-explorer
|
|
EOF
|
|
|
|
# Start explorer
|
|
print_status "Starting blockchain explorer..."
|
|
ssh ns3-root "systemctl start blockchain-explorer"
|
|
|
|
# Wait for explorer to start
|
|
print_status "Waiting for explorer to start..."
|
|
sleep 3
|
|
|
|
# Setup port forwarding for explorer
|
|
print_status "Setting up port forwarding for explorer..."
|
|
ssh ns3-root << 'EOF'
|
|
# Add port forwarding for explorer
|
|
iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000
|
|
iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE
|
|
|
|
# Save rules
|
|
iptables-save > /etc/iptables/rules.v4
|
|
EOF
|
|
|
|
# Check status
|
|
print_status "Checking blockchain explorer status..."
|
|
ssh ns3-root "systemctl status blockchain-explorer --no-pager | grep -E 'Active:|Main PID:'"
|
|
|
|
print_success "✅ Blockchain explorer deployed!"
|
|
echo ""
|
|
echo "Explorer URL: http://192.168.100.10:3000"
|
|
echo "External URL: http://aitbc.keisanki.net:3000"
|
|
echo ""
|
|
echo "The explorer will automatically connect to the local blockchain node."
|
|
echo "You can view blocks, transactions, and chain statistics."
|