# RecruitAI Export Pack — Deployment Guide

## Overview

The **RecruitAI Export Pack** is a complete, standalone deployment package containing:
- ✅ All HTML pages for RecruitAI platform
- ✅ Industry landing pages (Retail, Finance, F&B, Logistics, Professional)
- ✅ Module pages (Customer Service, Growth, Business Ops, Marketing, Analytics)
- ✅ Full-featured PHP admin panel for image management
- ✅ Production-ready CSS, JavaScript, and assets
- ✅ Configured for Apache with mod_rewrite

**Size**: ~23KB (zipped framework) + images
**Build Date**: 2026-03-18
**Version**: 1.0.0

---

## 📋 Contents

```
recruitai-pack.zip (23 KB)
└── recruitai-pack/
    ├── index.html                 # Home page
    ├── consultation.html          # Consultation booking
    ├── contact.html               # Contact form
    ├── carnival.html              # Events page
    ├── privacy-policy.html
    ├── terms.html
    │
    ├── industries/                # Industry pages
    │   ├── professional.html
    │   ├── retail.html
    │   ├── finance.html
    │   ├── fnb.html
    │   └── logistics.html
    │
    ├── modules/                   # AI module pages
    │   ├── customer-service.html
    │   ├── growth.html
    │   ├── business-ops.html
    │   ├── marketing.html
    │   └── analytics.html
    │
    ├── assets/
    │   ├── css/style.css          # Main stylesheet
    │   ├── js/app.js              # Client-side interactivity
    │   └── fonts/                 # Custom fonts (placeholder)
    │
    ├── images/                    # Site images (all writable)
    │   ├── hero/                  # Hero banner images
    │   ├── industries/            # Industry page images
    │   ├── modules/               # Module page images
    │   ├── icons/                 # Logos & icons
    │   ├── avatars/               # Team member photos
    │   └── uploads/               # User-uploaded files
    │
    ├── admin/                     # Admin panel
    │   ├── index.php              # Login & dashboard
    │   ├── config.php             # Configuration
    │   ├── api/handler.php        # Image upload/compress API
    │   └── logs.txt               # Activity log
    │
    ├── .htaccess                  # Apache routing & caching
    ├── _build.js                  # Build script (reference)
    └── README.md                  # Full documentation
```

---

## 🚀 Deployment Steps

### Step 1: Download & Extract

```bash
# Download the zip file
# Extract it
unzip recruitai-pack.zip

# This creates a directory: recruitai-pack/
```

### Step 2: Upload to Web Server

#### Option A: SFTP/FTP
```bash
# Using SFTP
sftp user@server.com
cd /var/www/
put -r recruitai-pack/
exit
```

#### Option B: Command Line (SSH)
```bash
# Copy via SCP
scp -r recruitai-pack/ user@server.com:/var/www/

# Or clone from git (if available)
git clone https://github.com/5MLTECH/recruitai-pack.git /var/www/recruitai-pack
```

#### Option C: Web Host Control Panel
1. Login to cPanel / Plesk / etc.
2. File Manager → Navigate to `public_html`
3. Upload & Extract `recruitai-pack.zip`

### Step 3: Configure Permissions

```bash
# SSH into server
ssh user@server.com

# Navigate to deployment directory
cd /var/www/recruitai-pack

# Set proper permissions
chmod 755 .                    # Root directory
chmod 755 admin/               # Admin directory (writable)
chmod 755 images/              # Images directory (writable)
chmod 644 *.html              # HTML files (readable)
chmod 644 .htaccess           # Rewrite rules
chmod 644 assets/css/*.css    # CSS files
chmod 644 assets/js/*.js      # JS files
chmod 600 admin/config.php    # Config (secrets!)
chmod 700 admin/api/*.php     # API endpoints
```

### Step 4: Configure Apache (if needed)

Ensure Apache has these modules enabled:

```bash
# Check if mod_rewrite is enabled
apache2ctl -M | grep rewrite

# If not, enable it:
a2enmod rewrite

# Restart Apache
systemctl restart apache2
```

### Step 5: Update Configuration

Edit `admin/config.php`:

