#!/bin/bash
# Interactive deployment checklist
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
echo "🚀 Pear-Git Deployment Checklist"
echo "================================"
echo ""
# Check 1: VPN connectivity
echo "📡 Step 1: Check VPN connectivity"
echo " Command: ping -c 3 10.22.0.1"
if ping -c 3 10.22.0.1 > /dev/null 2>&1; then
echo " ✅ VPN is UP"
else
echo " ❌ VPN is DOWN - check hyperident-gateway"
echo " Fix: sudo systemctl status hyperident-gateway"
exit 1
fi
echo ""
# Check 2: Pear-git running locally
echo "📦 Step 2: Check pear-git server"
echo " Command: lsof -i :3003"
if lsof -i :3003 > /dev/null 2>&1; then
echo " ✅ Pear-git is running on port 3003"
PID=$(lsof -ti :3003)
echo " PID: $PID"
else
echo " ❌ Pear-git NOT running"
echo " Fix: ./scripts/pear-git-start.sh"
exit 1
fi
echo ""
# Check 3: Can reach via VPN IP
echo "🔌 Step 3: Check VPN access to pear-git"
echo " Command: curl -s http://10.22.0.2:3003/git/ | head -5"
if curl -s http://10.22.0.2:3003/git/ | grep -q "Pear Git"; then
echo " ✅ Pear-git accessible via VPN (10.22.0.2:3003)"
else
echo " ❌ Cannot reach pear-git via VPN IP"
echo " Check: Pear-git running with --vpn flag?"
echo " Check: Bound to correct IP?"
exit 1
fi
echo ""
# Check 4: Apache config on 7rnx.net (requires SSH)
echo "🌐 Step 4: Check Apache configuration on 7rnx.net"
echo " This requires SSH to 7rnx.net..."
read -p " Press Enter to check (requires sudo on 7rnx.net)..."
if ssh 7rnx.net "grep -q '/git' /etc/apache2/sites-available/7rnx.net-le-ssl.conf" 2>/dev/null; then
echo " ✅ Apache config includes /git proxy"
else
echo " ❌ Apache config NOT updated"
echo ""
echo " 📝 To fix:"
echo " 1. Run: ./scripts/deploy-7rnx.sh"
echo " 2. In tmux: mosh 7rnx.net"
echo " 3. Edit: sudo nano /etc/apache2/sites-available/7rnx.net-le-ssl.conf"
echo " 4. Add config from APACHE_CONFIG.txt"
echo " 5. Test: sudo apache2ctl configtest"
echo " 6. Reload: sudo systemctl reload apache2"
exit 1
fi
echo ""
# Check 5: Can reach from 7rnx.net
echo "🔗 Step 5: Check proxy from 7rnx.net to tabertron"
echo " Command: ssh 7rnx.net curl -s http://10.22.0.2:3003/git/"
if ssh 7rnx.net "curl -s http://10.22.0.2:3003/git/" | grep -q "Pear Git"; then
echo " ✅ 7rnx.net can reach tabertron via VPN"
else
echo " ❌ 7rnx.net CANNOT reach tabertron"
echo " Check: VPN connectivity from 7rnx.net?"
echo " Check: hyperident-gateway client on 7rnx.net?"
exit 1
fi
echo ""
# Check 6: Public HTTPS access
echo "🌍 Step 6: Check public HTTPS access"
echo " Command: curl -s https://7rnx.net/git/"
if curl -s https://7rnx.net/git/ | grep -q "Pear Git"; then
echo " ✅ Public HTTPS access WORKS!"
echo ""
echo " 🎉 Deployment successful!"
echo ""
echo " Access URLs:"
echo " - Web UI: https://7rnx.net/git/"
echo " - Git clone: https://7rnx.net/git/user/repo.git"
echo ""
else
echo " ❌ Public HTTPS access NOT working"
echo ""
echo " Debug steps:"
echo " 1. Check Apache logs: ssh 7rnx.net sudo tail /var/log/apache2/7rnx.net-error.log"
echo " 2. Test local: curl http://localhost/git/ (from 7rnx.net)"
echo " 3. Test VPN: curl http://10.22.0.2:3003/git/ (from 7rnx.net)"
echo " 4. Check Apache status: ssh 7rnx.net sudo systemctl status apache2"
exit 1
fi
echo ""
echo "✅ All checks passed!"
echo ""
echo "📋 Useful commands:"
echo " View logs: ./scripts/pear-git-logs.sh"
echo " Restart: ./scripts/pear-git-stop.sh && ./scripts/pear-git-start.sh"
echo " Apache logs: ssh 7rnx.net sudo tail -f /var/log/apache2/7rnx.net-error.log"
echo ""
echo "🚀 Next steps:"
echo " 1. Open https://7rnx.net/git/"
echo " 2. Click '🔍 Scan Filesystem'"
echo " 3. Import repos to P2P"
echo " 4. Share with collaborators!"