# Fix BTCPay via Hostinger Console Access

Since SSH access isn't working, use the Hostinger web console:

## Step 1: Access Hostinger Console
1. Go to https://hpanel.hostinger.com/
2. Login to your Hostinger account
3. Find VPS server: srv1002428.hstgr.cloud
4. Click on the server
5. Look for "Console" or "VNC Console" or "Browser Terminal"
6. Click to open web-based terminal

## Step 2: Login via Console
```
Username: ubuntu
Password: (the one you set during hardening)

OR if that doesn't work:

Username: root
Password: Th3fa1r13sd1d1t.
```

## Step 3: Diagnose the Issue
Run these commands to see what's wrong:

```bash
# Become root if logged in as ubuntu
sudo su -

# Check container status
docker ps -a | grep -E "btcpay|nginx|postgres"

# Look for stopped containers
docker ps -a | grep Exited
```

## Step 4: Fix Based on What You Find

### If BTCPay container is "Exited":
```bash
# Start it
docker start generated_btcpayserver_1

# Check logs for why it crashed
docker logs generated_btcpayserver_1 --tail 100
```

### If Postgres is "Exited":
```bash
# Start database first
docker start generated_postgres_1

# Wait 10 seconds
sleep 10

# Then start BTCPay
docker start generated_btcpayserver_1
```

### If all containers are running but still 502:
```bash
# Full restart
cd /opt/btcpayserver-docker
./btcpay-restart.sh

# Wait 2 minutes for services to fully start
sleep 120

# Check status
docker ps
```

### If containers keep crashing:
```bash
# Check disk space
df -h /

# If disk is full (>90%):
docker system prune -a --volumes
# WARNING: Type 'y' carefully - this removes unused data

# Check memory
free -h

# If memory is low (<500MB free):
systemctl restart docker
```

## Step 5: Nuclear Option - Rebuild
If nothing works:

```bash
# Stop everything
cd /opt/btcpayserver-docker
docker-compose down

# Restart with fresh build
source /opt/.env
./btcpay-setup.sh -i
```

## Step 6: Monitor the Fix
```bash
# Watch containers starting
watch docker ps

# In another console tab, monitor logs
docker logs -f generated_btcpayserver_1
```

## What to Look For in Logs

**Good signs:**
- "BTCPay Server started"
- "Listening on port"
- "Connected to NBXplorer"

**Bad signs:**
- "Cannot connect to database"
- "Port already in use"
- "Out of memory"
- "No space left on device"

## If Database is Corrupted
```bash
# Last resort - reset database (loses data!)
docker-compose down
docker volume rm generated_postgres_datadir
./btcpay-setup.sh -i
```

## Re-enable SSH Access
While in console, fix SSH:

```bash
# Re-add your SSH key for ubuntu user
mkdir -p /home/ubuntu/.ssh
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDoUnUn5wsJyelx5NAzP1lrcTBKAV93m8R1hlR0ZU07Z vps-hardening-20250910" > /home/ubuntu/.ssh/authorized_keys
chown -R ubuntu:ubuntu /home/ubuntu/.ssh
chmod 700 /home/ubuntu/.ssh
chmod 600 /home/ubuntu/.ssh/authorized_keys

# Restart SSH
systemctl restart sshd
```

Then test from your local machine:
```bash
ssh -p 2255 -i vps_hardening_key ubuntu@thebankofdebbie.giize.com
```