```php
<?php
// Change default password!
$ADMIN_PASS = 'your-secure-password-here';

// Set your site details
$SITE_NAME = 'RecruitAI';
$SITE_URL = 'https://recruitai.yourcompany.com';
$SITE_DOMAIN = 'recruitai.yourcompany.com';

// Optional: CDN configuration
$USE_CDN = false;
// $CDN_URL = 'https://cdn.example.com/recruitai';

// Logging
$ENABLE_FILE_LOGGING = true;
?>
```

### Step 6: Test the Deployment

1. **Public website**: Visit `https://yoursite.com/`
   - Check home page loads
   - Test navigation links
   - Verify all pages accessible

2. **Admin panel**: Visit `https://yoursite.com/admin/`
   - Login with your password
   - Upload a test image
   - Verify it appears in `/images/`

3. **Image serving**: Check `https://yoursite.com/images/uploads/test.jpg`

4. **HTTPS**: Verify SSL certificate is valid

---

## 🔧 Advanced Configuration

### CDN Integration

To serve images from a CDN:

```php
// admin/config.php
$USE_CDN = true;
$CDN_URL = 'https://cdn.yourcompany.com/recruitai';
$CDN_API_KEY = getenv('CDN_API_KEY') ?: 'your-key';

// Images will then serve from:
// https://cdn.yourcompany.com/recruitai/images/hero/main.jpg
```

### Custom Domain with SSL

#### Using Let's Encrypt (Recommended)

```bash
# Install certbot if needed
apt-get install certbot python3-certbot-apache

# Generate certificate
certbot certonly --apache -d recruitai.yourcompany.com

# Update Apache config
# The certificate will auto-renew
```

#### Enforce HTTPS in .htaccess

Add to `.htaccess`:
```apache
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
```

### Restrict Admin Access by IP

In `admin/index.php`, add:
```php
<?php
$ALLOWED_IPS = ['203.0.113.0', '198.51.100.0'];
$clientIP = $_SERVER['REMOTE_ADDR'];

if (!in_array($clientIP, $ALLOWED_IPS)) {
  http_response_code(403);
  die('Access denied');
}
?>
```

### Enable Image Compression with GD

Ensure PHP GD extension is installed:

```bash
# Check if installed
php -m | grep gd

# If not, install it
apt-get install php-gd
systemctl restart apache2
```

Then in admin panel, you'll see "Compress" options.

### Backup Strategy

Set up automated backups:

```bash
# Backup daily (add to crontab)
0 2 * * * tar -czf /backups/recruitai-$(date +\%Y\%m\%d).tar.gz /var/www/recruitai-pack/

# Keep last 30 days
find /backups -name "recruitai-*.tar.gz" -mtime +30 -delete
```

---

## 🎨 Content Updates

### Edit HTML Pages

Pages can be edited directly—no build step required:

```html
<!-- recruitai-pack/index.html -->
<section>
  <h1>Welcome to RecruitAI</h1>
  <p>Edit this text directly!</p>
</section>
```

Changes take effect immediately (hard refresh: `Ctrl+Shift+R`).

### Update Styles

Edit `assets/css/style.css`:

```css
/* Global color scheme */
:root {
  --color-primary: #667eea;
  --color-secondary: #764ba2;
}

/* Add custom rules */
.my-custom-class {
  background: var(--color-primary);
  padding: 2rem;
}
```

### Update Images

Use the Admin Panel:
1. Visit `/admin/`
2. Login with your password
3. Upload images to appropriate category
4. Update HTML `src` attributes

Example:
```html
<img src="/images/hero/main.jpg" alt="Main Hero">
<img src="/images/industries/retail.jpg" alt="Retail Industry">
```

### Update Navigation

Edit navigation in HTML:

```html
<nav>
  <a href="index.html">Home</a>
  <a href="industries/retail.html">Retail</a>
  <a href="consultation.html">Consultation</a>
  <a href="contact.html">Contact</a>
</nav>
```

---

## 📊 Performance Optimization

### Image Optimization

Recommended sizes:
- **Hero images**: 1920×1080px, 50-100KB
- **Industry pages**: 1200×800px, 30-50KB
- **Module pages**: 1200×600px, 20-40KB
- **Thumbnails**: 300×300px, 10-20KB

Use compression tools:
- https://tinypng.com/ (PNG/JPEG)
- https://squoosh.app/ (Convert to WebP)
- Admin panel (automatic if GD available)

### Leverage Browser Caching

