# Complete Fix Guide - All Remaining Issues

**Issues Found:**
1. ❌ Redis: Connection refused (not starting)
2. ⚠️ Vault: Not responding
3. ⚠️ Web3Signer: No keys found (0 keys in directory)
4. ⚠️ Allowlist: Cannot configure (no keys loaded)

## 🚀 Complete Fix Script

Run the comprehensive fix script that addresses all issues including key generation:

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/fix-all-issues-complete.sh
```

## 📋 Manual Fix Steps

### 1. Fix Redis (VMID 106)

```bash
# Check if Redis is installed
ssh root@192.168.11.11 "pct exec 106 -- which redis-server"

# If not installed, install it
ssh root@192.168.11.11 "pct exec 106 -- apt-get update && apt-get install -y redis-server"

# Start and enable Redis
ssh root@192.168.11.11 "pct exec 106 -- systemctl enable redis-server && systemctl start redis-server && sleep 3"

# Verify
ssh root@192.168.11.11 "pct exec 106 -- redis-cli ping"
# Should return: PONG
```

### 2. Fix Vault (VMID 108)

```bash
# Check and start Vault
ssh root@192.168.11.11 "pct exec 108 -- systemctl status vault"
ssh root@192.168.11.11 "pct exec 108 -- systemctl enable vault && systemctl start vault && sleep 3"

# Verify
curl http://192.168.11.112:8200/v1/sys/health
```

### 3. Generate and Load Web3Signer Keys

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138

# Generate 3 test keys
./scripts/generate-test-keys.sh 3 TestWallet123!

# Load keys into Web3Signer (from Proxmox host)
ssh root@192.168.11.11 'bash -s' < scripts/load-keys-complete.sh

# Or manually:
ssh root@192.168.11.11 "pct exec 107 -- mkdir -p /opt/web3signer/data/keys"
for keyfile in keystores/keystore-*.json; do
    filename=$(basename "$keyfile")
    ssh root@192.168.11.11 "pct push 107 $keyfile /opt/web3signer/data/keys/$filename"
done
ssh root@192.168.11.11 "pct exec 107 -- bash -c 'for f in /opt/web3signer/data/keys/*.json; do [ -f \"\$f\" ] && chmod 644 \"\$f\"; done'"

# Restart Web3Signer
ssh root@192.168.11.11 "pct exec 107 -- systemctl daemon-reload && systemctl enable web3signer.service && systemctl restart web3signer.service && sleep 5"

# Verify keys loaded
curl http://192.168.11.111:9000/api/v1/eth1/publicKeys
```

### 4. Configure Allowlist

```bash
# Get addresses
ADDRESSES=$(curl -s http://192.168.11.111:9000/api/v1/eth1/publicKeys | jq -r '.[]' | tr '\n' ',' | sed 's/,$//')

# Configure
./scripts/configure-wallet-allowlist.sh "$ADDRESSES"

# Restart translators
for IP in 192.168.11.240 192.168.11.241 192.168.11.242; do
    ssh -i ~/.ssh/proxmox_translator root@$IP "systemctl restart rpc-translator-138.service"
done
```

## ✅ Verification

After running the fix, verify everything:

```bash
cd /home/intlc/projects/proxmox/rpc-translator-138
./scripts/check-all-status.sh
```

## Expected Results

After complete fix:
- ✅ Redis: Running (PONG)
- ✅ Vault: active
- ✅ Web3Signer: Health OK, 3 keys loaded
- ✅ Translators: All active, health ok, allowlist configured

---

**Run**: `./scripts/fix-all-issues-complete.sh` to fix everything automatically!
