# Deployment Checklist

## Pre-Deployment

- [ ] Run tests: `php artisan test`
- [ ] Build frontend: `npm run production`
- [ ] Verify `.env` has production values:
  - `APP_ENV=production`
  - `APP_DEBUG=false`
  - `APP_URL=https://your-domain.com`
  - Database credentials configured
  - VFD credentials configured (if applicable)
  - Mail settings configured
- [ ] Back up current database

## Deployment Steps

```bash
# 1. Pull latest code
git pull origin main

# 2. Install dependencies (no dev packages)
composer install --no-dev --optimize-autoloader

# 3. Run migrations
php artisan migrate --force

# 4. Clear and rebuild caches
php artisan config:cache
php artisan route:cache
php artisan view:cache

# 5. Ensure Passport keys exist
php artisan passport:keys

# 6. Set permissions
chmod 600 storage/oauth-private.key
chmod -R 775 storage/
chmod -R 775 bootstrap/cache/
```

## Post-Deployment

- [ ] Verify health endpoint: `curl https://your-domain.com/api/health`
- [ ] Test login functionality
- [ ] Verify VFD connection (if applicable)
- [ ] Check shift session functionality
- [ ] Monitor `storage/logs/laravel.log` for errors

## Scheduled Tasks

Add to server crontab:
```bash
* * * * * cd /path-to-project && php artisan schedule:run >> /dev/null 2>&1
```

## Backup

Database backups are managed through the admin panel. For automated off-site backups:
```bash
# Daily database backup
0 2 * * * mysqldump -u user -p'pass' interchick | gzip > /backups/interchick-$(date +\%Y\%m\%d).sql.gz
```

## Server Requirements

- PHP 8.1+ with extensions: BCMath, Ctype, JSON, Mbstring, OpenSSL, PDO, Tokenizer, XML, GD
- MySQL 5.7+ or MariaDB 10.3+
- Nginx or Apache with mod_rewrite
- SSL certificate (required for secure cookies)
- Supervisor (for queue workers, if using async queues)
