# QBPOS Help Site - Auto-Start & Monitoring Configuration

## ✅ Current Status

Your QBPOS Help site is now configured for automatic startup and monitoring:

### 🔄 Auto-Start on Boot

- **Nginx Service**: Enabled to start automatically on server reboot
- **SSL Auto-Renewal**: Enabled (certbot.timer checks twice daily)
- **Health Check**: Enabled to run every 5 minutes

### 🔍 Monitoring & Health Checks

The site is monitored every 5 minutes with automatic recovery:

- Checks if nginx is running (restarts if stopped)
- Verifies site responds with HTTP 200
- Automatically reloads nginx if site is down
- Logs all checks to `/var/log/qbpos-health-check.log`

### 📊 Site Information

- **URL**: <https://quickbookposhelp.access.ly>
- **No port or path needed** - just the domain!
- **SSL Certificate**: Let's Encrypt (expires April 9, 2026)
- **Auto-renewal**: Enabled

---

## 🛠️ Management Commands

### Check Service Status

```bash
sudo systemctl status nginx
sudo systemctl status qbpos-health-check.timer
```

### View Health Check Logs

```bash
tail -f /var/log/qbpos-health-check.log
```

### Manual Health Check

```bash
sudo /home/pts/Documents/QBPOS_Help_Web/health_check.sh
```

### Restart Services

```bash
sudo systemctl restart nginx
sudo systemctl restart qbpos-health-check.timer
```

### View Next Scheduled Health Check

```bash
systemctl list-timers | grep qbpos
```

---

## 🔧 What Happens on Server Reboot

1. **Network comes online**
2. **Nginx starts automatically** (serves the site)
3. **2 minutes after boot**: First health check runs
4. **Every 5 minutes**: Health check verifies site is up
5. **If site is down**: Automatic recovery attempts

---

## 📝 Configuration Files

- Nginx config: `/etc/nginx/sites-available/qbpos-help`
- Health check script: `/home/pts/Documents/QBPOS_Help_Web/health_check.sh`
- Systemd service: `/etc/systemd/system/qbpos-health-check.service`
- Systemd timer: `/etc/systemd/system/qbpos-health-check.timer`
- Health log: `/var/log/qbpos-health-check.log`

---

## ✅ Verification Checklist

All services are enabled and running:

- [x] Nginx service enabled
- [x] Nginx currently running
- [x] SSL certificate installed
- [x] SSL auto-renewal enabled
- [x] Health check timer enabled
- [x] Site accessible via <https://quickbookposhelp.access.ly>

**Your site is production-ready and will survive server reboots!**
