# Quick Start Guide - Property Inspection App

## 🚀 Fast Deployment (5 minutes)

### Prerequisites
- Ubuntu 20.04+ server
- Domain name pointing to your server
- SSH access with sudo privileges

### Step 1: Download and Extract
```bash
# Download the deployment package to your server
wget [DEPLOYMENT_PACKAGE_URL] -O property-inspection-deployment.tar.gz

# Extract the package
tar -xzf property-inspection-deployment.tar.gz
cd property-inspection-deployment
```

### Step 2: Run Installation Script
```bash
# Make the script executable and run it
chmod +x install.sh
./install.sh
```

### Step 3: Configure Domain
```bash
# Edit Nginx configuration with your domain
sudo nano /etc/nginx/sites-available/property-inspection

# Replace 'yourdomain.com' with your actual domain
# Save and exit (Ctrl+X, Y, Enter)

# Restart Nginx
sudo systemctl restart nginx
```

### Step 4: Set Up SSL (Optional but Recommended)
```bash
# Install Certbot
sudo apt install certbot python3-certbot-nginx

# Get SSL certificate
sudo certbot --nginx -d yourdomain.com
```

### Step 5: Verify Installation
```bash
# Check backend service
sudo -u propinspect pm2 status

# Check Nginx status
sudo systemctl status nginx

# View logs if needed
sudo -u propinspect pm2 logs
```

## 🎉 You're Done!

Your Property Inspection App should now be accessible at:
- **HTTP**: http://yourdomain.com
- **HTTPS**: https://yourdomain.com (if SSL configured)

## 🔧 Default Configuration

### Application Features
- ✅ Single "New Inspection" workflow
- ✅ Property Details → Exterior Tab → Interior Tab (Room-by-Room)
- ✅ Email/password authentication
- ✅ Photo uploads and voice memos
- ✅ Professional PDF reports
- ✅ 25+ room types with auto-populated checklists

### File Locations
- **Application**: `/home/propinspect/app/`
- **Database**: `/home/propinspect/app/backend/property_inspection.db`
- **Uploads**: `/home/propinspect/app/uploads/`
- **Logs**: `/home/propinspect/app/logs/`
- **Backups**: `/home/propinspect/app/backups/`

### Service Management
```bash
# Start/Stop/Restart backend
sudo -u propinspect pm2 start/stop/restart all

# View logs
sudo -u propinspect pm2 logs

# Restart Nginx
sudo systemctl restart nginx
```

## 🆘 Troubleshooting

### Common Issues

1. **Service not starting**
   ```bash
   sudo -u propinspect pm2 logs
   ```

2. **Database errors**
   ```bash
   cd /home/propinspect/app/backend
   sudo -u propinspect bash -c "source venv/bin/activate && python -c 'from src.models.user_email import db; from src.main import create_app; app = create_app(); app.app_context().push(); db.create_all()'"
   ```

3. **Permission issues**
   ```bash
   sudo chown -R propinspect:propinspect /home/propinspect/app
   sudo chmod -R 755 /home/propinspect/app
   ```

4. **Nginx configuration**
   ```bash
   sudo nginx -t
   sudo systemctl restart nginx
   ```

### Getting Help
- Check logs: `sudo -u propinspect pm2 logs`
- Check Nginx logs: `sudo tail -f /var/log/nginx/property-inspection-error.log`
- Verify services: `sudo -u propinspect pm2 status` and `sudo systemctl status nginx`

## 🔄 Updates

To update the application:
1. Stop services: `sudo -u propinspect pm2 stop all`
2. Replace files in `/home/propinspect/app/`
3. Restart services: `sudo -u propinspect pm2 restart all`
4. Restart Nginx: `sudo systemctl restart nginx`