The `.htaccess` already configures caching:
```apache
# Images: 1 year
# CSS/JS: 1 month
# HTML: 2 days
```

### Enable Gzip Compression

Already enabled in `.htaccess`:
```apache
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css text/javascript
</IfModule>
```

Verify it's working:
```bash
curl -I https://recruitai.yourcompany.com/ | grep -i content-encoding
# Should show: content-encoding: gzip
```

### Test Performance

- **PageSpeed**: https://pagespeed.web.dev/
- **GTmetrix**: https://gtmetrix.com/
- **Lighthouse**: Built into Chrome DevTools

---

## 🔐 Security Checklist

- [ ] Changed admin password in `admin/config.php`
- [ ] Set proper file permissions (chmod 755 for dirs, 644 for files)
- [ ] Enabled HTTPS with valid SSL certificate
- [ ] Configured firewall to allow only HTTP/HTTPS
- [ ] Set up daily backups
- [ ] Enabled access logging in admin panel
- [ ] Restricted admin access by IP (optional)
- [ ] Disabled directory listing in `.htaccess`
- [ ] Removed debug mode (PHP errors not displayed)
- [ ] Tested form validation and CSRF protection

---

## 🐛 Troubleshooting

### 404 Errors on Pages

**Cause**: Apache `mod_rewrite` not working

**Fix**:
```bash
# Check if enabled
apache2ctl -M | grep rewrite

# Enable if needed
a2enmod rewrite
systemctl restart apache2

# Check .htaccess exists
ls -la /var/www/recruitai-pack/.htaccess

# Verify AllowOverride in Apache config
# Should include: AllowOverride All
```

### Images Not Loading

**Cause**: Wrong image paths or permissions

**Fix**:
```bash
# Check images directory
ls -la /var/www/recruitai-pack/images/

# Fix permissions
chmod 755 /var/www/recruitai-pack/images/
chmod 644 /var/www/recruitai-pack/images/*

# Verify path in HTML
# Should be: <img src="/images/category/filename.jpg">
```

### Admin Panel Won't Load

**Cause**: PHP not configured or missing

**Fix**:
```bash
# Check PHP version
php -v

# Check PHP modules
php -m | grep gd  # For compression

# Test PHP file directly
php /var/www/recruitai-pack/admin/index.php

# Check permissions
chmod 644 /var/www/recruitai-pack/admin/*.php
chmod 755 /var/www/recruitai-pack/admin/
```

### Uploads Failing

**Cause**: Directory not writable

**Fix**:
```bash
# Make images directory writable
chmod 777 /var/www/recruitai-pack/images/

# Check server user
ps aux | grep apache
# Typically: www-data or apache

# Verify ownership
chown -R www-data:www-data /var/www/recruitai-pack/images/
```

### HTTPS Certificate Errors

**Cause**: SSL certificate issues

**Fix**:
```bash
# Check certificate expiry
openssl s_client -connect recruitai.yourcompany.com:443 -showcerts

# Renew Let's Encrypt
certbot renew

# Update .htaccess to force HTTPS
# See "Advanced Configuration" section above
```

---

## 📞 Support & Updates

### Getting Help

1. **Check README.md** in the pack
2. **Review this guide** (you're reading it!)
3. **Check logs**: `/admin/logs.txt`
4. **Contact support**: support@5ml-tech.com

### Updating Content

The export pack is **static**. To get updates:
1. Request a new export from 5ML Tech
2. Back up your current installation
3. Download and deploy the new version
4. Restore custom images and content

### Keeping Secure

- Keep admin password strong
- Enable access logging
- Monitor `/admin/logs.txt` regularly
- Keep backups updated
- Update PHP/Apache regularly

---

## 📈 Next Steps

After deployment:

1. ✅ Upload hero and industry images
2. ✅ Add team member avatars
3. ✅ Customize text content
4. ✅ Set up analytics tracking
5. ✅ Configure email notifications for forms
6. ✅ Monitor performance metrics
7. ✅ Plan regular content updates

---

## 🎉 Congratulations!

Your RecruitAI platform is now live! 

- **Public URL**: https://recruitai.yourcompany.com/
- **Admin Panel**: https://recruitai.yourcompany.com/admin/
- **Documentation**: See README.md in the pack

**Questions?** Contact: support@5ml-tech.com

---

**Built by 5ML Tech | © 2026**
