# AVIOBOOTS — Deployment Guide

## 1. Server requirements
- PHP 8.2+ with extensions: `pdo`, `pdo_mysql` (or `pdo_sqlite`), `mbstring`, `openssl`, `tokenizer`, `xml`, `ctype`, `json`, `bcmath`, `fileinfo`, `gd`
- Composer 2.x
- MySQL 8.0+ or PostgreSQL 14+ (SQLite OK for tiny sites)
- Web server: Nginx or Apache
- Optional: Redis (sessions/cache), Supervisor (queue worker)

## 2. First deploy
```bash
git clone <repo> /var/www/avioboots
cd /var/www/avioboots

cp .env.production.example .env
nano .env                       # fill in DB, MAIL, APP_URL, then save

composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan migrate --force
php artisan db:seed --force     # creates admin@avioboots.com / admin123 + 72 products

# CHANGE THE ADMIN PASSWORD IMMEDIATELY (login → /admin → users → edit)

php artisan storage:link
php artisan config:cache
php artisan route:cache
php artisan view:cache

chown -R www-data:www-data storage bootstrap/cache public/uploads database
chmod -R 775 storage bootstrap/cache public/uploads database
```

## 3. Web server config

### Nginx
Point document root to `/var/www/avioboots/public`. Standard Laravel block:
```nginx
server {
    listen 443 ssl http2;
    server_name yourdomain.com;
    root /var/www/avioboots/public;
    index index.php;

    ssl_certificate     /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    location / { try_files $uri $uri/ /index.php?$query_string; }
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    location ~ /\.ht { deny all; }
}
```
Force HTTPS by redirecting port 80 to 443.

## 4. Cron + queue
Add to `crontab -e`:
```
* * * * * cd /var/www/avioboots && php artisan schedule:run >> /dev/null 2>&1
```

If you switch QUEUE_CONNECTION away from `sync`:
```
php artisan queue:work --tries=3 --timeout=90
```
(Run via Supervisor.)

## 5. Subsequent deploys
```bash
cd /var/www/avioboots
git pull
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan queue:restart
```

## 6. Post-launch checklist
- [ ] APP_DEBUG=false confirmed
- [ ] Admin password changed from default
- [ ] HTTPS + HSTS enabled
- [ ] `storage/logs` log rotation configured
- [ ] Daily DB backup cron in place
- [ ] `php artisan storage:link` ran (uploaded product images visible)
- [ ] SMTP credentials tested — place a test order, confirm email arrives
- [ ] robots.txt + /sitemap.xml reachable (already wired)
- [ ] Google Analytics / search console verified
- [ ] Real Google Maps embed in `resources/views/pages/contact.blade.php`
- [ ] Real social links in `resources/views/partials/footer.blade.php`
- [ ] (Optional) Add a real payment gateway alongside COD

## Default credentials (CHANGE THESE)
- Admin: `admin@avioboots.com` / `admin123`
- Demo customer: `demo@avioboots.com` / `demo123`
