# Blockscout Explorer Fix - Status Report

**Date**: $(date)  
**Status**: ⚠️ **IN PROGRESS - Manual Steps Required**

---

## Current Situation

The Blockscout explorer container (VMID 5000) exists and is running on node **pve2** in the Proxmox cluster.

### Issues Identified

1. ✅ Container exists and is running on pve2
2. ⚠️ Blockscout service may not be installed/configured
3. ❌ Nginx reverse proxy not installed
4. ❌ Cloudflare DNS/tunnel not configured

### Cluster Configuration

- **Cluster Nodes**: ml110, pve, pve2
- **Container Location**: pve2
- **Container VMID**: 5000
- **Container IP**: 192.168.11.140 (DHCP assigned)
- **Container Hostname**: blockscout-1

---

## Scripts Created

All fix scripts have been created and are available:

1. ✅ `scripts/install-nginx-blockscout.sh` - Nginx installation
2. ✅ `scripts/configure-cloudflare-explorer.sh` - Cloudflare configuration
3. ✅ `scripts/fix-blockscout-explorer.sh` - Comprehensive fix script
4. ✅ `scripts/deploy-and-fix-blockscout.sh` - Complete deployment script

**Note**: The scripts have cluster-awareness issues when using `pct exec` commands because the container is on a different node (pve2) than where the commands are executed (ml110).

---

## Manual Steps Required

Since the container is on pve2 but we're executing from ml110, some manual steps are needed:

### Option 1: Execute Commands Directly on pve2 Node

**SSH to pve2 and run commands there:**

```bash
# Find pve2's IP address first
ssh root@192.168.11.10 "pvecm nodes | grep pve2"

# Then SSH to pve2 (adjust IP if needed)
ssh root@<pve2-ip>

# Install Blockscout if not already installed
cd /opt/blockscout || cd /home/intlc/projects/proxmox/smom-dbis-138-proxmox
# Run installation script if needed

# Install and configure Nginx
cd /home/intlc/projects/proxmox
bash scripts/install-nginx-blockscout.sh 5000 192.168.11.140
```

### Option 2: Use Proxmox API (pvesh)

Commands can be executed via the Proxmox API, but functionality is limited compared to direct `pct exec`.

### Option 3: Copy Scripts to Container and Run Inside

```bash
# Copy script to container
pct push 5000 /path/to/script.sh /tmp/script.sh

# Execute inside container
pct exec 5000 -- bash /tmp/script.sh
```

---

## Recommended Approach

### Step 1: Verify Blockscout Installation

```bash
ssh root@192.168.11.10
pct exec 5000 -- systemctl status blockscout
pct exec 5000 -- docker ps
pct exec 5000 -- ls -la /opt/blockscout
```

### Step 2: Install Nginx (Run from Proxmox host on any node)

```bash
ssh root@192.168.11.10
cd /home/intlc/projects/proxmox

# The install script should work if run from the Proxmox host
bash scripts/install-nginx-blockscout.sh 5000 192.168.11.140
```

If that fails, try:

```bash
# Copy install script to container
pct push 5000 scripts/install-nginx-blockscout.sh /tmp/install-nginx.sh

# Modify script to run locally (remove SSH commands)
# Or run installation commands directly:
pct exec 5000 -- bash -c "apt-get update && apt-get install -y nginx"
pct exec 5000 -- bash -c "mkdir -p /etc/nginx/ssl"
# ... continue with Nginx configuration
```

### Step 3: Configure Cloudflare

```bash
cd /home/intlc/projects/proxmox
# Ensure .env file exists with CLOUDFLARE_API_TOKEN
bash scripts/configure-cloudflare-explorer.sh
```

Or configure manually in Cloudflare dashboard:
- DNS: CNAME explorer.d-bis.org → <tunnel-id>.cfargotunnel.com (🟠 Proxied)
- Tunnel: explorer.d-bis.org → http://192.168.11.140:80

---

## Next Steps

1. **Test container access**:
   ```bash
   ssh root@192.168.11.10
   pct exec 5000 -- hostname
   pct exec 5000 -- ip addr show eth0
   ```

2. **If container is accessible, run fix script**:
   ```bash
   cd /home/intlc/projects/proxmox
   bash scripts/fix-blockscout-explorer.sh 5000 192.168.11.140
   ```

3. **If pct exec doesn't work, use direct container access**:
   - Find container IP: `pvesh get /nodes/pve2/lxc/5000/agent/network-get-interfaces`
   - SSH directly to container if SSH is enabled
   - Or copy scripts into container and execute

4. **Configure Cloudflare DNS/tunnel**

5. **Test**: `curl https://explorer.d-bis.org/health`

---

## Files Created

- ✅ `scripts/install-nginx-blockscout.sh`
- ✅ `scripts/configure-cloudflare-explorer.sh`
- ✅ `scripts/fix-blockscout-explorer.sh`
- ✅ `scripts/deploy-and-fix-blockscout.sh`
- ✅ `docs/BLOCKSCOUT_EXPLORER_FIX.md`
- ✅ `docs/BLOCKSCOUT_FIX_STATUS.md` (this file)

---

**Note**: The scripts are ready to use, but may need to be executed directly on the Proxmox host or from within the container due to cluster node differences.

